[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <CDE2F14E-97B8-4648-B1F3-4B21703BDDB3@amacapital.net>
Date: Thu, 27 Sep 2018 07:41:00 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
"Christopherson, Sean J" <sean.j.christopherson@...el.com>,
Andrew Lutomirski <luto@...nel.org>, X86 ML <x86@...nel.org>,
Platform Driver <platform-driver-x86@...r.kernel.org>,
nhorman@...hat.com, npmccallum@...hat.com,
"Ayoun, Serge" <serge.ayoun@...el.com>, shay.katz-zamir@...el.com,
linux-sgx@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v14 09/19] x86/mm: x86/sgx: Signal SEGV_SGXERR for #PFs w/ PF_SGX
> On Sep 27, 2018, at 7:21 AM, Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com> wrote:
>
>> On Wed, Sep 26, 2018 at 03:37:45PM -0700, Andy Lutomirski wrote:
>> Yeah. Maybe like this: > > xorl %eax,%eax > eenter_insn:
>> ENCLU[whatever]
>> eenter_landing_pad:
>> ret
>>
>> And the kernel would use the existing vdso2c vdso-symbol-finding
>> mechanism to do the fixup.
>>
>>>
>>> How would a syscall work, though? I assume we can't just enter the
>>> enclave from ring0.
>>
>> My understanding of how AEX works is a bit vague, but maybe a syscall
>> could reuse the mechanism? The vDSO approach seems considerably
>> simpler.
>>
>> We do need to make sure that a fault that happens on or after return
>> from an AEX event does the right thing. But I'm still vague on how
>> that works, sigh.
>>
>> --Andy
>
> Returning from AEX does not differ from any other memory access event so
> AFAIK it should be handled right with the proposed solution already.
> For convenience I think we could have a fixed trampoline for AEX e.g.
> this how it is implemented in the open source LE that I did:
>
> sgx_get_token:
> push %rbx
> mov $0x02, %rax
> mov %rsi, %rbx
> mov %rdx, %rsi
> mov $sgx_async_exit, %rcx
> sgx_async_exit:
> ENCLU
> pop %rbx
> ret
>
> BTW, if I converted the in-kernel LE as a standalone test program, would
> that be useful for basic testing of the series?
>
>
Definitely. Especially if you stick it in selftests/x86 and make it exit cleanly (error code 0) on unsupported hardware.
Powered by blists - more mailing lists