Commit b0daf4df authored by Will Deacon's avatar Will Deacon Committed by Greg Kroah-Hartman

arm64: don't call break hooks for BRK exceptions from EL0

commit c878e0cf upstream.

Our break hooks are used to handle brk exceptions from kgdb (and potentially
kprobes if that code ever resurfaces), so don't bother calling them if
the BRK exception comes from userspace.

This prevents userspace from trapping to a kdb shell on systems where
kgdb is enabled and active.
Reported-by: default avatarOmar Sandoval <osandov@osandov.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b991e164
...@@ -315,20 +315,20 @@ static int brk_handler(unsigned long addr, unsigned int esr, ...@@ -315,20 +315,20 @@ static int brk_handler(unsigned long addr, unsigned int esr,
{ {
siginfo_t info; siginfo_t info;
if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED) if (user_mode(regs)) {
return 0; info = (siginfo_t) {
.si_signo = SIGTRAP,
.si_errno = 0,
.si_code = TRAP_BRKPT,
.si_addr = (void __user *)instruction_pointer(regs),
};
if (!user_mode(regs)) force_sig_info(SIGTRAP, &info, current);
} else if (call_break_hook(regs, esr) != DBG_HOOK_HANDLED) {
pr_warning("Unexpected kernel BRK exception at EL1\n");
return -EFAULT; return -EFAULT;
}
info = (siginfo_t) {
.si_signo = SIGTRAP,
.si_errno = 0,
.si_code = TRAP_BRKPT,
.si_addr = (void __user *)instruction_pointer(regs),
};
force_sig_info(SIGTRAP, &info, current);
return 0; return 0;
} }
......
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