Skip to content

Commit 8c8acb8

Browse files
committed
kprobes: Fix to check symbol prefixes correctly
Since str_has_prefix() takes the prefix as the 2nd argument and the string as the first, is_cfi_preamble_symbol() always fails to check the prefix. Fix the function parameter order so that it correctly check the prefix. Link: https://lore.kernel.org/all/172260679559.362040.7360872132937227206.stgit@devnote2/ Fixes: de02f2a ("kprobes: Prohibit probing on CFI preamble symbol") Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
1 parent 0e8b539 commit 8c8acb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/kprobes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,8 +1557,8 @@ static bool is_cfi_preamble_symbol(unsigned long addr)
15571557
if (lookup_symbol_name(addr, symbuf))
15581558
return false;
15591559

1560-
return str_has_prefix("__cfi_", symbuf) ||
1561-
str_has_prefix("__pfx_", symbuf);
1560+
return str_has_prefix(symbuf, "__cfi_") ||
1561+
str_has_prefix(symbuf, "__pfx_");
15621562
}
15631563

15641564
static int check_kprobe_address_safe(struct kprobe *p,

0 commit comments

Comments
 (0)