Re: [PATCH v2 2/2] x86: sgx_vepc: implement SGX_IOC_VEPC_REMOVE ioctl

Paolo Bonzini
2021-10-12T17:03:57Z

On 12/10/21 18:57, Jarkko Sakkinen wrote:
>> +
>>  static const struct file_operations sgx_vepc_fops = {
>>         .owner          = THIS_MODULE,
>>         .open           = sgx_vepc_open,
>> +       .unlocked_ioctl = sgx_vepc_ioctl,
>> +       .compat_ioctl   = sgx_vepc_ioctl,
>>         .release        = sgx_vepc_release,
>>         .mmap           = sgx_vepc_mmap,
>>  };
> I went through this a few times, the code change is sound and
> reasoning makes sense in the commit message.
>
> The only thing that I think that is IMHO lacking is a simple
> kselftest. I think a trivial test for SGX_IOC_VEP_REMOVE_ALL
> would do.

Yeah, a trivial test wouldn't cover a lot; it would be much better to at
least set up a SECS, and check that the first call returns 1 and the
second returns 0. There is no existing test for /dev/sgx_vepc at all.

Right now I'm relying on Yang for testing this in QEMU, but I'll look
into adding a selftest that does the full setup and runs an enclave in a
guest.

Paolo