]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kprobes: Fix to check symbol prefixes correctly
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 2 Aug 2024 13:53:15 +0000 (22:53 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Mon, 5 Aug 2024 05:04:03 +0000 (14:04 +0900)
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: de02f2ac5d8c ("kprobes: Prohibit probing on CFI preamble symbol")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
kernel/kprobes.c

index e85de37d9e1e01b2dde77c8e63cc4e18673411f6..da59c68df8412c4662d39d3e286d516e8cee9a69 100644 (file)
@@ -1557,8 +1557,8 @@ static bool is_cfi_preamble_symbol(unsigned long addr)
        if (lookup_symbol_name(addr, symbuf))
                return false;
 
-       return str_has_prefix("__cfi_", symbuf) ||
-               str_has_prefix("__pfx_", symbuf);
+       return str_has_prefix(symbuf, "__cfi_") ||
+               str_has_prefix(symbuf, "__pfx_");
 }
 
 static int check_kprobe_address_safe(struct kprobe *p,