This is a note to let you know that I've just added the patch titled selftests/bpf: Add kprobe_multi check to module attach test 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-kprobe_multi-check-to-module-attach-test.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:41 2022 From: Jiri Olsa <jolsa@xxxxxxxxxx> Date: Fri, 16 Dec 2022 13:56:27 +0100 Subject: selftests/bpf: Add kprobe_multi check to module attach test To: stable@xxxxxxxxxxxxxxx Cc: Song Liu <song@xxxxxxxxxx>, bpf@xxxxxxxxxxxxxxx, Martynas Pumputis <m@xxxxxxxxx> Message-ID: <20221216125628.1622505-8-jolsa@xxxxxxxxxx> From: Jiri Olsa <jolsa@xxxxxxxxxx> commit e697d8dcebd2f557fa5e5ed57aaf0a9992ce9df8 upstream. Adding test that makes sure the kernel module won't be removed if there's kprobe multi link defined on top of it. Acked-by: Song Liu <song@xxxxxxxxxx> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> Link: https://lore.kernel.org/r/20221025134148.3300700-8-jolsa@xxxxxxxxxx Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/bpf/prog_tests/module_attach.c | 7 +++++++ tools/testing/selftests/bpf/progs/test_module_attach.c | 6 ++++++ 2 files changed, 13 insertions(+) --- a/tools/testing/selftests/bpf/prog_tests/module_attach.c +++ b/tools/testing/selftests/bpf/prog_tests/module_attach.c @@ -103,6 +103,13 @@ void test_module_attach(void) ASSERT_ERR(delete_module("bpf_testmod", 0), "delete_module"); bpf_link__destroy(link); + link = bpf_program__attach(skel->progs.kprobe_multi); + if (!ASSERT_OK_PTR(link, "attach_kprobe_multi")) + goto cleanup; + + ASSERT_ERR(delete_module("bpf_testmod", 0), "delete_module"); + bpf_link__destroy(link); + cleanup: test_module_attach__destroy(skel); } --- a/tools/testing/selftests/bpf/progs/test_module_attach.c +++ b/tools/testing/selftests/bpf/progs/test_module_attach.c @@ -110,4 +110,10 @@ int BPF_PROG(handle_fmod_ret, return 0; /* don't override the exit code */ } +SEC("kprobe.multi/bpf_testmod_test_read") +int BPF_PROG(kprobe_multi) +{ + return 0; +} + char _license[] SEC("license") = "GPL"; 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