lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ab6e8eeb-576c-436b-abee-fd9bce08ac0c@xen0n.name>
Date:   Mon, 17 Apr 2023 01:57:01 +0800
From:   WANG Xuerui <kernel@...0n.name>
To:     loongarch@...ts.linux.dev
Cc:     WANG Xuerui <git@...0n.name>, Huacai Chen <chenhuacai@...nel.org>,
        Xi Ruoyao <xry111@...111.site>,
        Eric Biederman <ebiederm@...ssion.com>,
        Al Viro <viro@...iv.linux.org.uk>,
        Arnd Bergmann <arnd@...db.de>, linux-api@...r.kernel.org,
        linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] LoongArch: Relay BCE exceptions to userland as
 SIGSEGVs with si_code=SEGV_BNDERR

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/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ