mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
kprobes: Search non-suffixed symbol in blacklist
Newer GCC versions can generate some different instances of a function with suffixed symbols if the function is optimized and only has a part of that. (e.g. .constprop, .part etc.) In this case, it is not enough to check the entry of kprobe blacklist because it only records non-suffixed symbol address. To fix this issue, search non-suffixed symbol in blacklist if given address is within a symbol which has a suffix. Note that this can cause false positive cases if a kprobe-safe function is optimized to suffixed instance and has same name symbol which is blacklisted. But I would like to chose a fail-safe design for this issue. Signed-off-by: Masami Hiramatsu <[email protected]> Reviewed-by: Steven Rostedt (VMware) <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrea Righi <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/154998799234.31052.6136378903570418008.stgit@devbox Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
0eae81dc9f
commit
6143c6fb1e
1 changed files with 20 additions and 1 deletions
|
|
@ -1396,7 +1396,7 @@ bool __weak arch_within_kprobe_blacklist(unsigned long addr)
|
|||
addr < (unsigned long)__kprobes_text_end;
|
||||
}
|
||||
|
||||
bool within_kprobe_blacklist(unsigned long addr)
|
||||
static bool __within_kprobe_blacklist(unsigned long addr)
|
||||
{
|
||||
struct kprobe_blacklist_entry *ent;
|
||||
|
||||
|
|
@ -1410,7 +1410,26 @@ bool within_kprobe_blacklist(unsigned long addr)
|
|||
if (addr >= ent->start_addr && addr < ent->end_addr)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool within_kprobe_blacklist(unsigned long addr)
|
||||
{
|
||||
char symname[KSYM_NAME_LEN], *p;
|
||||
|
||||
if (__within_kprobe_blacklist(addr))
|
||||
return true;
|
||||
|
||||
/* Check if the address is on a suffixed-symbol */
|
||||
if (!lookup_symbol_name(addr, symname)) {
|
||||
p = strchr(symname, '.');
|
||||
if (!p)
|
||||
return false;
|
||||
*p = '\0';
|
||||
addr = (unsigned long)kprobe_lookup_name(symname, 0);
|
||||
if (addr)
|
||||
return __within_kprobe_blacklist(addr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue