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: <bb43abe9e13f9a3af7e424e997c73c790b5ff7bf.camel@intel.com>
Date:   Tue, 27 Jul 2021 02:04:21 +0000
From:   "Sakkinen, Jarkko" <jarkko.sakkinen@...el.com>
To:     "Luck, Tony" <tony.luck@...el.com>,
        "Hansen, Dave" <dave.hansen@...el.com>,
        "seanjc@...gle.com" <seanjc@...gle.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v2 1/6] x86/sgx: Provide indication of life-cycle of EPC
 pages

On Mon, 2021-07-19 at 11:20 -0700, Tony Luck wrote:
> SGX EPC pages go through the following life cycle:
> 
> 	DIRTY ---> FREE ---> IN-USE --\
>                     ^                 |
>                     \-----------------/
> 
> Recovery action for poison for a DIRTY or FREE page is simple. Just
> make sure never to allocate the page. IN-USE pages need some extra
> handling.
> 
> It would be good to use the sgx_epc_page->owner field as an indicator
> of where an EPC page is currently in that cycle (owner != NULL means
> the EPC page is IN-USE). But there is one caller, sgx_alloc_va_page(),
> that calls with NULL.
> 
> Make the following changes:
> 
> 1) Change the type of "owner" to "void *" (it can have other types
>    besides "struct sgx_encl_page *).
> 2) Update sgx_alloc_va_page() to pass in a dummy non-NULL value in
>    this case.
> 3) Add a check to sgx_free_epc_page() to prevent calling with NULL.
> 4) Reset owner to NULL in sgx_free_epc_page().
> 
> Signed-off-by: Tony Luck <tony.luck@...el.com>
> ---
>  arch/x86/kernel/cpu/sgx/encl.c | 2 +-
>  arch/x86/kernel/cpu/sgx/main.c | 6 ++++++
>  arch/x86/kernel/cpu/sgx/sgx.h  | 2 +-
>  3 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
> index 001808e3901c..ca328d56d230 100644
> --- a/arch/x86/kernel/cpu/sgx/encl.c
> +++ b/arch/x86/kernel/cpu/sgx/encl.c
> @@ -679,7 +679,7 @@ struct sgx_epc_page *sgx_alloc_va_page(void)
>  	struct sgx_epc_page *epc_page;
>  	int ret;
>  
> -	epc_page = sgx_alloc_epc_page(NULL, true);
> +	epc_page = sgx_alloc_epc_page("Not NULL!", true);


I would instead set owner to epc_page inside sgx_alloc_epc_page(),
when NULL is passed to owner. That would be semantically sound.

/Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ