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: <DM8PR11MB57508A3681C614C9B185B04EE7A42@DM8PR11MB5750.namprd11.prod.outlook.com>
Date: Mon, 24 Mar 2025 12:12:41 +0000
From: "Reshetova, Elena" <elena.reshetova@...el.com>
To: Jarkko Sakkinen <jarkko@...nel.org>
CC: "Hansen, Dave" <dave.hansen@...el.com>, "linux-sgx@...r.kernel.org"
	<linux-sgx@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>, "Mallick,
 Asit K" <asit.k.mallick@...el.com>, "Scarlata, Vincent R"
	<vincent.r.scarlata@...el.com>, "Cai, Chong" <chongc@...gle.com>, "Aktas,
 Erdem" <erdemaktas@...gle.com>, "Annapurve, Vishal" <vannapurve@...gle.com>,
	"dionnaglaze@...gle.com" <dionnaglaze@...gle.com>, "bondarn@...gle.com"
	<bondarn@...gle.com>, "Raynor, Scott" <scott.raynor@...el.com>, "Shutemov,
 Kirill" <kirill.shutemov@...el.com>
Subject: RE: [PATCH 1/4] x86/sgx: Add total number of EPC pages

> On Fri, Mar 21, 2025 at 02:34:40PM +0200, Elena Reshetova wrote:
> > In order to successfully execute ENCLS[EUPDATESVN], EPC must be empty.
> > SGX already has a variable sgx_nr_free_pages that tracks free
> > EPC pages. Add a new variable, sgx_nr_total_pages, that will keep
> > track of total number of EPC pages. It will be used in subsequent
> > patch to change the sgx_nr_free_pages into sgx_nr_used_pages and
> > allow an easy check for an empty EPC.
> 
> First off, remove "in subsequent patch".

Ok

> 
> What does "change sgx_nr_free_pages into sgx_nr_used_pages" mean?

As you can see from patch 2/4, I had to turn around the meaning of the
existing sgx_nr_free_pages atomic counter not to count the # of free pages
in EPC, but to count the # of used EPC pages (hence the change of name
to sgx_nr_used_pages). The reason for doing this is only apparent in patch
4/4 because by having a counter sgx_nr_used_pages  incremented in the
atomic_long_inc_not_zero, there is a fast path that avoids taking any locks
in cases when the EPC page is not the first one to be created (most of cases).
I originally created a version with just using sgx_nr_free_pages, but could
not avoided taking a lock in each case and it did look much less pretty than
this version. The credit for the idea btw goes to Kirill who kindly reviewed
my  patches before. 

Best Regards,
Elena.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ