mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
arm64: force_signal_inject: WARN if called from kernel context
force_signal_inject() is designed to send a fatal signal to userspace, so WARN if the current pt_regs indicates a kernel context. This can currently happen for the undefined instruction trap, so patch that up so we always BUG() if we didn't have a handler. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
This commit is contained in:
parent
b8925ee2e1
commit
8a60419d36
1 changed files with 4 additions and 1 deletions
|
@ -354,6 +354,9 @@ void force_signal_inject(int signal, int code, unsigned long address)
|
|||
const char *desc;
|
||||
struct pt_regs *regs = current_pt_regs();
|
||||
|
||||
if (WARN_ON(!user_mode(regs)))
|
||||
return;
|
||||
|
||||
clear_siginfo(&info);
|
||||
|
||||
switch (signal) {
|
||||
|
@ -408,8 +411,8 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
|
|||
if (call_undef_hook(regs) == 0)
|
||||
return;
|
||||
|
||||
force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc);
|
||||
BUG_ON(!user_mode(regs));
|
||||
force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc);
|
||||
}
|
||||
|
||||
#define __user_cache_maint(insn, address, res) \
|
||||
|
|
Loading…
Reference in a new issue