This is a note to let you know that I've just added the patch titled selftests/bpf: Add bpf_testmod_fentry_* functions to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: selftests-bpf-add-bpf_testmod_fentry_-functions.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Fri Dec 16 13:57:32 2022 From: Jiri Olsa <jolsa@xxxxxxxxxx> Date: Fri, 16 Dec 2022 13:56:26 +0100 Subject: selftests/bpf: Add bpf_testmod_fentry_* functions To: stable@xxxxxxxxxxxxxxx Cc: Song Liu <song@xxxxxxxxxx>, bpf@xxxxxxxxxxxxxxx, Martynas Pumputis <m@xxxxxxxxx> Message-ID: <20221216125628.1622505-7-jolsa@xxxxxxxxxx> From: Jiri Olsa <jolsa@xxxxxxxxxx> commit fee356ede980b6c2c8db612e18b25738356d6744 upstream. Adding 3 bpf_testmod_fentry_* functions to have a way to test kprobe multi link on kernel module. They follow bpf_fentry_test* functions prototypes/code. Adding equivalent functions to all bpf_fentry_test* does not seems necessary at the moment, could be added later. Acked-by: Song Liu <song@xxxxxxxxxx> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> Link: https://lore.kernel.org/r/20221025134148.3300700-7-jolsa@xxxxxxxxxx Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 24 ++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c @@ -88,6 +88,23 @@ __weak noinline struct file *bpf_testmod } } +noinline int bpf_testmod_fentry_test1(int a) +{ + return a + 1; +} + +noinline int bpf_testmod_fentry_test2(int a, u64 b) +{ + return a + b; +} + +noinline int bpf_testmod_fentry_test3(char a, int b, u64 c) +{ + return a + b + c; +} + +int bpf_testmod_fentry_ok; + noinline ssize_t bpf_testmod_test_read(struct file *file, struct kobject *kobj, struct bin_attribute *bin_attr, @@ -119,6 +136,13 @@ bpf_testmod_test_read(struct file *file, return snprintf(buf, len, "%d\n", writable.val); } + if (bpf_testmod_fentry_test1(1) != 2 || + bpf_testmod_fentry_test2(2, 3) != 5 || + bpf_testmod_fentry_test3(4, 5, 6) != 15) + goto out; + + bpf_testmod_fentry_ok = 1; +out: return -EIO; /* always fail */ } EXPORT_SYMBOL(bpf_testmod_test_read); Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-6.0/ftrace-add-support-to-resolve-module-symbols-in-ftrace_lookup_symbols.patch queue-6.0/selftests-bpf-add-kprobe_multi-kmod-attach-api-tests.patch queue-6.0/bpf-take-module-reference-on-kprobe_multi-link.patch queue-6.0/selftests-bpf-add-load_kallsyms_refresh-function.patch queue-6.0/kallsyms-make-module_kallsyms_on_each_symbol-generally-available.patch queue-6.0/selftests-bpf-add-bpf_testmod_fentry_-functions.patch queue-6.0/selftests-bpf-add-kprobe_multi-check-to-module-attach-test.patch queue-6.0/bpf-rename-__bpf_kprobe_multi_cookie_cmp-to-bpf_kprobe_multi_addrs_cmp.patch