[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf377db5-c702-0a1d-42b3-4caeb14eb6fa@intel.com>
Date: Mon, 17 Dec 2018 11:09:33 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Cc: x86@...nel.org, platform-driver-x86@...r.kernel.org,
linux-sgx@...r.kernel.org, nhorman@...hat.com,
npmccallum@...hat.com, serge.ayoun@...el.com,
shay.katz-zamir@...el.com, haitao.huang@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, tglx@...utronix.de,
kai.svahn@...el.com, mark.shanahan@...el.com, luto@...capital.net,
Suresh Siddha <suresh.b.siddha@...el.com>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Darren Hart <dvhart@...radead.org>,
Andy Shevchenko <andy@...radead.org>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v17 18/23] platform/x86: Intel SGX driver
On 12/17/18 10:48 AM, Sean Christopherson wrote:
> We can't set mm to NULL as we need it to unregister the notifier, and
> I'm fairly certain attempting to unregister in the release callback
> will deadlock.
Suggestion:
It looks like you only expect one VMA per enclave. Things go bonkers if
this is not true. So, instead of storing encl->mm, don't. You can get
the mm from vma->vm_mm and you could just store encl->vma instead.
Doing that, you could even axe encl->base and encl->size, I think
because you just get those from the VMA itself.
That makes the relationship clearer: 1 VMA per enclave. We also
implicitly understand that if you have a VMA, you implicitly have a ref
to the mm *and* the VMA is immutable.
If there were ever a path where encl->vma wasn't immutable, we'd have a
bug (or load of bugs) somewhere, right?
Powered by blists - more mailing lists