lkml.org 
[lkml]   [2021]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RESEND 0/3] x86/sgx: eextend ioctl
From
Date
On 4/2/21 1:20 PM, Jethro Beekman wrote:
> On 2021-04-02 21:50, Dave Hansen wrote:
>> Again, how does this save space?
>>
>> Are you literally talking about the temporary cost of allocating *one* page?
>
> No I'm talking about the amount of disk space/network traffic needed
> to distribute the application.

Am I just horribly confused about how executable formats work?

Executables go through an SGX loader that copies them into SGX memory
with the kernel's help.

That executable can have *ANY* format, really.

Then, a loader needs to read that format and turn it into data that can
be shoved into the kernel. The simplest way to do this is to just
mmap() the executable and point the kernel ioctl()'s at the executable's
pages one-by-one.

The other way a loader *could* work is to copy the data to a temporary
location and then hand the temporary location to the SGX ioctl()s.

Let's say the kernel *REQUIRED* page-aligned and page-sized ioctl()
arguments forever. If an executable had a 256-byte-sized chunk of data,
all the loader would have to do is allocate a page, copy the data in
there, and then pass that whole page into the ioctl().

In other words, the loading restrictions (page alignment) have little to
nothing to do with the format of the thing loading the executable.

But, in no way does a kernel page-size-based ABI *REQUIRE* that an
underlying binary format represent things only in page-sized chunks.
Look at how many page-sized executables there are in /bin. Yet, they
can only be mapped into the address space in PAGE_SIZE increments.

>>>> Does any actual, real-world enclave want this functionality? Why?
>>
>> I didn't see an answer on this one.
>
> Yes, we have enclaves that use this functionality. They already exist
> so they can't be changed (without changing the measurement) and we'd
> like to stop using the out of tree driver as soon as possible.
> However, we are not able to load the enclaves.
OK, so please give this series another shot. Please explain why you
*ACTUALLY* need it and what the goals are. Please explain why you can't
just relax the restrictions of the existing add ioctl() to take
<PAGE_SIZE arguments.

As far as I can tell, there are only two coherent arguments for this
functionality:
1. It makes the loader simpler so that it doesn't need temporary pages
2. It would allow old enclaves created with non-upstream-Linux SGX
implementations to end up with the same signatures on these
implementations as upstream Linux.

I find both of those pretty weak arguments. Doing #2 just for the
out-of-tree Linux implementation also encourages folks to establish ABI
out of the tree and then foist it on upstream later. That's not super cool.
But, I guess this would be nice to the folks that have gone to the
trouble of building SGX enclaves for all these years with no upstream
support.

I'll try to look at it with fresh eyes once this is in place.

\
 
 \ /
  Last update: 2021-04-02 22:48    [W:0.052 / U:3.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site