Commit e697d8dc authored by Jiri Olsa's avatar Jiri Olsa Committed by Alexei Starovoitov
Browse files

selftests/bpf: Add kprobe_multi check to module attach test



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: default avatarSong Liu <song@kernel.org>
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20221025134148.3300700-8-jolsa@kernel.org


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent fee356ed
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);
}
+6 −0
Original line number Diff line number Diff line
@@ -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";