On Mon, Nov 27, 2023 at 05:50:12PM +0100, Francis Laniel wrote: > When a kprobe is attached to a function that's name is not unique (is > static and shares the name with other functions in the kernel), the > kprobe is attached to the first function it finds. This is a bug as the > function that it is attaching to is not necessarily the one that the > user wants to attach to. > > Instead of blindly picking a function to attach to what is ambiguous, > error with EADDRNOTAVAIL to let the user know that this function is not > unique, and that the user must use another unique function with an > address offset to get to the function they want to attach to. > > Link: https://lore.kernel.org/all/20231020104250.9537-2-flaniel@xxxxxxxxxxxxxxxxxxx/ > > Cc: stable@xxxxxxxxxxxxxxx > Fixes: 413d37d1eb69 ("tracing: Add kprobe-based event tracer") > Suggested-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> > Signed-off-by: Francis Laniel <flaniel@xxxxxxxxxxxxxxxxxxx> > Link: https://lore.kernel.org/lkml/20230819101105.b0c104ae4494a7d1f2eea742@xxxxxxxxxx/ > Acked-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> > (cherry picked from commit b022f0c7e404887a7c5229788fc99eff9f9a80d5) > --- > kernel/trace/trace_kprobe.c | 48 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 48 insertions(+) All now queued up, thanks. greg k-h