Re: [PATCH v38 10/24] mm: Add vm_ops->mprotect()

Dave Hansen
2020-09-28T14:04:57Z

On 9/27/20 5:53 PM, Jarkko Sakkinen wrote:
> On Fri, Sep 25, 2020 at 12:53:35PM -0700, Dave Hansen wrote:
>> On 9/25/20 12:43 PM, Sean Christopherson wrote:
>>>> That means that the intent argument (SGX_PROT_*) is currently unused.
>>> No, the intent argument is used (eventually) by SGX's ->mprotect()
>>> implementation, i.e. sgx_mprotect() enforces that the actual protections are a
>>> subset of the declared/intended protections.
>>>
>>> If ->mprotect() is not merged, then it yes, it will be unused.
>>
>> OK, I think I've got it.
>>
>> I think I'm OK with adding ->mprotect(). As long as folks buy into the
>> argument that intent needs to be checked at mmap() time, they obviously
>> need to be checked at mprotect() too.
>>
>> Jarkko, if you want to try and rewrite the changelog, capturing the
>> discussion here and reply, I think I can ack the resulting patch. I
>> don't know if that will satisfy the request from Boris from an ack from
>> a "mm person", but we can at least start there. :)
>
> I think what it needs, based on what I've read, is the step by step
> description of the EMODPE scenarion without this callback and with it.

EMODPE is virtually irrelevant for this whole thing. The x86 PTE
permissions still specify the most restrictive permissions, which is
what matters the most.

We care about the _worst_ the enclave can do, not what it imposes on
itself on top of that.

> I think other important thing to underline is that an LSM or any other
> security measure can only do a sane decision when the enclave is loaded.
> At that point we know the source (vm_file).

Right, you know the source, but it can be anonymous or a file.