lkml.org 
[lkml]   [2023]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] LoongArch: Relay BCE exceptions to userland as SIGSEGVs with si_code=SEGV_BNDERR
From
On 4/17/23 01:33, WANG Xuerui wrote:
> <snip>
> @@ -589,6 +591,110 @@ static void bug_handler(struct pt_regs *regs)
> }
> }
>
> +asmlinkage void noinstr do_bce(struct pt_regs *regs)
> +{
> + irqentry_state_t state = irqentry_enter(regs);
> + bool user = user_mode(regs);
> + unsigned long era = exception_era(regs);
> + union loongarch_instruction insn;
> + u64 badv = 0, lower = 0, upper = ULONG_MAX;
> +
> + if (regs->csr_prmd & CSR_PRMD_PIE)
> + local_irq_enable();
> +
> + current->thread.trap_nr = read_csr_excode();
> +
> + /*
> + * notify the kprobe handlers, if instruction is likely to
> + * pertain to them.
> + */
> + if (notify_die(DIE_BOUNDS_CHECK, "Bounds check error", regs, 0,
> + current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
> + goto out;
> +
> + __show_regs(regs);

Ah, remnant of debug code. Please ignore this line; I'm not resending
for now because I fully anticipate a v2 (and possibly even more). Lack
of coffee/tea and presence of beer during weekends aren't going to help...

--
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/

\
 
 \ /
  Last update: 2023-04-16 19:57    [W:0.433 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site