Re: [PATCH] x86/sgx: fix a NULL pointer

From: Haitao Huang
Date: Tue Jul 18 2023 - 19:11:51 EST


On Tue, 18 Jul 2023 10:37:45 -0500, Jarkko Sakkinen <jarkko@xxxxxxxxxx> wrote:

On Mon Jul 17, 2023 at 11:29 PM EEST, Haitao Huang wrote:
Under heavy load, the SGX EPC reclaimers (current ksgxd or future EPC
cgroup worker) may reclaim the SECS EPC page for an enclave and set
encl->secs.epc_page to NULL. But the SECS EPC page is used for EAUG in
the SGX #PF handler without checking for NULL and reloading.

Fix this by checking if SECS is loaded before EAUG and load it if it was
reclaimed.

Fixes: 5a90d2c3f5ef8 ("x86/sgx: Support adding of pages to an initialized enclave")
Cc: stable@xxxxxxxxxxxxxxx

Given that

$ git describe --contains 5a90d2c3f5ef8
v6.0-rc1~102^2~16

You could also describe this as:

Cc: stable@xxxxxxxxxxxxxxx # v6.0+

Will add


...

Reviewed-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>


Thank you.
Haitao