[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3de12591-e935-4f3b-9d5a-d13741a7ef62@intel.com>
Date: Wed, 12 Feb 2025 23:38:16 +1300
From: "Huang, Kai" <kai.huang@...el.com>
To: Dave Hansen <dave.hansen@...el.com>, Jarkko Sakkinen <jarkko@...nel.org>
CC: Andrew Zaborowski <andrew.zaborowski@...el.com>, <x86@...nel.org>,
<linux-sgx@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Dave Hansen
<dave.hansen@...ux.intel.com>, Tony Luck <tony.luck@...el.com>, "Thomas
Gleixner" <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>, Ingo Molnar
<mingo@...hat.com>, "H . Peter Anvin" <hpa@...or.com>, <balrogg@...il.com>
Subject: Re: [PATCH] x86: sgx: Don't track poisoned pages for reclaiming
On 12/02/2025 12:31 pm, Dave Hansen wrote:
> On 2/11/25 13:18, Huang, Kai wrote:
>>>> This requires low-level SGX implementation knowledge to fully
>>>> understand. Both what "ETRACK, EBLOCK and EWB" are in the first place,
>>>> how they are involved in reclaim and also why EREMOVE doesn't lead to
>>>> the same fate.
>>>
>>> Does it? [I'll dig up Intel SDM to check this]
>>>
>> I just did. 🙂
>>
>> It seems EREMOVE only reads and updates the EPCM entry for the target
>> EPC page but won't actually access that EPC page.
>
> Actually, now that I think about it even more, why would ETRACK or
> EBLOCK access the page itself? They seem superficially like they'd be
> metadata-only too.
Looking at the pseudo code, AFAICT EBLOCK doesn't touch the EPC page
either, but ETRACK actually reads SECS (ETRACK must take SECS page as
input):
(* All processors must have completed the previous tracking cycle*)
IF ( (DS:RCX).TRACKING ≠0) )
......
Here the DS:RCX is the SECS page.
I think this also is consistent with what Andrew said:
"I haven't seen a crash in either of these (always in EWB), ..."
because a poisoned EPC page being regular enclave page has much higher
possibility. In fact, ETRACK only takes SECS page but I think the
chance that the kernel code can still reach ETRACK while SECS page is
poisoned should be just 0.
Powered by blists - more mailing lists