summaryrefslogtreecommitdiff
path: root/kernel/kprobes.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-08-18 15:57:43 +0200
committerIngo Molnar <mingo@kernel.org>2020-09-01 09:58:04 +0200
commit6333e8f73b834f54e395a056e6002403f0862c51 (patch)
treee347bbf8a19d2efcdae91fdd8338c8b175ce4cd5 /kernel/kprobes.c
parent9183c3f9ed710a8edf1a61e8a96d497258d26e08 (diff)
static_call: Avoid kprobes on inline static_call()s
Similar to how we disallow kprobes on any other dynamic text (ftrace/jump_label) also disallow kprobes on inline static_call()s. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20200818135804.744920586@infradead.org
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r--kernel/kprobes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 287b263c9cb9..67e6a8c18007 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -36,6 +36,7 @@
#include <linux/cpu.h>
#include <linux/jump_label.h>
#include <linux/perf_event.h>
+#include <linux/static_call.h>
#include <asm/sections.h>
#include <asm/cacheflush.h>
@@ -1634,6 +1635,7 @@ static int check_kprobe_address_safe(struct kprobe *p,
if (!kernel_text_address((unsigned long) p->addr) ||
within_kprobe_blacklist((unsigned long) p->addr) ||
jump_label_text_reserved(p->addr, p->addr) ||
+ static_call_text_reserved(p->addr, p->addr) ||
find_bug((unsigned long)p->addr)) {
ret = -EINVAL;
goto out;