summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2021-03-26 11:59:00 +0100
committerAlexei Starovoitov <ast@kernel.org>2021-03-26 19:30:11 -0700
commit861de02e5f3f2a104eecc5af1d248cb7bf8c5f75 (patch)
tree79748704faea37470f54bdef1658b9505d057f86 /include
parentd6fe1cf89026d3111112ee29ef8d93cd7a8aaa24 (diff)
bpf: Take module reference for trampoline in module
Currently module can be unloaded even if there's a trampoline register in it. It's easily reproduced by running in parallel: # while :; do ./test_progs -t module_attach; done # while :; do rmmod bpf_testmod; sleep 0.5; done Taking the module reference in case the trampoline's ip is within the module code. Releasing it when the trampoline's ip is unregistered. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210326105900.151466-1-jolsa@kernel.org
Diffstat (limited to 'include')
-rw-r--r--include/linux/bpf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 3625f019767d..fdac0534ce79 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -40,6 +40,7 @@ struct bpf_local_storage;
struct bpf_local_storage_map;
struct kobject;
struct mem_cgroup;
+struct module;
extern struct idr btf_idr;
extern spinlock_t btf_idr_lock;
@@ -623,6 +624,7 @@ struct bpf_trampoline {
/* Executable image of trampoline */
struct bpf_tramp_image *cur_image;
u64 selector;
+ struct module *mod;
};
struct bpf_attach_target_info {