[PATCH v23 12/24] x86/sgx: Linux Enclave Driver

Jarkko Sakkinen jarkko.sakkinen at linux.intel.com
Fri Dec 6 20:38:07 UTC 2019


On Thu, Nov 28, 2019 at 07:24:50PM +0100, Greg KH wrote:
> On Mon, Oct 28, 2019 at 11:03:12PM +0200, Jarkko Sakkinen wrote:
> > +static struct device sgx_encl_dev;
> 
> Ugh, really?  After 23 versions of this patchset no one saw this?

Nobody has really given feedback on the device model. This is the
first review on that and thanks for taking your time. Previously
feeback has been mainly on the ioctl API and file management.

> > +static dev_t sgx_devt;
> > +
> > +static void sgx_dev_release(struct device *dev)
> > +{
> > +}
> 
> The old kernel documentation used to say I was allowed to make fun of
> people who did this, but that was removed as it really wasn't that nice.
> 
> But I'm seriously reconsidering that at the moment.
> 
> No, this is NOT OK!
> 
> Think about what you are doing here, and why you feel that it is ok to
> work around a kernel message that was added there explicitly to help you
> do things the right way.  I didn't add it just because I felt like it, I
> was trying to give you a chance to not get the use of this api
> incorrect.
> 
> That failed :(
> 
> Ugh, not ok.  Seriously, not ok...

It used to delete a context structure called sgx_dev_ctx. This structure
was removed in v20. I've failed to notice this when the code was refactored
for v20.

> Why a whole cdev?
> 
> Why not use a misc device?  YOu only have 2 devices right?  Why not 2
> misc devices then?  That saves the use of a whole major number and makes
> your code a _LOT_ simpler.

The downside would be that if we ever want to add sysfs attributes, that
could not be done synchronously with the device creation.

/Jarkko



More information about the Linux-security-module-archive mailing list