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]
Date:   Wed, 22 Jan 2020 22:29:44 +0300
From:   Cyrill Gorcunov <gorcunov@...il.com>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     Dave Hansen <dave.hansen@...ux.intel.com>,
        linux-kernel@...r.kernel.org, alex.shi@...ux.alibaba.com,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, hpa@...or.com,
        x86@...nel.org, bigeasy@...utronix.de,
        pankaj.laxminarayan.bharadiya@...el.com, aubrey.li@...ux.intel.com
Subject: Re: [PATCH] x86/pkeys: add check for pkey "overflow"

On Wed, Jan 22, 2020 at 11:09:47AM -0800, Dave Hansen wrote:
> On 1/22/20 10:51 AM, Cyrill Gorcunov wrote:
> >> +	/*
> >> +	 * This code should only be called with valid 'pkey'
> >> +	 * values originating from in-kernel users.  Complain
> >> +	 * if a bad value is observed.
> >> +	 */
> >> +	WARN_ON_ONCE(pkey >= arch_max_pkey());
>
> > Should not we rather abort this operation and exit with EINVAL
> > or something similar instead of calling wrmsr with overflowed
> > value? IOW,
> > 
> > 	if (pkey >= arch_max_pkey()) {
> > 		WARN_ON_ONCE(1);
> > 		return -EINVAL;
> > 	}
> 
> I don't feel strongly about it.  The reason I didn't do that is to
> minimize the chance that this would cause any functional regression.

OK, I don't mind leaving just WARN_ON_ONCE.

> 
> It's not a huge chance, but I've certainly fat-fingered my share of
> off-by-one bugs.

Heh :)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ