Re: [RFC PATCH 0/4] SGX shmem backing store issue

Reinette Chatre
2022-05-11T17:23:37Z

Hi Jarkko,

On 5/10/2022 3:28 PM, Jarkko Sakkinen wrote:
> Let's just say that I came a bit late to the series, and should have read
> the whole thread before responding to anything. As long as enclave lock is
> kept on both sides things should be fine.

For the most part, yes. The remaining scenario is the case when the reclaimer
releases the enclave mutex while keeping a reference to the backing store pages.
By releasing the enclave mutex there is opportunity for page fault
handler to run and also operate on the backing store. Both the reclaimer
(after patch 3/4 in this series) and page fault handler operate on
the backing store with enclave mutex held but if that is done without
taking backing store references into account data could be lost. This is
addressed in the following series with:
https://lore.kernel.org/linux-sgx/d0ace4a1770ab8f4196bfeae06d0970ddb14ef01.1652131695.git.reinette.chatre@intel.com/

>
> I think for bugs like these it would make sense to put them out early as
> possible, e.g. I would be fine getting them from kernel bugzilla. Now there
> there was two week latency on finding the issue, and making it public.
> Unless there is something confidential, it would be best to get early
> alert. I'm always ready to change my priorities to help to fix such issues.

I am sorry about this. The reason I first struggled with this by myself was
because it was made out to be an SGX2 issue. This was made worse when I was not
able to create an SGX1 test case that can trigger the issue. I thus lacked
evidence that it is an upstream issue and it took me a while to debug and
understand the issue to gain confidence that it is indeed an upstream issue.

Reinette