[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrW_8LnitFamYUU7POHFOJFxLO7ESFUdS=aeG_SOvHVPkw@mail.gmail.com>
Date: Wed, 19 Dec 2018 18:58:48 -0800
From: Andy Lutomirski <luto@...nel.org>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Jethro Beekman <jethro@...tanix.com>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"x86@...nel.org" <x86@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>,
Josh Triplett <josh@...htriplett.org>,
Haitao Huang <haitao.huang@...ux.intel.com>,
"Dr . Greg Wettstein" <greg@...ellic.com>
Subject: Re: x86/sgx: uapi change proposal
> On Dec 19, 2018, at 6:45 AM, Sean Christopherson <sean.j.christopherson@...el.com> wrote:
>
>> On Wed, Dec 19, 2018 at 09:36:16AM +0000, Jethro Beekman wrote:
> I agree with Jethro, passing the enclave_fd as a param is obnoxious.
> And it means the user needs to open /dev/sgx to do anything with an
> enclave fd, e.g. the enclave fd might be passed to a builder thread,
> it shouldn't also need the device fd.
>
> E.g.:
>
> sgx_fd = open("/dev/sgx", O_RDWR);
> BUG_ON(sgx_fd < 0);
>
> enclave_fd = ioctl(sgx_fd, SGX_ENCLAVE_CREATE, &ecreate);
> BUG_ON(enclave_fd < 0);
>
> ret = ioctl(enclave_fd, SGX_ENCLAVE_ADD_PAGE, &eadd);
> BUG_ON(ret);
>
> ...
>
> ret = ioctl(enclave_fd, SGX_ENCLAVE_INIT, &einit);
> BUG_ON(ret);
>
> ...
>
> close(enclave_fd);
> close(sgx_fd);
>
>
> Take a look at virt/kvm/kvm_main.c to see how KVM manages anon inodes
> and ioctls for VMs and vCPUs.
Can one of you explain why SGX_ENCLAVE_CREATE is better than just
opening a new instance of /dev/sgx for each encalve?
Powered by blists - more mailing lists