diff for duplicates of <1521249631.12827.5.camel@HansenPartnership.com> diff --git a/a/1.txt b/N1/1.txt index 9a3de92..63feb24 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -4,20 +4,20 @@ On Mon, 2018-03-05 at 18:56 +0200, Jarkko Sakkinen wrote: > +++ b/drivers/char/tpm/tpm-interface.c > @@ -537,14 +537,26 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, > struct tpm_space *space, -> const char *desc) -> { -> const struct tpm_output_header *header = buf; +> const char *desc) +> { +> const struct tpm_output_header *header = buf; > + unsigned int delay_msec = TPM2_DURATION_SHORT; -> int err; -> ssize_t len; -> +> int err; +> ssize_t len; +> > - len = tpm_transmit(chip, space, (u8 *)buf, bufsiz, flags); -> - if (len < 0) +> - if (len < 0) > - return len; > + for (;;) { > + len = tpm_transmit(chip, space, (u8 *)buf, bufsiz, > flags); -> + if (len < 0) +> + if (len < 0) > + return len; > + err = be32_to_cpu(header->return_code); > + if (err != TPM2_RC_TESTING) @@ -33,8 +33,8 @@ On Mon, 2018-03-05 at 18:56 +0200, Jarkko Sakkinen wrote: > + } It turns out this bit is wrong ... I just discovered it testing the -RC_RETRY code. You can't feed the buf back to tpm_transmit because the -header has already been changed to give you back the return code. To +RC_RETRY code. You can't feed the buf back to tpm_transmit because the +header has already been changed to give you back the return code. To make this work, you have to save the header and handle area and restore it before the command is resent. diff --git a/a/content_digest b/N1/content_digest index 8b33b74..cd5d372 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -2,7 +2,7 @@ "ref\020180305165614.5469-2-jarkko.sakkinen@linux.intel.com\0" "From\0James Bottomley <James.Bottomley@hansenpartnership.com>\0" "Subject\0Re: [PATCH v3 1/5] tpm: fix intermittent failure with self tests\0" - "Date\0Sat, 17 Mar 2018 01:20:31 +0000\0" + "Date\0Fri, 16 Mar 2018 18:20:31 -0700\0" "To\0Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>" " linux-integrity@vger.kernel.org\0" "Cc\0linux-security-module@vger.kernel.org" @@ -22,20 +22,20 @@ "> +++ b/drivers/char/tpm/tpm-interface.c\n" "> @@ -537,14 +537,26 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip,\n" "> struct tpm_space *space,\n" - "> \302\240\t\t\t\302\240const char *desc)\n" - "> \302\240{\n" - "> \302\240\tconst struct tpm_output_header *header = buf;\n" + "> \t\t\t const char *desc)\n" + "> {\n" + "> \tconst struct tpm_output_header *header = buf;\n" "> +\tunsigned int delay_msec = TPM2_DURATION_SHORT;\n" - "> \302\240\tint err;\n" - "> \302\240\tssize_t len;\n" - "> \302\240\n" + "> \tint err;\n" + "> \tssize_t len;\n" + "> \n" "> -\tlen = tpm_transmit(chip, space, (u8 *)buf, bufsiz, flags);\n" - "> -\tif (len <\302\240\302\2400)\n" + "> -\tif (len < 0)\n" "> -\t\treturn len;\n" "> +\tfor (;;) {\n" "> +\t\tlen = tpm_transmit(chip, space, (u8 *)buf, bufsiz,\n" "> flags);\n" - "> +\t\tif (len <\302\240\302\2400)\n" + "> +\t\tif (len < 0)\n" "> +\t\t\treturn len;\n" "> +\t\terr = be32_to_cpu(header->return_code);\n" "> +\t\tif (err != TPM2_RC_TESTING)\n" @@ -51,8 +51,8 @@ "> +\t}\n" "\n" "It turns out this bit is wrong ... I just discovered it testing the\n" - "RC_RETRY code. \302\240You can't feed the buf back to tpm_transmit because the\n" - "header has already been changed to give you back the return code. \302\240To\n" + "RC_RETRY code. You can't feed the buf back to tpm_transmit because the\n" + "header has already been changed to give you back the return code. To\n" "make this work, you have to save the header and handle area and restore\n" "it before the command is resent.\n" "\n" @@ -61,4 +61,4 @@ "\n" James -022965032867f279869573e3aa92744ba73f9d43d0ad6725da02193485b46c98 +a33079f0f8cbfd13bf0c00e0b9a98f3376f19c037445895796da308f8ca4b6a0
diff --git a/a/1.txt b/N2/1.txt index 9a3de92..a0e5a38 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -4,20 +4,20 @@ On Mon, 2018-03-05 at 18:56 +0200, Jarkko Sakkinen wrote: > +++ b/drivers/char/tpm/tpm-interface.c > @@ -537,14 +537,26 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, > struct tpm_space *space, -> const char *desc) -> { -> const struct tpm_output_header *header = buf; +> ? ?const char *desc) +> ?{ +> ? const struct tpm_output_header *header = buf; > + unsigned int delay_msec = TPM2_DURATION_SHORT; -> int err; -> ssize_t len; -> +> ? int err; +> ? ssize_t len; +> ? > - len = tpm_transmit(chip, space, (u8 *)buf, bufsiz, flags); -> - if (len < 0) +> - if (len <??0) > - return len; > + for (;;) { > + len = tpm_transmit(chip, space, (u8 *)buf, bufsiz, > flags); -> + if (len < 0) +> + if (len <??0) > + return len; > + err = be32_to_cpu(header->return_code); > + if (err != TPM2_RC_TESTING) @@ -33,8 +33,8 @@ On Mon, 2018-03-05 at 18:56 +0200, Jarkko Sakkinen wrote: > + } It turns out this bit is wrong ... I just discovered it testing the -RC_RETRY code. You can't feed the buf back to tpm_transmit because the -header has already been changed to give you back the return code. To +RC_RETRY code. ?You can't feed the buf back to tpm_transmit because the +header has already been changed to give you back the return code. ?To make this work, you have to save the header and handle area and restore it before the command is resent. @@ -42,3 +42,8 @@ I think the best solution for this hunk of code is to merge it with the retry code. James + +-- +To unsubscribe from this list: send the line "unsubscribe linux-security-module" in +the body of a message to majordomo at vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/a/content_digest b/N2/content_digest index 8b33b74..5822c93 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -1,19 +1,9 @@ "ref\020180305165614.5469-1-jarkko.sakkinen@linux.intel.com\0" "ref\020180305165614.5469-2-jarkko.sakkinen@linux.intel.com\0" - "From\0James Bottomley <James.Bottomley@hansenpartnership.com>\0" - "Subject\0Re: [PATCH v3 1/5] tpm: fix intermittent failure with self tests\0" - "Date\0Sat, 17 Mar 2018 01:20:31 +0000\0" - "To\0Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>" - " linux-integrity@vger.kernel.org\0" - "Cc\0linux-security-module@vger.kernel.org" - keyrings@vger.kernel.org - stable@vger.kernel.org - Jarkko Sakkinen <jarkko.sakkine@linux.intel.com> - Peter Huewe <peterhuewe@gmx.de> - Jason Gunthorpe <jgg@ziepe.ca> - Arnd Bergmann <arnd@arndb.de> - Greg Kroah-Hartman <gregkh@linuxfoundation.org> - " open list <linux-kernel@vger.kernel.org>\0" + "From\0James.Bottomley@hansenpartnership.com (James Bottomley)\0" + "Subject\0[PATCH v3 1/5] tpm: fix intermittent failure with self tests\0" + "Date\0Fri, 16 Mar 2018 18:20:31 -0700\0" + "To\0linux-security-module@vger.kernel.org\0" "\00:1\0" "b\0" "On Mon, 2018-03-05 at 18:56 +0200, Jarkko Sakkinen wrote:\n" @@ -22,20 +12,20 @@ "> +++ b/drivers/char/tpm/tpm-interface.c\n" "> @@ -537,14 +537,26 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip,\n" "> struct tpm_space *space,\n" - "> \302\240\t\t\t\302\240const char *desc)\n" - "> \302\240{\n" - "> \302\240\tconst struct tpm_output_header *header = buf;\n" + "> ?\t\t\t?const char *desc)\n" + "> ?{\n" + "> ?\tconst struct tpm_output_header *header = buf;\n" "> +\tunsigned int delay_msec = TPM2_DURATION_SHORT;\n" - "> \302\240\tint err;\n" - "> \302\240\tssize_t len;\n" - "> \302\240\n" + "> ?\tint err;\n" + "> ?\tssize_t len;\n" + "> ?\n" "> -\tlen = tpm_transmit(chip, space, (u8 *)buf, bufsiz, flags);\n" - "> -\tif (len <\302\240\302\2400)\n" + "> -\tif (len <??0)\n" "> -\t\treturn len;\n" "> +\tfor (;;) {\n" "> +\t\tlen = tpm_transmit(chip, space, (u8 *)buf, bufsiz,\n" "> flags);\n" - "> +\t\tif (len <\302\240\302\2400)\n" + "> +\t\tif (len <??0)\n" "> +\t\t\treturn len;\n" "> +\t\terr = be32_to_cpu(header->return_code);\n" "> +\t\tif (err != TPM2_RC_TESTING)\n" @@ -51,14 +41,19 @@ "> +\t}\n" "\n" "It turns out this bit is wrong ... I just discovered it testing the\n" - "RC_RETRY code. \302\240You can't feed the buf back to tpm_transmit because the\n" - "header has already been changed to give you back the return code. \302\240To\n" + "RC_RETRY code. ?You can't feed the buf back to tpm_transmit because the\n" + "header has already been changed to give you back the return code. ?To\n" "make this work, you have to save the header and handle area and restore\n" "it before the command is resent.\n" "\n" "I think the best solution for this hunk of code is to merge it with the\n" "retry code.\n" "\n" - James + "James\n" + "\n" + "--\n" + "To unsubscribe from this list: send the line \"unsubscribe linux-security-module\" in\n" + "the body of a message to majordomo at vger.kernel.org\n" + More majordomo info at http://vger.kernel.org/majordomo-info.html -022965032867f279869573e3aa92744ba73f9d43d0ad6725da02193485b46c98 +502a35d165a0ff2716e0d731ae07a958092dc8a4f83e2d83480fd57f00564e88
diff --git a/a/content_digest b/N3/content_digest index 8b33b74..175529c 100644 --- a/a/content_digest +++ b/N3/content_digest @@ -2,7 +2,7 @@ "ref\020180305165614.5469-2-jarkko.sakkinen@linux.intel.com\0" "From\0James Bottomley <James.Bottomley@hansenpartnership.com>\0" "Subject\0Re: [PATCH v3 1/5] tpm: fix intermittent failure with self tests\0" - "Date\0Sat, 17 Mar 2018 01:20:31 +0000\0" + "Date\0Fri, 16 Mar 2018 18:20:31 -0700\0" "To\0Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>" " linux-integrity@vger.kernel.org\0" "Cc\0linux-security-module@vger.kernel.org" @@ -61,4 +61,4 @@ "\n" James -022965032867f279869573e3aa92744ba73f9d43d0ad6725da02193485b46c98 +a5c83894f86d873fb033629de46ec9db2787df9749e3db604a70520d0ba5f446
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.