Re: [PATCH RFC] x86/sgx: Simplify struct sgx_enclave_restrict_permissions

From: Jarkko Sakkinen
Date: Tue Apr 05 2022 - 19:02:42 EST


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.

BR, Jarkko