Re: [RFC PATCH 03/20] x86/sgx: Track owning enclave in VA EPC pages

Dave Hansen
2022-09-22T21:39:53Z

On 9/22/22 13:04, Kristen Carlson Accardi wrote:
>> BTW, is there a flag or any other way to tell to what kind of object
>> ->owner points?
> The owner will only be an sgx_encl type if it is a va page, so to tell
> what kind of object owner is, you look at the epc page flags - like
> this:
> if (epc_page->flags & SGX_EPC_PAGE_ENCLAVE)
> encl = ((struct sgx_encl_page *)epc_page->owner)->encl;
> else if (epc_page->flags & SGX_EPC_PAGE_VERSION_ARRAY)
> encl = epc_page->owner;
> ...

I don't know how much refactoring it would take, but it would be nice if
that was a bit more obvious. Basically, can we get the code that checks
for or sets SGX_EPC_PAGE_VERSION_ARRAY close to the code that assigns or
reads ->owner?