* [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5
@ 2016-02-13 13:47 Jarkko Sakkinen
2016-02-13 13:47 ` [PATCH v2 1/4] tpm: fix: keep auth session intact after unseal operation Jarkko Sakkinen
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2016-02-13 13:47 UTC (permalink / raw)
To: Peter Huewe, Marcel Selhorst, David Howells
Cc: jmorris, Jarkko Sakkinen, Jason Gunthorpe, open list,
moderated list:TPM DEVICE DRIVER
These are critical to get to Linux 4.5 in order to get the chip refcount
management stabilized and API/ABI for policy based sealing correct.
Harald Hoyer (1):
tpm_eventlog.c: fix binary_bios_measurements
Jarkko Sakkinen (2):
tpm: fix: keep auth session intact after unseal operation
tpm: fix: rollback when devm_add_action() fails
Jason Gunthorpe (1):
tpm: Hold the kref during tpm_chip_find_get
drivers/char/tpm/tpm-chip.c | 9 ++++++++-
drivers/char/tpm/tpm.h | 1 +
drivers/char/tpm/tpm2-cmd.c | 10 +++++++---
drivers/char/tpm/tpm_eventlog.c | 10 ++++++++--
4 files changed, 24 insertions(+), 6 deletions(-)
--
2.7.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/4] tpm: fix: keep auth session intact after unseal operation
2016-02-13 13:47 [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5 Jarkko Sakkinen
@ 2016-02-13 13:47 ` Jarkko Sakkinen
2016-02-13 13:47 ` [PATCH v2 2/4] tpm: fix: rollback when devm_add_action() fails Jarkko Sakkinen
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2016-02-13 13:47 UTC (permalink / raw)
To: Peter Huewe, Marcel Selhorst, David Howells
Cc: jmorris, Jarkko Sakkinen, Jason Gunthorpe,
moderated list:TPM DEVICE DRIVER, open list
The behavior of policy based unseal operation is not consistent:
* When there is an error in TPM2_Unseal operation, the session object
stays in the TPM transient memory.
* When the unseal is succesful, the TPM automatically removes the
session object.
This patch sets the continueSession attribute to keep the session intact
after a successful unseal operation thus making the behavior consistent.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Fixes: 5beb0c435b ("keys, trusted: seal with a TPM2 authorization policy")
---
drivers/char/tpm/tpm2-cmd.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 66e04b4..b28e4da 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -20,7 +20,11 @@
#include <keys/trusted-type.h>
enum tpm2_object_attributes {
- TPM2_ATTR_USER_WITH_AUTH = BIT(6),
+ TPM2_OA_USER_WITH_AUTH = BIT(6),
+};
+
+enum tpm2_session_attributes {
+ TPM2_SA_CONTINUE_SESSION = BIT(0),
};
struct tpm2_startup_in {
@@ -489,7 +493,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
tpm_buf_append(&buf, options->policydigest,
options->policydigest_len);
} else {
- tpm_buf_append_u32(&buf, TPM2_ATTR_USER_WITH_AUTH);
+ tpm_buf_append_u32(&buf, TPM2_OA_USER_WITH_AUTH);
tpm_buf_append_u16(&buf, 0);
}
@@ -627,7 +631,7 @@ static int tpm2_unseal(struct tpm_chip *chip,
options->policyhandle ?
options->policyhandle : TPM2_RS_PW,
NULL /* nonce */, 0,
- 0 /* session_attributes */,
+ TPM2_SA_CONTINUE_SESSION,
options->blobauth /* hmac */,
TPM_DIGEST_SIZE);
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/4] tpm: fix: rollback when devm_add_action() fails
2016-02-13 13:47 [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5 Jarkko Sakkinen
2016-02-13 13:47 ` [PATCH v2 1/4] tpm: fix: keep auth session intact after unseal operation Jarkko Sakkinen
@ 2016-02-13 13:47 ` Jarkko Sakkinen
[not found] ` <1455371228-20431-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-02-13 13:47 ` [PATCH v2 4/4] tpm_eventlog.c: fix binary_bios_measurements Jarkko Sakkinen
3 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2016-02-13 13:47 UTC (permalink / raw)
To: Peter Huewe, Marcel Selhorst, David Howells
Cc: jmorris, Jarkko Sakkinen, Jason Gunthorpe,
moderated list:TPM DEVICE DRIVER, open list
Call put_device() and return error code if devm_add_action() fails.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reported-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Fixes: 8e0ee3c9faed ("tpm: fix the cleanup of struct tpm_chip")
---
drivers/char/tpm/tpm-chip.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 2521425..274dd01 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -88,6 +88,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
const struct tpm_class_ops *ops)
{
struct tpm_chip *chip;
+ int rc;
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (chip == NULL)
@@ -136,7 +137,11 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
chip->cdev.owner = chip->pdev->driver->owner;
chip->cdev.kobj.parent = &chip->dev.kobj;
- devm_add_action(dev, (void (*)(void *)) put_device, &chip->dev);
+ rc = devm_add_action(dev, (void (*)(void *)) put_device, &chip->dev);
+ if (rc) {
+ put_device(&chip->dev);
+ return ERR_PTR(rc);
+ }
return chip;
}
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/4] tpm: Hold the kref during tpm_chip_find_get
[not found] ` <1455371228-20431-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-02-13 13:47 ` Jarkko Sakkinen
2016-02-13 21:55 ` [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5 Jason Gunthorpe
1 sibling, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2016-02-13 13:47 UTC (permalink / raw)
To: Peter Huewe, Marcel Selhorst, David Howells
Cc: jmorris-gx6/JNMH7DfYtjvyW6yDsg, open list,
moderated list:TPM DEVICE DRIVER, stable-u79uwXL29TY76Z2rM5mHXA
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
This was missed during the struct device conversion, we
need to hold a kref on the chip to make sure it isn't freed.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1560MoZ6SYplyIw@public.gmane.org>
Fixes: afb5abc262e9 ("tpm: two-phase chip management functions")
cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/char/tpm/tpm-chip.c | 2 ++
drivers/char/tpm/tpm.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 274dd01..84a54a2 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -53,6 +53,8 @@ struct tpm_chip *tpm_chip_find_get(int chip_num)
chip = pos;
break;
}
+
+ get_device(&chip->dev);
}
rcu_read_unlock();
return chip;
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 28b477e..f6bc0b3 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -200,6 +200,7 @@ struct tpm_chip {
static inline void tpm_chip_put(struct tpm_chip *chip)
{
module_put(chip->pdev->driver->owner);
+ put_device(&chip->dev);
}
static inline int tpm_read_index(int base, int index)
--
2.7.0
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/4] tpm_eventlog.c: fix binary_bios_measurements
2016-02-13 13:47 [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5 Jarkko Sakkinen
` (2 preceding siblings ...)
[not found] ` <1455371228-20431-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-02-13 13:47 ` Jarkko Sakkinen
3 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2016-02-13 13:47 UTC (permalink / raw)
To: Peter Huewe, Marcel Selhorst, David Howells
Cc: jmorris, Harald Hoyer, stable, Jarkko Sakkinen, Jason Gunthorpe,
moderated list:TPM DEVICE DRIVER, open list
From: Harald Hoyer <harald@redhat.com>
The commit 0cc698af36ff ("vTPM: support little endian guests") copied
the event, but without the event data, did an endian conversion on the
size and tried to output the event data from the copied version, which
has only have one byte of the data, resulting in garbage event data.
[jarkko.sakkinen@linux.intel.com: minor coding style fixes]
Signed-off-by: Harald Hoyer <harald@redhat.com>
Fixes: 0cc698af36ff ("vTPM: support little endian guests")
cc: stable@vger.kernel.org
---
drivers/char/tpm/tpm_eventlog.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm_eventlog.c b/drivers/char/tpm/tpm_eventlog.c
index bd72fb0..6011751 100644
--- a/drivers/char/tpm/tpm_eventlog.c
+++ b/drivers/char/tpm/tpm_eventlog.c
@@ -242,9 +242,15 @@ static int tpm_binary_bios_measurements_show(struct seq_file *m, void *v)
temp_event.event_type = do_endian_conversion(event->event_type);
temp_event.event_size = do_endian_conversion(event->event_size);
- tempPtr = (char *)&temp_event;
+ tempPtr = (char *) &temp_event;
- for (i = 0; i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
+ for (i = 0; i < sizeof(struct tcpa_event)-1 ; i++)
+ seq_putc(m, tempPtr[i]);
+
+ tempPtr = (char *) v;
+
+ for (i = sizeof(struct tcpa_event) - 1;
+ i < sizeof(struct tcpa_event) + temp_event.event_size; i++)
seq_putc(m, tempPtr[i]);
return 0;
--
2.7.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5
[not found] ` <1455371228-20431-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-02-13 13:47 ` [PATCH v2 3/4] tpm: Hold the kref during tpm_chip_find_get Jarkko Sakkinen
@ 2016-02-13 21:55 ` Jason Gunthorpe
[not found] ` <3032da9f-01c0-4c09-9acc-cc4fa3e41fa8-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
1 sibling, 1 reply; 8+ messages in thread
From: Jason Gunthorpe @ 2016-02-13 21:55 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jmorris-gx6/JNMH7DfYtjvyW6yDsg, David Howells,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Hi Peter,
Please don't grab my patch in this pull, it is broken.
Thanks
Jason
On Feb 13, 2016 6:47 AM, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
>
> These are critical to get to Linux 4.5 in order to get the chip refcount
> management stabilized and API/ABI for policy based sealing correct.
>
> Harald Hoyer (1):
> tpm_eventlog.c: fix binary_bios_measurements
>
> Jarkko Sakkinen (2):
> tpm: fix: keep auth session intact after unseal operation
> tpm: fix: rollback when devm_add_action() fails
>
> Jason Gunthorpe (1):
> tpm: Hold the kref during tpm_chip_find_get
>
> drivers/char/tpm/tpm-chip.c | 9 ++++++++-
> drivers/char/tpm/tpm.h | 1 +
> drivers/char/tpm/tpm2-cmd.c | 10 +++++++---
> drivers/char/tpm/tpm_eventlog.c | 10 ++++++++--
> 4 files changed, 24 insertions(+), 6 deletions(-)
>
> --
> 2.7.0
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
tpmdd-devel mailing list
tpmdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5
[not found] ` <3032da9f-01c0-4c09-9acc-cc4fa3e41fa8-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
@ 2016-02-14 3:27 ` Jarkko Sakkinen
2016-02-14 3:30 ` Jarkko Sakkinen
0 siblings, 1 reply; 8+ messages in thread
From: Jarkko Sakkinen @ 2016-02-14 3:27 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jmorris-gx6/JNMH7DfYtjvyW6yDsg, David Howells,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Sat, Feb 13, 2016 at 02:55:56PM -0700, Jason Gunthorpe wrote:
> Hi Peter,
>
> Please don't grab my patch in this pull, it is broken.
Please send an updated fix. I'll check it through and include it to the
final pull request.
> Thanks
> Jason
/Jarkko
>
> On Feb 13, 2016 6:47 AM, Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
> >
> > These are critical to get to Linux 4.5 in order to get the chip refcount
> > management stabilized and API/ABI for policy based sealing correct.
> >
> > Harald Hoyer (1):
> > tpm_eventlog.c: fix binary_bios_measurements
> >
> > Jarkko Sakkinen (2):
> > tpm: fix: keep auth session intact after unseal operation
> > tpm: fix: rollback when devm_add_action() fails
> >
> > Jason Gunthorpe (1):
> > tpm: Hold the kref during tpm_chip_find_get
> >
> > drivers/char/tpm/tpm-chip.c | 9 ++++++++-
> > drivers/char/tpm/tpm.h | 1 +
> > drivers/char/tpm/tpm2-cmd.c | 10 +++++++---
> > drivers/char/tpm/tpm_eventlog.c | 10 ++++++++--
> > 4 files changed, 24 insertions(+), 6 deletions(-)
> >
> > --
> > 2.7.0
> >
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5
2016-02-14 3:27 ` Jarkko Sakkinen
@ 2016-02-14 3:30 ` Jarkko Sakkinen
0 siblings, 0 replies; 8+ messages in thread
From: Jarkko Sakkinen @ 2016-02-14 3:30 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: David Howells, Peter Huewe, tpmdd-devel, Marcel Selhorst,
linux-kernel, jmorris
On Sun, Feb 14, 2016 at 05:27:12AM +0200, Jarkko Sakkinen wrote:
> On Sat, Feb 13, 2016 at 02:55:56PM -0700, Jason Gunthorpe wrote:
> > Hi Peter,
> >
> > Please don't grab my patch in this pull, it is broken.
>
> Please send an updated fix. I'll check it through and include it to the
> final pull request.
I'm still waiting for James to pick my previous pull request so take
your time and prepare an updated patch!
/Jarkko
> > Thanks
> > Jason
>
> /Jarkko
>
> >
> > On Feb 13, 2016 6:47 AM, Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> wrote:
> > >
> > > These are critical to get to Linux 4.5 in order to get the chip refcount
> > > management stabilized and API/ABI for policy based sealing correct.
> > >
> > > Harald Hoyer (1):
> > > tpm_eventlog.c: fix binary_bios_measurements
> > >
> > > Jarkko Sakkinen (2):
> > > tpm: fix: keep auth session intact after unseal operation
> > > tpm: fix: rollback when devm_add_action() fails
> > >
> > > Jason Gunthorpe (1):
> > > tpm: Hold the kref during tpm_chip_find_get
> > >
> > > drivers/char/tpm/tpm-chip.c | 9 ++++++++-
> > > drivers/char/tpm/tpm.h | 1 +
> > > drivers/char/tpm/tpm2-cmd.c | 10 +++++++---
> > > drivers/char/tpm/tpm_eventlog.c | 10 ++++++++--
> > > 4 files changed, 24 insertions(+), 6 deletions(-)
> > >
> > > --
> > > 2.7.0
> > >
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-02-14 3:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-13 13:47 [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5 Jarkko Sakkinen
2016-02-13 13:47 ` [PATCH v2 1/4] tpm: fix: keep auth session intact after unseal operation Jarkko Sakkinen
2016-02-13 13:47 ` [PATCH v2 2/4] tpm: fix: rollback when devm_add_action() fails Jarkko Sakkinen
[not found] ` <1455371228-20431-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-02-13 13:47 ` [PATCH v2 3/4] tpm: Hold the kref during tpm_chip_find_get Jarkko Sakkinen
2016-02-13 21:55 ` [PATCH v2 0/4] tpm: last minute critical fixes for Linux 4.5 Jason Gunthorpe
[not found] ` <3032da9f-01c0-4c09-9acc-cc4fa3e41fa8-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2016-02-14 3:27 ` Jarkko Sakkinen
2016-02-14 3:30 ` Jarkko Sakkinen
2016-02-13 13:47 ` [PATCH v2 4/4] tpm_eventlog.c: fix binary_bios_measurements Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).