All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>,
	James Bottomley <jejb@linux.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	keyrings@vger.kernel.org
Subject: Re: [PATCH 2/6] security/keys/encrypted: Clean up request_trusted_key()
Date: Wed, 20 Mar 2019 08:06:19 -0400	[thread overview]
Message-ID: <1553083579.4899.239.camel@linux.ibm.com> (raw)
In-Reply-To: <CAPcyv4gySHayfwtp1PgxEoM-T_s_1A4RTcnXefx5iRLn9g=D5w@mail.gmail.com>

On Tue, 2019-03-19 at 22:48 -0700, Dan Williams wrote:
> On Tue, Mar 19, 2019 at 7:36 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> >
> > On Tue, 2019-03-19 at 17:20 -0700, Dan Williams wrote:
> > > On Tue, Mar 19, 2019 at 5:07 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> > > >
> > > > On Mon, 2019-03-18 at 23:06 -0700, Dan Williams wrote:
> > > >
> > > > < snip >
> > > >
> > > > > +/*
> > > > > + * request_trusted_key - request the trusted key
> > > > > + *
> > > > > + * Trusted keys are sealed to PCRs and other metadata. Although userspace
> > > > > + * manages both trusted/encrypted key-types, like the encrypted key type
> > > > > + * data, trusted key type data is not visible decrypted from userspace.
> > > > > + */
> > > > > +static struct key *request_trusted_key(const char *trusted_desc,
> > > > > +                             const u8 **master_key, size_t *master_keylen)
> > > > > +{
> > > > > +     struct trusted_key_payload *tpayload;
> > > > > +     struct key_type *type;
> > > > > +     struct key *tkey;
> > > > > +
> > > > > +     type = key_type_lookup("trusted");
> > > >
> > > > The associated key_type_put() will need to be called.
> > >
> > > Yes.
> >
> > I don't know if defining a key_type_lookup() wrapper, perhaps named
> > is_key_type_available(), would help.  Both key_type_lookup() and
> > key_type_put() would be called.  The existing code could then remain
> > the same.
> >
> 
> Maybe, but something still needs to pin the hosting module. I think
> this means that the first call to key_type->instantiate() pins the
> hosting module, and the ->destroy() of the last key for the key_type
> unpins the module. It does mean that the ->destroy() method is no
> longer optional.

This sounds like it isn't a new problem.  Both issues need to be
addressed, but I think we should differentiate between them and
address them separately.

In terms of the original nvdimm encrypted/trusted key problem, the
above suggestion requires the least amount of change.  For v5.2, I
would replace it with the full updated patch set.

Mimi

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Mimi Zohar <zohar@linux.ibm.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>,
	James Bottomley <jejb@linux.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	keyrings@vger.kernel.org
Subject: Re: [PATCH 2/6] security/keys/encrypted: Clean up request_trusted_key()
Date: Wed, 20 Mar 2019 12:06:19 +0000	[thread overview]
Message-ID: <1553083579.4899.239.camel@linux.ibm.com> (raw)
In-Reply-To: <CAPcyv4gySHayfwtp1PgxEoM-T_s_1A4RTcnXefx5iRLn9g=D5w@mail.gmail.com>

On Tue, 2019-03-19 at 22:48 -0700, Dan Williams wrote:
> On Tue, Mar 19, 2019 at 7:36 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> >
> > On Tue, 2019-03-19 at 17:20 -0700, Dan Williams wrote:
> > > On Tue, Mar 19, 2019 at 5:07 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> > > >
> > > > On Mon, 2019-03-18 at 23:06 -0700, Dan Williams wrote:
> > > >
> > > > < snip >
> > > >
> > > > > +/*
> > > > > + * request_trusted_key - request the trusted key
> > > > > + *
> > > > > + * Trusted keys are sealed to PCRs and other metadata. Although userspace
> > > > > + * manages both trusted/encrypted key-types, like the encrypted key type
> > > > > + * data, trusted key type data is not visible decrypted from userspace.
> > > > > + */
> > > > > +static struct key *request_trusted_key(const char *trusted_desc,
> > > > > +                             const u8 **master_key, size_t *master_keylen)
> > > > > +{
> > > > > +     struct trusted_key_payload *tpayload;
> > > > > +     struct key_type *type;
> > > > > +     struct key *tkey;
> > > > > +
> > > > > +     type = key_type_lookup("trusted");
> > > >
> > > > The associated key_type_put() will need to be called.
> > >
> > > Yes.
> >
> > I don't know if defining a key_type_lookup() wrapper, perhaps named
> > is_key_type_available(), would help.  Both key_type_lookup() and
> > key_type_put() would be called.  The existing code could then remain
> > the same.
> >
> 
> Maybe, but something still needs to pin the hosting module. I think
> this means that the first call to key_type->instantiate() pins the
> hosting module, and the ->destroy() of the last key for the key_type
> unpins the module. It does mean that the ->destroy() method is no
> longer optional.

This sounds like it isn't a new problem.  Both issues need to be
addressed, but I think we should differentiate between them and
address them separately.

In terms of the original nvdimm encrypted/trusted key problem, the
above suggestion requires the least amount of change.  For v5.2, I
would replace it with the full updated patch set.

Mimi

WARNING: multiple messages have this Message-ID (diff)
From: Mimi Zohar <zohar@linux.ibm.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: keyrings@vger.kernel.org, James Bottomley <jejb@linux.ibm.com>,
	David Howells <dhowells@redhat.com>,
	Vishal L Verma <vishal.l.verma@intel.com>,
	linux-nvdimm <linux-nvdimm@lists.01.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] security/keys/encrypted: Clean up request_trusted_key()
Date: Wed, 20 Mar 2019 08:06:19 -0400	[thread overview]
Message-ID: <1553083579.4899.239.camel@linux.ibm.com> (raw)
In-Reply-To: <CAPcyv4gySHayfwtp1PgxEoM-T_s_1A4RTcnXefx5iRLn9g=D5w@mail.gmail.com>

On Tue, 2019-03-19 at 22:48 -0700, Dan Williams wrote:
> On Tue, Mar 19, 2019 at 7:36 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> >
> > On Tue, 2019-03-19 at 17:20 -0700, Dan Williams wrote:
> > > On Tue, Mar 19, 2019 at 5:07 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
> > > >
> > > > On Mon, 2019-03-18 at 23:06 -0700, Dan Williams wrote:
> > > >
> > > > < snip >
> > > >
> > > > > +/*
> > > > > + * request_trusted_key - request the trusted key
> > > > > + *
> > > > > + * Trusted keys are sealed to PCRs and other metadata. Although userspace
> > > > > + * manages both trusted/encrypted key-types, like the encrypted key type
> > > > > + * data, trusted key type data is not visible decrypted from userspace.
> > > > > + */
> > > > > +static struct key *request_trusted_key(const char *trusted_desc,
> > > > > +                             const u8 **master_key, size_t *master_keylen)
> > > > > +{
> > > > > +     struct trusted_key_payload *tpayload;
> > > > > +     struct key_type *type;
> > > > > +     struct key *tkey;
> > > > > +
> > > > > +     type = key_type_lookup("trusted");
> > > >
> > > > The associated key_type_put() will need to be called.
> > >
> > > Yes.
> >
> > I don't know if defining a key_type_lookup() wrapper, perhaps named
> > is_key_type_available(), would help.  Both key_type_lookup() and
> > key_type_put() would be called.  The existing code could then remain
> > the same.
> >
> 
> Maybe, but something still needs to pin the hosting module. I think
> this means that the first call to key_type->instantiate() pins the
> hosting module, and the ->destroy() of the last key for the key_type
> unpins the module. It does mean that the ->destroy() method is no
> longer optional.

This sounds like it isn't a new problem.  Both issues need to be
addressed, but I think we should differentiate between them and
address them separately.

In terms of the original nvdimm encrypted/trusted key problem, the
above suggestion requires the least amount of change.  For v5.2, I
would replace it with the full updated patch set.

Mimi


  reply	other threads:[~2019-03-20 12:06 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  6:06 [PATCH 0/6] security/keys/encrypted: Break module dependency chain Dan Williams
2019-03-19  6:06 ` Dan Williams
2019-03-19  6:06 ` Dan Williams
2019-03-19  6:06 ` [PATCH 1/6] security/keys/encrypted: Allow operation without trusted.ko Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06 ` [PATCH 2/6] security/keys/encrypted: Clean up request_trusted_key() Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-20  0:06   ` Mimi Zohar
2019-03-20  0:06     ` Mimi Zohar
2019-03-20  0:06     ` Mimi Zohar
2019-03-20  0:20     ` Dan Williams
2019-03-20  0:20       ` Dan Williams
2019-03-20  0:20       ` Dan Williams
2019-03-20  1:10       ` Mimi Zohar
2019-03-20  1:10         ` Mimi Zohar
2019-03-20  1:10         ` Mimi Zohar
2019-03-20  1:34         ` Dan Williams
2019-03-20  1:34           ` Dan Williams
2019-03-20  1:34           ` Dan Williams
2019-03-20  1:37           ` Dan Williams
2019-03-20  1:37             ` Dan Williams
2019-03-20  1:37             ` Dan Williams
2019-03-20  2:35       ` Mimi Zohar
2019-03-20  2:35         ` Mimi Zohar
2019-03-20  2:35         ` Mimi Zohar
2019-03-20  5:48         ` Dan Williams
2019-03-20  5:48           ` Dan Williams
2019-03-20  5:48           ` Dan Williams
2019-03-20 12:06           ` Mimi Zohar [this message]
2019-03-20 12:06             ` Mimi Zohar
2019-03-20 12:06             ` Mimi Zohar
2019-03-20 15:27             ` Dan Williams
2019-03-20 15:27               ` Dan Williams
2019-03-20 15:27               ` Dan Williams
2019-03-19  6:06 ` [PATCH 3/6] libnvdimm/security: Drop direct dependency on key_type_encrypted Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19 16:46   ` Dave Jiang
2019-03-19 16:46     ` Dave Jiang
2019-03-19 16:46     ` Dave Jiang
2019-03-19  6:06 ` [PATCH 4/6] security/keys/ecryptfs: " Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06 ` [PATCH 5/6] security/integrity/evm: " Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06 ` [PATCH 6/6] security/keys/encrypted: Drop export of key_type_encrypted Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19  6:06   ` Dan Williams
2019-03-19 21:01 ` [PATCH 0/6] security/keys/encrypted: Break module dependency chain Dan Williams
2019-03-19 21:01   ` Dan Williams
2019-03-19 21:08   ` James Bottomley
2019-03-19 21:08     ` James Bottomley
2019-03-19 21:08     ` James Bottomley
2019-03-19 21:23     ` Dan Williams
2019-03-19 21:23       ` Dan Williams
2019-03-19 21:23       ` Dan Williams
2019-03-20  1:20     ` Mimi Zohar
2019-03-20  1:20       ` Mimi Zohar
2019-03-20  1:20       ` Mimi Zohar
2019-03-20  1:20       ` Mimi Zohar
2019-03-21 13:45   ` Jarkko Sakkinen
2019-03-21 13:45     ` Jarkko Sakkinen
2019-03-21 13:45     ` Jarkko Sakkinen
2019-03-21 13:48     ` Jarkko Sakkinen
2019-03-21 13:48       ` Jarkko Sakkinen
2019-03-21 13:48       ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1553083579.4899.239.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=dhowells@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.