bpf: struct_ops supports more than one page for trampolines.
[linux-2.6-microblaze.git] / net / bpf / bpf_dummy_struct_ops.c
index 02de717..1b5f812 100644 (file)
@@ -91,6 +91,7 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
        struct bpf_tramp_link *link = NULL;
        void *image = NULL;
        unsigned int op_idx;
+       u32 image_off = 0;
        int prog_ret;
        s32 type_id;
        int err;
@@ -114,12 +115,6 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
                goto out;
        }
 
-       image = arch_alloc_bpf_trampoline(PAGE_SIZE);
-       if (!image) {
-               err = -ENOMEM;
-               goto out;
-       }
-
        link = kzalloc(sizeof(*link), GFP_USER);
        if (!link) {
                err = -ENOMEM;
@@ -133,7 +128,8 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
        err = bpf_struct_ops_prepare_trampoline(tlinks, link,
                                                &st_ops->func_models[op_idx],
                                                &dummy_ops_test_ret_function,
-                                               image, image + PAGE_SIZE);
+                                               &image, &image_off,
+                                               true);
        if (err < 0)
                goto out;
 
@@ -147,7 +143,7 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
                err = -EFAULT;
 out:
        kfree(args);
-       arch_free_bpf_trampoline(image, PAGE_SIZE);
+       bpf_struct_ops_image_free(image);
        if (link)
                bpf_link_put(&link->link);
        kfree(tlinks);