Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610542 > unrolled thread
| Started by | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| First post | 2017-03-28 12:30 +0200 |
| Last post | 2017-03-28 15:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] tpm: do handle area size validation only when TPM space used Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-28 12:30 +0200
RE: [PATCH] tpm: do handle area size validation only when TPM space used <Alexander.Steffen@infineon.com> - 2017-03-28 13:40 +0200
Re: [PATCH] tpm: do handle area size validation only when TPM space used Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-28 15:00 +0200
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2017-03-28 12:30 +0200 |
| Subject | Re: [PATCH] tpm: do handle area size validation only when TPM space used |
| Message-ID | <tpWxY-69I-11@gated-at.bofh.it> |
So do you need this or not?
/Jarkko
On Mon, Mar 27, 2017 at 12:08:15AM +0300, Jarkko Sakkinen wrote:
> In order to not cause backwards compatibility issues with
> /dev/tpm0 disable handle area size validation if tpm_transmit
> is not called with a TPM space.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
> ---
> drivers/char/tpm/tpm-interface.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index bf0c3fa..158c1db 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -328,7 +328,9 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip,
> }
> EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);
>
> -static bool tpm_validate_command(struct tpm_chip *chip, const u8 *cmd,
> +static bool tpm_validate_command(struct tpm_chip *chip,
> + struct tpm_space *space,
> + const u8 *cmd,
> size_t len)
> {
> const struct tpm_input_header *header = (const void *)cmd;
> @@ -340,6 +342,9 @@ static bool tpm_validate_command(struct tpm_chip *chip, const u8 *cmd,
> if (len < TPM_HEADER_SIZE)
> return false;
>
> + if (!space)
> + return true;
> +
> if (chip->flags & TPM_CHIP_FLAG_TPM2 && chip->nr_commands) {
> cc = be32_to_cpu(header->ordinal);
>
> @@ -386,7 +391,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
> unsigned long stop;
> bool need_locality;
>
> - if (!tpm_validate_command(chip, buf, bufsiz))
> + if (!tpm_validate_command(chip, space, buf, bufsiz))
> return -EINVAL;
>
> if (bufsiz > TPM_BUFSIZE)
> --
> 2.9.3
>
[toc] | [next] | [standalone]
| From | <Alexander.Steffen@infineon.com> |
|---|---|
| Date | 2017-03-28 13:40 +0200 |
| Message-ID | <tpXDJ-6Qq-33@gated-at.bofh.it> |
| In reply to | #1610542 |
Yes, this fixes the issue for me. Thanks.
Alexander
> -----Original Message-----
> From: Jarkko Sakkinen [mailto:jarkko.sakkinen@linux.intel.com]
> Sent: Tuesday, March 28, 2017 12:25 PM
> To: Steffen Alexander (IFAG CCS ESS D SW A)
> Cc: tpmdd-devel@lists.sourceforge.net; linux-security-
> module@vger.kernel.org; Peter Huewe; Marcel Selhorst; Jason Gunthorpe;
> open list
> Subject: Re: [PATCH] tpm: do handle area size validation only when TPM
> space used
>
> So do you need this or not?
>
> /Jarkko
>
> On Mon, Mar 27, 2017 at 12:08:15AM +0300, Jarkko Sakkinen wrote:
> > In order to not cause backwards compatibility issues with
> > /dev/tpm0 disable handle area size validation if tpm_transmit is not
> > called with a TPM space.
> >
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
> > ---
> > drivers/char/tpm/tpm-interface.c | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/char/tpm/tpm-interface.c
> > b/drivers/char/tpm/tpm-interface.c
> > index bf0c3fa..158c1db 100644
> > --- a/drivers/char/tpm/tpm-interface.c
> > +++ b/drivers/char/tpm/tpm-interface.c
> > @@ -328,7 +328,9 @@ unsigned long tpm_calc_ordinal_duration(struct
> > tpm_chip *chip, } EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);
> >
> > -static bool tpm_validate_command(struct tpm_chip *chip, const u8
> > *cmd,
> > +static bool tpm_validate_command(struct tpm_chip *chip,
> > + struct tpm_space *space,
> > + const u8 *cmd,
> > size_t len)
> > {
> > const struct tpm_input_header *header = (const void *)cmd; @@ -
> 340,6
> > +342,9 @@ static bool tpm_validate_command(struct tpm_chip *chip,
> const u8 *cmd,
> > if (len < TPM_HEADER_SIZE)
> > return false;
> >
> > + if (!space)
> > + return true;
> > +
> > if (chip->flags & TPM_CHIP_FLAG_TPM2 && chip->nr_commands) {
> > cc = be32_to_cpu(header->ordinal);
> >
> > @@ -386,7 +391,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct
> tpm_space *space,
> > unsigned long stop;
> > bool need_locality;
> >
> > - if (!tpm_validate_command(chip, buf, bufsiz))
> > + if (!tpm_validate_command(chip, space, buf, bufsiz))
> > return -EINVAL;
> >
> > if (bufsiz > TPM_BUFSIZE)
> > --
> > 2.9.3
> >
[toc] | [prev] | [next] | [standalone]
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
|---|---|
| Date | 2017-03-28 15:00 +0200 |
| Message-ID | <tpYT8-7JQ-19@gated-at.bofh.it> |
| In reply to | #1610607 |
On Tue, Mar 28, 2017 at 11:27:53AM +0000, Alexander.Steffen@infineon.com wrote:
> Yes, this fixes the issue for me. Thanks.
>
> Alexander
Great. I will squash this to the infrastructure patch. Thank you.
/Jarkko
> > -----Original Message-----
> > From: Jarkko Sakkinen [mailto:jarkko.sakkinen@linux.intel.com]
> > Sent: Tuesday, March 28, 2017 12:25 PM
> > To: Steffen Alexander (IFAG CCS ESS D SW A)
> > Cc: tpmdd-devel@lists.sourceforge.net; linux-security-
> > module@vger.kernel.org; Peter Huewe; Marcel Selhorst; Jason Gunthorpe;
> > open list
> > Subject: Re: [PATCH] tpm: do handle area size validation only when TPM
> > space used
> >
> > So do you need this or not?
> >
> > /Jarkko
> >
> > On Mon, Mar 27, 2017 at 12:08:15AM +0300, Jarkko Sakkinen wrote:
> > > In order to not cause backwards compatibility issues with
> > > /dev/tpm0 disable handle area size validation if tpm_transmit is not
> > > called with a TPM space.
> > >
> > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
> > > ---
> > > drivers/char/tpm/tpm-interface.c | 9 +++++++--
> > > 1 file changed, 7 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/char/tpm/tpm-interface.c
> > > b/drivers/char/tpm/tpm-interface.c
> > > index bf0c3fa..158c1db 100644
> > > --- a/drivers/char/tpm/tpm-interface.c
> > > +++ b/drivers/char/tpm/tpm-interface.c
> > > @@ -328,7 +328,9 @@ unsigned long tpm_calc_ordinal_duration(struct
> > > tpm_chip *chip, } EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);
> > >
> > > -static bool tpm_validate_command(struct tpm_chip *chip, const u8
> > > *cmd,
> > > +static bool tpm_validate_command(struct tpm_chip *chip,
> > > + struct tpm_space *space,
> > > + const u8 *cmd,
> > > size_t len)
> > > {
> > > const struct tpm_input_header *header = (const void *)cmd; @@ -
> > 340,6
> > > +342,9 @@ static bool tpm_validate_command(struct tpm_chip *chip,
> > const u8 *cmd,
> > > if (len < TPM_HEADER_SIZE)
> > > return false;
> > >
> > > + if (!space)
> > > + return true;
> > > +
> > > if (chip->flags & TPM_CHIP_FLAG_TPM2 && chip->nr_commands) {
> > > cc = be32_to_cpu(header->ordinal);
> > >
> > > @@ -386,7 +391,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct
> > tpm_space *space,
> > > unsigned long stop;
> > > bool need_locality;
> > >
> > > - if (!tpm_validate_command(chip, buf, bufsiz))
> > > + if (!tpm_validate_command(chip, space, buf, bufsiz))
> > > return -EINVAL;
> > >
> > > if (bufsiz > TPM_BUFSIZE)
> > > --
> > > 2.9.3
> > >
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web