Commit 888b3c87 authored by Pratyush Anand's avatar Pratyush Anand Committed by Catalin Marinas

arm64: Treat all entry code as non-kprobe-able

Entry symbols are not kprobe safe. So blacklist them for kprobing.
Signed-off-by: default avatarPratyush Anand <panand@redhat.com>
Signed-off-by: default avatarDavid A. Long <dave.long@linaro.org>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
[catalin.marinas@arm.com: Do not include syscall wrappers in .entry.text]
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 44b53f67
...@@ -242,6 +242,7 @@ tsk .req x28 // current thread_info ...@@ -242,6 +242,7 @@ tsk .req x28 // current thread_info
/* /*
* Exception vectors. * Exception vectors.
*/ */
.pushsection ".entry.text", "ax"
.align 11 .align 11
ENTRY(vectors) ENTRY(vectors)
...@@ -774,6 +775,8 @@ __ni_sys_trace: ...@@ -774,6 +775,8 @@ __ni_sys_trace:
bl do_ni_syscall bl do_ni_syscall
b __sys_trace_return b __sys_trace_return
.popsection // .entry.text
/* /*
* Special system call wrappers. * Special system call wrappers.
*/ */
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <asm/insn.h> #include <asm/insn.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm-generic/sections.h>
#include "decode-insn.h" #include "decode-insn.h"
...@@ -519,6 +520,31 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) ...@@ -519,6 +520,31 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
return 1; return 1;
} }
bool arch_within_kprobe_blacklist(unsigned long addr)
{
extern char __idmap_text_start[], __idmap_text_end[];
extern char __hyp_idmap_text_start[], __hyp_idmap_text_end[];
if ((addr >= (unsigned long)__kprobes_text_start &&
addr < (unsigned long)__kprobes_text_end) ||
(addr >= (unsigned long)__entry_text_start &&
addr < (unsigned long)__entry_text_end) ||
(addr >= (unsigned long)__idmap_text_start &&
addr < (unsigned long)__idmap_text_end) ||
!!search_exception_tables(addr))
return true;
if (!is_kernel_in_hyp_mode()) {
if ((addr >= (unsigned long)__hyp_text_start &&
addr < (unsigned long)__hyp_text_end) ||
(addr >= (unsigned long)__hyp_idmap_text_start &&
addr < (unsigned long)__hyp_idmap_text_end))
return true;
}
return false;
}
int __init arch_init_kprobes(void) int __init arch_init_kprobes(void)
{ {
return 0; return 0;
......
...@@ -118,6 +118,7 @@ SECTIONS ...@@ -118,6 +118,7 @@ SECTIONS
__exception_text_end = .; __exception_text_end = .;
IRQENTRY_TEXT IRQENTRY_TEXT
SOFTIRQENTRY_TEXT SOFTIRQENTRY_TEXT
ENTRY_TEXT
TEXT_TEXT TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment