Re: [PATCH 09/25] x86/sgx: Keep record of SGX page type

From: Jarkko Sakkinen
Date: Sat Dec 04 2021 - 18:03:39 EST


On Wed, Dec 01, 2021 at 11:23:07AM -0800, Reinette Chatre wrote:
> SGX2 functions are not allowed on all page types. For example,
> ENCLS[EMODPR] is only allowed on regular SGX enclave pages and
> ENCLS[EMODPT] is only allowed on TCS and regular pages. If these
> functions are attempted on another type of page the hardware would
> trigger a fault.
>
> Keep a record of the SGX page type so that there is more
> certainty whether an SGX2 instruction can succeed and faults
> can be treated as real failures.
>
> The page type is made to be a property of struct sgx_encl_page
> and thus does not cover the VA page type. VA pages are maintained
> in separate structures and thus their type can be determined in
> a different way. The SGX2 instructions being supported do not
> operate on VA pages and this is thus not a scenario needing to
> be covered at this time.
>
> With the protection bits consuming 16 bits of the unsigned long
> there is room available in the bitfield to include the page type
> information without increasing the space consumed by the struct.
>
> Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>

I think this is needed for any formation of these patches, and
I cannot forsee it done by any other way, so

Acked-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>

/Jarkko