]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tracing/kprobes: Add symbol counting check when module loads
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 5 Jul 2024 07:11:25 +0000 (16:11 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Sat, 6 Jul 2024 00:27:47 +0000 (09:27 +0900)
commit9d8616034f161222a4ac166c1b42b6d79961c005
treecfdb798d0c6ae33b722755ecbd96f094e5571acf
parent637c26f9b02d9c72448fcd5c9c4e3b08015404fc
tracing/kprobes: Add symbol counting check when module loads

Currently, kprobe event checks whether the target symbol name is unique
or not, so that it does not put a probe on an unexpected place. But this
skips the check if the target is on a module because the module may not
be loaded.

To fix this issue, this patch checks the number of probe target symbols
in a target module when the module is loaded. If the probe is not on the
unique name symbols in the module, it will be rejected at that point.

Note that the symbol which has a unique name in the target module,
it will be accepted even if there are same-name symbols in the
kernel or other modules,

Link: https://lore.kernel.org/all/172016348553.99543.2834679315611882137.stgit@devnote2/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_kprobe.c