public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: Dave Hansen <dave.hansen@intel.com>, Jarkko Sakkinen <jarkko@kernel.org>
Cc: Andrew Zaborowski <andrew.zaborowski@intel.com>, <x86@kernel.org>,
	<linux-sgx@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Tony Luck <tony.luck@intel.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@redhat.com>,
	"H . Peter Anvin" <hpa@zytor.com>, <balrogg@gmail.com>
Subject: Re: [PATCH] x86: sgx: Don't track poisoned pages for reclaiming
Date: Wed, 12 Feb 2025 23:38:16 +1300	[thread overview]
Message-ID: <3de12591-e935-4f3b-9d5a-d13741a7ef62@intel.com> (raw)
In-Reply-To: <7ed9b288-69a2-446c-9f7f-50ef6bc56673@intel.com>



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.

  parent reply	other threads:[~2025-02-12 10:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 15:01 [PATCH] x86: sgx: Don't track poisoned pages for reclaiming Andrew Zaborowski
2025-02-11 16:25 ` Dave Hansen
2025-02-11 21:03   ` Jarkko Sakkinen
2025-02-11 21:18     ` Huang, Kai
2025-02-11 23:24       ` Jarkko Sakkinen
2025-02-11 23:31       ` Dave Hansen
2025-02-12  0:32         ` andrzej zaborowski
2025-02-12  0:37           ` Dave Hansen
2025-02-12 10:38         ` Huang, Kai [this message]
2025-02-12 21:25         ` Jarkko Sakkinen
2025-02-12  0:22   ` Andrew Zaborowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3de12591-e935-4f3b-9d5a-d13741a7ef62@intel.com \
    --to=kai.huang@intel.com \
    --cc=andrew.zaborowski@intel.com \
    --cc=balrogg@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox