Re: [PATCH RFC] x86/sgx: Simplify struct sgx_enclave_restrict_permissions
From: Reinette Chatre
Date: Tue Apr 05 2022 - 20:44:50 EST
Hi Jarkko,
On 4/5/2022 11:30 AM, Jarkko Sakkinen wrote:
> On Tue, 2022-04-05 at 10:21 -0700, Reinette Chatre wrote:
>> Hi Jarkko,
>>
>> On 4/5/2022 8:16 AM, Jarkko Sakkinen wrote:
>>> The reasoning to change SECINFO to simply flags is stated in this inline
>>> comment:
>>>
>>> /*
>>> * Return valid permission fields from a secinfo structure provided by
>>> * user space. The secinfo structure is required to only have bits in
>>> * the permission fields set.
>>> */
>>>
>>> It is better to simply change the parameter type than require to use
>>> a malformed version of a data structure.
>>
>> Could you please elaborate what is malformed?
>
> The structure that is accepted by the API. According to SDM permission
> changes are done with a structure where PT_REG is set, which gives
> -EINVAL. I categorize it as a bug.
I assume that you are referring to this line from the SDM:
IF (EPCM(DS:RCX).PT is not PT_REG)
THEN #PF(DS:RCX); FI;
Please note that the above tests the PT bit of the EPCM
entry, not the PT field in the provided SECINFO.
Reinette