lkml.org 
[lkml]   [2020]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v30 10/20] x86/sgx: Linux Enclave Driver
On Thu, May 21, 2020 at 12:12:36PM -0700, Sean Christopherson wrote:
> On Fri, May 15, 2020 at 03:44:00AM +0300, Jarkko Sakkinen wrote:
> > +long sgx_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
> > +{
> > + struct sgx_encl *encl = filep->private_data;
> > + int ret, encl_flags;
> > +
> > + encl_flags = atomic_fetch_or(SGX_ENCL_IOCTL, &encl->flags);
> > + if (encl_flags & SGX_ENCL_IOCTL)
> > + return -EBUSY;
> > +
> > + if (encl_flags & SGX_ENCL_DEAD)
> > + return -EFAULT;
>
> Returning immediately is wrong as it leaves SGX_ENCL_IOCTL set. This results
> in the application seeing -EBUSY on future ioctls() instead of -EFAULT. Can be
> fixed as below. Do you want me to send a formal patch on linux-sgx?

I just rewrote the same thing.

/Jarkko

\
 
 \ /
  Last update: 2020-05-22 21:26    [W:0.051 / U:46.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site