From: James Bottomley <James.Bottomley@HansenPartnership.com> To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>, tpmdd-devel@lists.sourceforge.net Cc: open list <linux-kernel@vger.kernel.org>, linux-security-module@vger.kernel.org Subject: Re: [tpmdd-devel] [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms<n> Date: Thu, 12 Jan 2017 11:46:09 -0800 [thread overview] Message-ID: <1484250369.5807.11.camel@HansenPartnership.com> (raw) In-Reply-To: <20170112174612.9314-6-jarkko.sakkinen@linux.intel.com> On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > From: James Bottomley <James.Bottomley@HansenPartnership.com> > > Currently the Resource Manager (RM) is not exposed to userspace. > Make > this exposure via a separate device, which can now be opened multiple > times because each read/write transaction goes separately via the RM. > > Concurrency is protected by the chip->tpm_mutex for each read/write > transaction separately. The TPM is cleared of all transient objects > by the time the mutex is dropped, so there should be no interference > between the kernel and userspace. There's a bug in this code that will crash on first command. This is the incremental fix. It must have got lost when I did the split. James --- diff --git a/drivers/char/tpm/tpms-dev.c b/drivers/char/tpm/tpms-dev.c index f4cb7a3..3eb5955 100644 --- a/drivers/char/tpm/tpms-dev.c +++ b/drivers/char/tpm/tpms-dev.c @@ -20,6 +20,11 @@ static int tpms_open(struct inode *inode, struct file *file) priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv == NULL) return -ENOMEM; + priv->space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); + if (priv->space.context_buf == NULL) { + kfree(priv); + return -ENOMEM; + } tpm_common_open(file, chip, &priv->priv);
WARNING: multiple messages have this Message-ID (diff)
From: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> To: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> Subject: Re: [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms<n> Date: Thu, 12 Jan 2017 11:46:09 -0800 [thread overview] Message-ID: <1484250369.5807.11.camel@HansenPartnership.com> (raw) In-Reply-To: <20170112174612.9314-6-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> On Thu, 2017-01-12 at 19:46 +0200, Jarkko Sakkinen wrote: > From: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org> > > Currently the Resource Manager (RM) is not exposed to userspace. > Make > this exposure via a separate device, which can now be opened multiple > times because each read/write transaction goes separately via the RM. > > Concurrency is protected by the chip->tpm_mutex for each read/write > transaction separately. The TPM is cleared of all transient objects > by the time the mutex is dropped, so there should be no interference > between the kernel and userspace. There's a bug in this code that will crash on first command. This is the incremental fix. It must have got lost when I did the split. James --- diff --git a/drivers/char/tpm/tpms-dev.c b/drivers/char/tpm/tpms-dev.c index f4cb7a3..3eb5955 100644 --- a/drivers/char/tpm/tpms-dev.c +++ b/drivers/char/tpm/tpms-dev.c @@ -20,6 +20,11 @@ static int tpms_open(struct inode *inode, struct file *file) priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv == NULL) return -ENOMEM; + priv->space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); + if (priv->space.context_buf == NULL) { + kfree(priv); + return -ENOMEM; + } tpm_common_open(file, chip, &priv->priv); ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi
next prev parent reply other threads:[~2017-01-12 19:56 UTC|newest] Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-01-12 17:46 [PATCH RFC v2 0/5] RFC: in-kernel resource manager Jarkko Sakkinen 2017-01-12 17:46 ` Jarkko Sakkinen 2017-01-12 17:46 ` [PATCH RFC v2 1/5] tpm: validate TPM 2.0 commands Jarkko Sakkinen 2017-01-12 17:46 ` Jarkko Sakkinen 2017-01-12 20:34 ` Jarkko Sakkinen 2017-01-12 17:46 ` [PATCH RFC v2 2/5] tpm: export tpm2_flush_context_cmd Jarkko Sakkinen 2017-01-12 17:46 ` Jarkko Sakkinen 2017-01-12 17:46 ` [PATCH RFC v2 3/5] tpm: infrastructure for TPM spaces Jarkko Sakkinen 2017-01-12 17:46 ` Jarkko Sakkinen 2017-01-12 18:38 ` [tpmdd-devel] " James Bottomley 2017-01-12 18:38 ` James Bottomley 2017-01-12 20:31 ` [tpmdd-devel] " Jarkko Sakkinen 2017-01-12 20:31 ` Jarkko Sakkinen 2017-01-12 20:38 ` [tpmdd-devel] " James Bottomley 2017-01-13 16:28 ` Jarkko Sakkinen 2017-01-14 17:53 ` Ken Goldman 2017-01-16 9:52 ` Jarkko Sakkinen 2017-01-16 9:52 ` Jarkko Sakkinen 2017-01-12 20:50 ` Jarkko Sakkinen 2017-01-12 20:50 ` Jarkko Sakkinen 2017-01-13 1:17 ` [tpmdd-devel] " James Bottomley 2017-01-13 16:31 ` Jarkko Sakkinen 2017-01-16 9:09 ` Jarkko Sakkinen 2017-01-16 14:24 ` James Bottomley 2017-01-16 14:48 ` Jarkko Sakkinen 2017-01-16 14:58 ` James Bottomley 2017-01-16 16:52 ` Jarkko Sakkinen 2017-01-12 17:46 ` [PATCH RFC v2 4/5] tpm: split out tpm-dev.c into tpm-dev.c and tpm-common-dev.c Jarkko Sakkinen 2017-01-12 17:46 ` Jarkko Sakkinen 2017-01-13 19:18 ` [tpmdd-devel] " James Bottomley 2017-01-12 17:46 ` [PATCH RFC v2 5/5] tpm2: expose resource manager via a device link /dev/tpms<n> Jarkko Sakkinen 2017-01-12 17:46 ` Jarkko Sakkinen 2017-01-12 18:39 ` Jason Gunthorpe 2017-01-12 18:39 ` Jason Gunthorpe 2017-01-13 19:20 ` [tpmdd-devel] " James Bottomley 2017-01-13 19:47 ` Jason Gunthorpe 2017-01-13 19:47 ` Jason Gunthorpe 2017-01-13 20:02 ` [tpmdd-devel] " James Bottomley 2017-01-13 20:02 ` James Bottomley 2017-01-13 21:23 ` [tpmdd-devel] " Jason Gunthorpe 2017-01-14 1:10 ` James Bottomley 2017-01-16 16:54 ` Jason Gunthorpe 2017-01-12 19:46 ` James Bottomley [this message] 2017-01-12 19:46 ` James Bottomley 2017-01-12 20:56 ` Jarkko Sakkinen 2017-01-13 17:25 ` Jason Gunthorpe 2017-01-13 17:40 ` [tpmdd-devel] " James Bottomley 2017-01-13 17:40 ` James Bottomley 2017-01-13 18:01 ` [tpmdd-devel] " Jason Gunthorpe 2017-01-13 18:11 ` James Bottomley 2017-01-16 9:45 ` 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=1484250369.5807.11.camel@HansenPartnership.com \ --to=james.bottomley@hansenpartnership.com \ --cc=jarkko.sakkinen@linux.intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-security-module@vger.kernel.org \ --cc=tpmdd-devel@lists.sourceforge.net \ /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: linkBe 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.