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: <20210730003354.xahfbqnjnkexvxh6@kernel.org>
Date:   Fri, 30 Jul 2021 03:33:54 +0300
From:   Jarkko Sakkinen <jarkko@...nel.org>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     Tony Luck <tony.luck@...el.com>,
        Sean Christopherson <seanjc@...gle.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/7] x86/sgx: Provide indication of life-cycle of EPC
 pages

On Wed, Jul 28, 2021 at 03:12:03PM -0700, Dave Hansen wrote:
> On 7/28/21 1:46 PM, Tony Luck wrote:
> > +++ b/arch/x86/kernel/cpu/sgx/main.c
> > @@ -581,7 +581,7 @@ struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim)
> >  	for ( ; ; ) {
> >  		page = __sgx_alloc_epc_page();
> >  		if (!IS_ERR(page)) {
> > -			page->owner = owner;
> > +			page->owner = owner ? owner : page;
> >  			break;
> >  		}
> 
> I'm a little worried about this.
> 
> Let's say we get confused about the type of the page and dereference
> page->owner.  If it's NULL, we get a nice oops.  If it's a real, valid
> pointer, we get real valid memory back that we can scribble on.
> 
> Wouldn't it be safer to do something like:
> 
> 	page->owner = owner ? owner : (void *)-1;
> 
> -1 is non-NULL, but also invalid, which makes it harder for us to poke
> ourselves in the eye.

Works for me.

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ