* [PATCH 0/2] tpm: better support for 32-bit tpm2 properties @ 2016-07-15 1:07 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 1:07 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel, groeck, smbarber, dianders, Andrey Pronin These patches help working with 32-bit TPM2.0-specific properties that can be read using TPM2_GetCapability(capability = TPM_CAP_TPM_PROPERTIES): - TPM_PT_PERMANENT - TPM_PT_STARTUP_CLEAR Andrey Pronin (2): tpm: define constants for tpm2 properties tpm: fix byte-order for the value read by tpm2_get_tpm_pt drivers/char/tpm/tpm.h | 26 ++++++++++++++++++++++++++ drivers/char/tpm/tpm2-cmd.c | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) -- 2.6.6 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 0/2] tpm: better support for 32-bit tpm2 properties @ 2016-07-15 1:07 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 1:07 UTC (permalink / raw) To: Jarkko Sakkinen Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw These patches help working with 32-bit TPM2.0-specific properties that can be read using TPM2_GetCapability(capability = TPM_CAP_TPM_PROPERTIES): - TPM_PT_PERMANENT - TPM_PT_STARTUP_CLEAR Andrey Pronin (2): tpm: define constants for tpm2 properties tpm: fix byte-order for the value read by tpm2_get_tpm_pt drivers/char/tpm/tpm.h | 26 ++++++++++++++++++++++++++ drivers/char/tpm/tpm2-cmd.c | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) -- 2.6.6 ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/2] tpm: define constants for tpm2 properties @ 2016-07-15 1:07 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 1:07 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel, groeck, smbarber, dianders, Andrey Pronin Change-Id: I47cb1793736781fbea93e5bf80b783e0ac9e8628 Signed-off-by: Andrey Pronin <apronin@chromium.org> --- drivers/char/tpm/tpm.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 8890df2..ad3b9d1 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -127,6 +127,32 @@ enum tpm2_capabilities { TPM2_CAP_TPM_PROPERTIES = 6, }; +enum tpm2_properties { + TPM2_PT_NONE = 0, + TPM2_PT_GROUP = 0x100, + TPM2_PT_FIXED = TPM2_PT_GROUP, + TPM2_PT_VAR = TPM2_PT_GROUP * 2, + TPM2_PT_PERMANENT = TPM2_PT_VAR + 0, + TPM2_PT_STARTUP_CLEAR = TPM2_PT_VAR + 1, +}; + +enum tpm2_attr_permanent { + TPM2_ATTR_OWNER_AUTH_SET = BIT(0), + TPM2_ATTR_ENDORSEMENT_AUTH_SET = BIT(1), + TPM2_ATTR_LOCKOUT_AUTH_SET = BIT(2), + TPM2_ATTR_DISABLE_CLEAR = BIT(8), + TPM2_ATTR_IN_LOCKOUT = BIT(9), + TPM2_ATTR_TPM_GENERATED_EPS = BIT(10), +}; + +enum tpm2_attr_startup_clear { + TPM2_ATTR_PH_ENABLE = BIT(0), + TPM2_ATTR_SH_ENABLE = BIT(1), + TPM2_ATTR_EH_ENABLE = BIT(2), + TPM2_ATTR_PH_ENABLE_NV = BIT(3), + TPM2_ATTR_ORDERLY = BIT(31), +}; + enum tpm2_startup_types { TPM2_SU_CLEAR = 0x0000, TPM2_SU_STATE = 0x0001, -- 2.6.6 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 1/2] tpm: define constants for tpm2 properties @ 2016-07-15 1:07 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 1:07 UTC (permalink / raw) To: Jarkko Sakkinen Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw Change-Id: I47cb1793736781fbea93e5bf80b783e0ac9e8628 Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> --- drivers/char/tpm/tpm.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 8890df2..ad3b9d1 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -127,6 +127,32 @@ enum tpm2_capabilities { TPM2_CAP_TPM_PROPERTIES = 6, }; +enum tpm2_properties { + TPM2_PT_NONE = 0, + TPM2_PT_GROUP = 0x100, + TPM2_PT_FIXED = TPM2_PT_GROUP, + TPM2_PT_VAR = TPM2_PT_GROUP * 2, + TPM2_PT_PERMANENT = TPM2_PT_VAR + 0, + TPM2_PT_STARTUP_CLEAR = TPM2_PT_VAR + 1, +}; + +enum tpm2_attr_permanent { + TPM2_ATTR_OWNER_AUTH_SET = BIT(0), + TPM2_ATTR_ENDORSEMENT_AUTH_SET = BIT(1), + TPM2_ATTR_LOCKOUT_AUTH_SET = BIT(2), + TPM2_ATTR_DISABLE_CLEAR = BIT(8), + TPM2_ATTR_IN_LOCKOUT = BIT(9), + TPM2_ATTR_TPM_GENERATED_EPS = BIT(10), +}; + +enum tpm2_attr_startup_clear { + TPM2_ATTR_PH_ENABLE = BIT(0), + TPM2_ATTR_SH_ENABLE = BIT(1), + TPM2_ATTR_EH_ENABLE = BIT(2), + TPM2_ATTR_PH_ENABLE_NV = BIT(3), + TPM2_ATTR_ORDERLY = BIT(31), +}; + enum tpm2_startup_types { TPM2_SU_CLEAR = 0x0000, TPM2_SU_STATE = 0x0001, -- 2.6.6 ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 1/2] tpm: define constants for tpm2 properties @ 2016-07-15 3:08 ` Jason Gunthorpe 0 siblings, 0 replies; 25+ messages in thread From: Jason Gunthorpe @ 2016-07-15 3:08 UTC (permalink / raw) To: Andrey Pronin Cc: Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Thu, Jul 14, 2016 at 06:07:17PM -0700, Andrey Pronin wrote: > Change-Id: I47cb1793736781fbea93e5bf80b783e0ac9e8628 These commit messages are no good, generally for all your patches. Drop the internal change-id and provide a suitable description. Do not add dead code to the kernel, so this patch should be in a series that actually uses the new constants. Jason ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/2] tpm: define constants for tpm2 properties @ 2016-07-15 3:08 ` Jason Gunthorpe 0 siblings, 0 replies; 25+ messages in thread From: Jason Gunthorpe @ 2016-07-15 3:08 UTC (permalink / raw) To: Andrey Pronin Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Thu, Jul 14, 2016 at 06:07:17PM -0700, Andrey Pronin wrote: > Change-Id: I47cb1793736781fbea93e5bf80b783e0ac9e8628 These commit messages are no good, generally for all your patches. Drop the internal change-id and provide a suitable description. Do not add dead code to the kernel, so this patch should be in a series that actually uses the new constants. Jason ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/2] tpm: define constants for tpm2 properties @ 2016-07-18 18:58 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 18:58 UTC (permalink / raw) To: Andrey Pronin Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Thu, Jul 14, 2016 at 06:07:17PM -0700, Andrey Pronin wrote: > Change-Id: I47cb1793736781fbea93e5bf80b783e0ac9e8628 > Signed-off-by: Andrey Pronin <apronin@chromium.org> I'm not going to apply this. The patch has no value. We only want to have a subset of constants that are *used* by the kernel. /Jarkko > --- > drivers/char/tpm/tpm.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index 8890df2..ad3b9d1 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -127,6 +127,32 @@ enum tpm2_capabilities { > TPM2_CAP_TPM_PROPERTIES = 6, > }; > > +enum tpm2_properties { > + TPM2_PT_NONE = 0, > + TPM2_PT_GROUP = 0x100, > + TPM2_PT_FIXED = TPM2_PT_GROUP, > + TPM2_PT_VAR = TPM2_PT_GROUP * 2, > + TPM2_PT_PERMANENT = TPM2_PT_VAR + 0, > + TPM2_PT_STARTUP_CLEAR = TPM2_PT_VAR + 1, > +}; > + > +enum tpm2_attr_permanent { > + TPM2_ATTR_OWNER_AUTH_SET = BIT(0), > + TPM2_ATTR_ENDORSEMENT_AUTH_SET = BIT(1), > + TPM2_ATTR_LOCKOUT_AUTH_SET = BIT(2), > + TPM2_ATTR_DISABLE_CLEAR = BIT(8), > + TPM2_ATTR_IN_LOCKOUT = BIT(9), > + TPM2_ATTR_TPM_GENERATED_EPS = BIT(10), > +}; > + > +enum tpm2_attr_startup_clear { > + TPM2_ATTR_PH_ENABLE = BIT(0), > + TPM2_ATTR_SH_ENABLE = BIT(1), > + TPM2_ATTR_EH_ENABLE = BIT(2), > + TPM2_ATTR_PH_ENABLE_NV = BIT(3), > + TPM2_ATTR_ORDERLY = BIT(31), > +}; > + > enum tpm2_startup_types { > TPM2_SU_CLEAR = 0x0000, > TPM2_SU_STATE = 0x0001, > -- > 2.6.6 > ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/2] tpm: define constants for tpm2 properties @ 2016-07-18 18:58 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 18:58 UTC (permalink / raw) To: Andrey Pronin Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Thu, Jul 14, 2016 at 06:07:17PM -0700, Andrey Pronin wrote: > Change-Id: I47cb1793736781fbea93e5bf80b783e0ac9e8628 > Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> I'm not going to apply this. The patch has no value. We only want to have a subset of constants that are *used* by the kernel. /Jarkko > --- > drivers/char/tpm/tpm.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index 8890df2..ad3b9d1 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -127,6 +127,32 @@ enum tpm2_capabilities { > TPM2_CAP_TPM_PROPERTIES = 6, > }; > > +enum tpm2_properties { > + TPM2_PT_NONE = 0, > + TPM2_PT_GROUP = 0x100, > + TPM2_PT_FIXED = TPM2_PT_GROUP, > + TPM2_PT_VAR = TPM2_PT_GROUP * 2, > + TPM2_PT_PERMANENT = TPM2_PT_VAR + 0, > + TPM2_PT_STARTUP_CLEAR = TPM2_PT_VAR + 1, > +}; > + > +enum tpm2_attr_permanent { > + TPM2_ATTR_OWNER_AUTH_SET = BIT(0), > + TPM2_ATTR_ENDORSEMENT_AUTH_SET = BIT(1), > + TPM2_ATTR_LOCKOUT_AUTH_SET = BIT(2), > + TPM2_ATTR_DISABLE_CLEAR = BIT(8), > + TPM2_ATTR_IN_LOCKOUT = BIT(9), > + TPM2_ATTR_TPM_GENERATED_EPS = BIT(10), > +}; > + > +enum tpm2_attr_startup_clear { > + TPM2_ATTR_PH_ENABLE = BIT(0), > + TPM2_ATTR_SH_ENABLE = BIT(1), > + TPM2_ATTR_EH_ENABLE = BIT(2), > + TPM2_ATTR_PH_ENABLE_NV = BIT(3), > + TPM2_ATTR_ORDERLY = BIT(31), > +}; > + > enum tpm2_startup_types { > TPM2_SU_CLEAR = 0x0000, > TPM2_SU_STATE = 0x0001, > -- > 2.6.6 > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-15 1:07 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 1:07 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel, groeck, smbarber, dianders, Andrey Pronin Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 Signed-off-by: Andrey Pronin <apronin@chromium.org> --- drivers/char/tpm/tpm2-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index a1673dc..a88b31e 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); if (!rc) - *value = cmd.params.get_tpm_pt_out.value; + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); return rc; } -- 2.6.6 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-15 1:07 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 1:07 UTC (permalink / raw) To: Jarkko Sakkinen Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> --- drivers/char/tpm/tpm2-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index a1673dc..a88b31e 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); if (!rc) - *value = cmd.params.get_tpm_pt_out.value; + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); return rc; } -- 2.6.6 ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt 2016-07-15 1:07 ` Andrey Pronin (?) @ 2016-07-15 3:10 ` Jason Gunthorpe 2016-07-15 3:17 ` Andrey Pronin -1 siblings, 1 reply; 25+ messages in thread From: Jason Gunthorpe @ 2016-07-15 3:10 UTC (permalink / raw) To: Andrey Pronin Cc: Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > Signed-off-by: Andrey Pronin <apronin@chromium.org> > drivers/char/tpm/tpm2-cmd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c > index a1673dc..a88b31e 100644 > +++ b/drivers/char/tpm/tpm2-cmd.c > @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, > > rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); > if (!rc) > - *value = cmd.params.get_tpm_pt_out.value; > + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); Huh. Jarkko: Are you running sparse on the tpm stuff? The annotations look right here, sparse should have complained on this? Andrey, did sparse complain here or is there something more serious wrong as well?? Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Jason ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-15 3:17 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 3:17 UTC (permalink / raw) To: Jason Gunthorpe Cc: Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Thu, Jul 14, 2016 at 09:10:46PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apronin@chromium.org> > > drivers/char/tpm/tpm2-cmd.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c > > index a1673dc..a88b31e 100644 > > +++ b/drivers/char/tpm/tpm2-cmd.c > > @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, > > > > rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); > > if (!rc) > > - *value = cmd.params.get_tpm_pt_out.value; > > + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); > > Huh. > > Jarkko: Are you running sparse on the tpm stuff? The annotations look > right here, sparse should have complained on this? Andrey, did sparse > complain here or is there something more serious wrong as well?? > > Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> > > Jason No, this is not sparse complaining. I tried using tpm2_get_tpm_pt() to read permanent flags and discovered that it was missing byte-ordering conversion. The only place tpm2_get_tpm_pt() was used before was in tpm2_gen_interrupt, which discarded the result. So, nobody noticed, I guess. Andrey ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-15 3:17 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 3:17 UTC (permalink / raw) To: Jason Gunthorpe Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Thu, Jul 14, 2016 at 09:10:46PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > > drivers/char/tpm/tpm2-cmd.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c > > index a1673dc..a88b31e 100644 > > +++ b/drivers/char/tpm/tpm2-cmd.c > > @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, > > > > rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); > > if (!rc) > > - *value = cmd.params.get_tpm_pt_out.value; > > + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); > > Huh. > > Jarkko: Are you running sparse on the tpm stuff? The annotations look > right here, sparse should have complained on this? Andrey, did sparse > complain here or is there something more serious wrong as well?? > > Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> > > Jason No, this is not sparse complaining. I tried using tpm2_get_tpm_pt() to read permanent flags and discovered that it was missing byte-ordering conversion. The only place tpm2_get_tpm_pt() was used before was in tpm2_gen_interrupt, which discarded the result. So, nobody noticed, I guess. Andrey ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt 2016-07-15 3:17 ` Andrey Pronin @ 2016-07-15 3:35 ` Jason Gunthorpe -1 siblings, 0 replies; 25+ messages in thread From: Jason Gunthorpe @ 2016-07-15 3:35 UTC (permalink / raw) To: Andrey Pronin Cc: Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Thu, Jul 14, 2016 at 08:17:01PM -0700, Andrey Pronin wrote: > conversion. The only place tpm2_get_tpm_pt() was used before was in > tpm2_gen_interrupt, which discarded the result. So, nobody noticed, > I guess. If you have a moment can you run sparse on this file before/after this change and make sure it did complain and that there are not other endian errors? Jason ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-15 3:35 ` Jason Gunthorpe 0 siblings, 0 replies; 25+ messages in thread From: Jason Gunthorpe @ 2016-07-15 3:35 UTC (permalink / raw) To: Andrey Pronin Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Thu, Jul 14, 2016 at 08:17:01PM -0700, Andrey Pronin wrote: > conversion. The only place tpm2_get_tpm_pt() was used before was in > tpm2_gen_interrupt, which discarded the result. So, nobody noticed, > I guess. If you have a moment can you run sparse on this file before/after this change and make sure it did complain and that there are not other endian errors? Jason ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt 2016-07-15 3:35 ` Jason Gunthorpe (?) @ 2016-07-15 19:31 ` Andrey Pronin 2016-07-15 19:39 ` Jason Gunthorpe -1 siblings, 1 reply; 25+ messages in thread From: Andrey Pronin @ 2016-07-15 19:31 UTC (permalink / raw) To: Jason Gunthorpe Cc: Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Thu, Jul 14, 2016 at 09:35:53PM -0600, Jason Gunthorpe wrote: > On Thu, Jul 14, 2016 at 08:17:01PM -0700, Andrey Pronin wrote: > > conversion. The only place tpm2_get_tpm_pt() was used before was in > > tpm2_gen_interrupt, which discarded the result. So, nobody noticed, > > I guess. > > If you have a moment can you run sparse on this file before/after this > change and make sure it did complain and that there are not other > endian errors? > I ran sparse. In my case it didn't complain before or after the change. It only complains about using cpu_to_be32() in tpm_capabilities and tpm_sub_capabilities enum in tpm.h and the use of those enums in tpm_getcap() in tpm-interface.c I even tried changing the code there to __be32 vv = cmd.params.get_tpm_pt_out.value; u32 ret = vv; to make it clear what's going on. Still, no complaints from sparse. be32_to_cpu() should cleary be done in this case, though. As value is defined as __be32 in struct tpm2_get_tpm_pt_out, and we return u32 in that parameter from tpm2_get_tpm_pt(). Plus, it's consistent with the spec. It's just nobody has used this value yet in the existing code, thus it went unnoticed. To address "no dead code" comment, I'll drop defining various tpm2 properties and bits from this patchset and move it to the sysfs for tpm2 patchset where they'll be needed for tpm2-specific attributes. But this fix is valid on its own in my opinion. ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt 2016-07-15 19:31 ` Andrey Pronin @ 2016-07-15 19:39 ` Jason Gunthorpe 2016-07-18 19:05 ` Jarkko Sakkinen 0 siblings, 1 reply; 25+ messages in thread From: Jason Gunthorpe @ 2016-07-15 19:39 UTC (permalink / raw) To: Andrey Pronin Cc: Jarkko Sakkinen, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Fri, Jul 15, 2016 at 12:31:43PM -0700, Andrey Pronin wrote: > I even tried changing the code there to > __be32 vv = cmd.params.get_tpm_pt_out.value; > u32 ret = vv; > to make it clear what's going on. Still, no complaints from sparse. Hum, I'm not an expert at sparse, but I expect a warning from it here? Maybe Jarkko knows when he gets back? Jason ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:05 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 19:05 UTC (permalink / raw) To: Jason Gunthorpe Cc: Andrey Pronin, Peter Huewe, Marcel Selhorst, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Fri, Jul 15, 2016 at 01:39:28PM -0600, Jason Gunthorpe wrote: > On Fri, Jul 15, 2016 at 12:31:43PM -0700, Andrey Pronin wrote: > > > I even tried changing the code there to > > __be32 vv = cmd.params.get_tpm_pt_out.value; > > u32 ret = vv; > > to make it clear what's going on. Still, no complaints from sparse. > > Hum, I'm not an expert at sparse, but I expect a warning from it here? > > Maybe Jarkko knows when he gets back? I do run sparse regularly. If look at the commit log there are even couple of recent bug fixes related to sparse errors. /Jarkko ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:05 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 19:05 UTC (permalink / raw) To: Jason Gunthorpe Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Fri, Jul 15, 2016 at 01:39:28PM -0600, Jason Gunthorpe wrote: > On Fri, Jul 15, 2016 at 12:31:43PM -0700, Andrey Pronin wrote: > > > I even tried changing the code there to > > __be32 vv = cmd.params.get_tpm_pt_out.value; > > u32 ret = vv; > > to make it clear what's going on. Still, no complaints from sparse. > > Hum, I'm not an expert at sparse, but I expect a warning from it here? > > Maybe Jarkko knows when he gets back? I do run sparse regularly. If look at the commit log there are even couple of recent bug fixes related to sparse errors. /Jarkko ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:04 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 19:04 UTC (permalink / raw) To: Andrey Pronin Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > Signed-off-by: Andrey Pronin <apronin@chromium.org> Please remove the internal commit ID next time. This is also lacking a description but this time I can write it down. This not needed for the stable for obvious reasons (only used for probing). Fixes: 7a1d7e6dd76a ("tpm: TPM 2.0 baseline support") Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> /Jarkko > --- > drivers/char/tpm/tpm2-cmd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c > index a1673dc..a88b31e 100644 > --- a/drivers/char/tpm/tpm2-cmd.c > +++ b/drivers/char/tpm/tpm2-cmd.c > @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, > > rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); > if (!rc) > - *value = cmd.params.get_tpm_pt_out.value; > + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); > > return rc; > } > -- > 2.6.6 > ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:04 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 19:04 UTC (permalink / raw) To: Andrey Pronin Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> Please remove the internal commit ID next time. This is also lacking a description but this time I can write it down. This not needed for the stable for obvious reasons (only used for probing). Fixes: 7a1d7e6dd76a ("tpm: TPM 2.0 baseline support") Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> /Jarkko > --- > drivers/char/tpm/tpm2-cmd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c > index a1673dc..a88b31e 100644 > --- a/drivers/char/tpm/tpm2-cmd.c > +++ b/drivers/char/tpm/tpm2-cmd.c > @@ -703,7 +703,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, > > rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), desc); > if (!rc) > - *value = cmd.params.get_tpm_pt_out.value; > + *value = be32_to_cpu(cmd.params.get_tpm_pt_out.value); > > return rc; > } > -- > 2.6.6 > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:09 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 19:09 UTC (permalink / raw) To: Andrey Pronin Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Mon, Jul 18, 2016 at 10:04:21PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apronin@chromium.org> > > Please remove the internal commit ID next time. This is also lacking a > description but this time I can write it down. > > This not needed for the stable for obvious reasons (only used for > probing). > > Fixes: 7a1d7e6dd76a ("tpm: TPM 2.0 baseline support") > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Applied. /Jarkko ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:09 ` Jarkko Sakkinen 0 siblings, 0 replies; 25+ messages in thread From: Jarkko Sakkinen @ 2016-07-18 19:09 UTC (permalink / raw) To: Andrey Pronin Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Mon, Jul 18, 2016 at 10:04:21PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > > Please remove the internal commit ID next time. This is also lacking a > description but this time I can write it down. > > This not needed for the stable for obvious reasons (only used for > probing). > > Fixes: 7a1d7e6dd76a ("tpm: TPM 2.0 baseline support") > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> Applied. /Jarkko ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:13 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-18 19:13 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Peter Huewe, Marcel Selhorst, Jason Gunthorpe, tpmdd-devel, linux-kernel, groeck, smbarber, dianders On Mon, Jul 18, 2016 at 10:04:21PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apronin@chromium.org> > > Please remove the internal commit ID next time. This is also lacking a > description but this time I can write it down. > Yes, sorry for the commit ID, missed it in this patch :( > This not needed for the stable for obvious reasons (only used for > probing). > I intend to use tpm2_get_tpm_pt for tpm2 sysfs attributes implementation (permanent and startup_clear flags). Just submitted as a separate patch since it fixes a more generic bug. ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt @ 2016-07-18 19:13 ` Andrey Pronin 0 siblings, 0 replies; 25+ messages in thread From: Andrey Pronin @ 2016-07-18 19:13 UTC (permalink / raw) To: Jarkko Sakkinen Cc: dianders-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, smbarber-F7+t8E8rja9g9hUCZPvPmw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, groeck-F7+t8E8rja9g9hUCZPvPmw On Mon, Jul 18, 2016 at 10:04:21PM +0300, Jarkko Sakkinen wrote: > On Thu, Jul 14, 2016 at 06:07:18PM -0700, Andrey Pronin wrote: > > Change-Id: I7d71cd379b1a3b7659d20a1b6008216762596590 > > Signed-off-by: Andrey Pronin <apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> > > Please remove the internal commit ID next time. This is also lacking a > description but this time I can write it down. > Yes, sorry for the commit ID, missed it in this patch :( > This not needed for the stable for obvious reasons (only used for > probing). > I intend to use tpm2_get_tpm_pt for tpm2 sysfs attributes implementation (permanent and startup_clear flags). Just submitted as a separate patch since it fixes a more generic bug. ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev ^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2016-07-18 19:13 UTC | newest] Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-07-15 1:07 [PATCH 0/2] tpm: better support for 32-bit tpm2 properties Andrey Pronin 2016-07-15 1:07 ` Andrey Pronin 2016-07-15 1:07 ` [PATCH 1/2] tpm: define constants for " Andrey Pronin 2016-07-15 1:07 ` Andrey Pronin 2016-07-15 3:08 ` Jason Gunthorpe 2016-07-15 3:08 ` Jason Gunthorpe 2016-07-18 18:58 ` Jarkko Sakkinen 2016-07-18 18:58 ` Jarkko Sakkinen 2016-07-15 1:07 ` [PATCH 2/2] tpm: fix byte-order for the value read by tpm2_get_tpm_pt Andrey Pronin 2016-07-15 1:07 ` Andrey Pronin 2016-07-15 3:10 ` Jason Gunthorpe 2016-07-15 3:17 ` Andrey Pronin 2016-07-15 3:17 ` Andrey Pronin 2016-07-15 3:35 ` Jason Gunthorpe 2016-07-15 3:35 ` Jason Gunthorpe 2016-07-15 19:31 ` Andrey Pronin 2016-07-15 19:39 ` Jason Gunthorpe 2016-07-18 19:05 ` Jarkko Sakkinen 2016-07-18 19:05 ` Jarkko Sakkinen 2016-07-18 19:04 ` Jarkko Sakkinen 2016-07-18 19:04 ` Jarkko Sakkinen 2016-07-18 19:09 ` Jarkko Sakkinen 2016-07-18 19:09 ` Jarkko Sakkinen 2016-07-18 19:13 ` Andrey Pronin 2016-07-18 19:13 ` Andrey Pronin
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.