[tpm2] Re: tpm2_flushcontext stuck
Han <keepsimple at gmail.com>
| Newsgroups | dev.linux.lists.tpm2 |
|---|---|
| Message-ID | <CAEjGaqeTkD1U2Ppb_F08WwG8gEfNJgYtD9tkYfw9tBHztcxu7Q@mail.gmail.com> |
On Sat, Dec 18, 2021 at 6:11 AM Juergen Repp <Juergen.Repp(a)sit.fraunhofer.de>
wrote:
> I forgot to mention: If /dev/tpm0 was used instead of /dev/tpmrm0
> everything worked without problems.
>
I probably missed it, how can I specify to make sure /dev/tpm0 is used,
and not /dev/tpmrm0 ? Is it in some configurations?
thanks
Han
>
> Am 18.12.21 um 00:58 schrieb Han:
> >
> > On Fri, Dec 17, 2021 at 12:51 PM Roberts, William C <
> william.c.roberts(a)intel.com <mailto:william.c.roberts(a)intel.com>> wrote:
> >
> > I wonder if it's related to this bug, but manifesting itself
> differently:
> > - https://github.com/tpm2-software/tpm2-tools/issues/1356 <
> https://github.com/tpm2-software/tpm2-tools/issues/1356>
> >
> >
> > Not sure. The bug is reported on "tpm2-tools" 3.1.3 with Linux kernel
> 5.0. I'm using "tpm2-tools" 5.0 now with kernel 5.10.
> >
> >
> > What version of the tpm2-tss libraries are you running? Do commands
> like tpm2_getrandom work?
> >
> >
> > There are multiple tss libs on my system (see below), but I think it
> is 3.0.3. Yes commands like `tpm2_getrandom` work, including
> `tpm2_createprimary`.
> >
> > $ apt search tpm2 | grep tss
> >
> > WARNING: apt does not have a stable CLI interface. Use with caution in
> scripts.
> >
> > libtss2-dev/stable 3.0.3-2 armhf
> > libtss2-esys-3.0.2-0/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-fapi1/stable 3.0.3-2 armhf
> > libtss2-mu0/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-rc0/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-sys1/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-tcti-cmd0/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-tcti-device0/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-tcti-mssim0/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-tcti-swtpm0/stable,now 3.0.3-2 armhf [installed,automatic]
> > libtss2-tcti-tabrmd-dev/stable 2.3.3-1+b1 armhf
> > libtss2-tcti-tabrmd0/stable 2.3.3-1+b1 armhf
> > libtss2-tctildr0/stable,now 3.0.3-2 armhf [installed,automatic]
> >
> >
> >
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > *From:* Han <keepsimple(a)gmail.com <mailto:keepsimple(a)gmail.com>>
> > *Sent:* Friday, December 17, 2021 2:04 PM
> > *To:* Roberts, William C <william.c.roberts(a)intel.com <mailto:
> william.c.roberts(a)intel.com>>
> > *Cc:* tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org> <
> tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org>>
> > *Subject:* Re: [tpm2] tpm2_flushcontext stuck
> >
> > It seems stuck in a call of `poll()` at fd 3, which is
> /dev/tpmrm0 based on the log (see below). The kernel version is 5.10.63.
> Yes, I am using /dev/tpm0 and /dev/tpmrm0.
> >
> > $ sudo strace tpm2_flushcontext 0x80000000
> >
> > <snip>
> >
> > openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC)
> = 3
> > fstat64(3, {st_mode=S_IFREG|0644, st_size=72845, ...}) = 0
> > mmap2(NULL, 72845, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f74000
> > close(3) = 0
> > openat(AT_FDCWD,
> "/lib/arm-linux-gnueabihf/libtss2-tcti-device.so.0",
> O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
> > read(3,
> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\08\n\0\0004\0\0\0"..., 512) =
> 512
> > fstat64(3, {st_mode=S_IFREG|0644, st_size=22028, ...}) = 0
> > mmap2(NULL, 86236, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE,
> 3, 0) = 0xb5f22000
> > mprotect(0xb5f27000, 61440, PROT_NONE) = 0
> > mmap2(0xb5f36000, 8192, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0xb5f36000
> > close(3) = 0
> > mprotect(0xb5f36000, 4096, PROT_READ) = 0
> > munmap(0xb6f74000, 72845) = 0
> > openat(AT_FDCWD, "/dev/tpmrm0", O_RDWR|O_NONBLOCK) = 3
> > write(3, "\200\1\0\0\0\f\0\0\1{\0\10", 12) = 12
> > poll([{fd=3, events=POLLIN}], 1, 1000) = 1 ([{fd=3,
> revents=POLLIN}])
> > read(3, "\200\1\0\0\0\24\0\0\0\0", 10) = 10
> > poll([{fd=3, events=POLLIN}], 1, 1000) = 1 ([{fd=3,
> revents=POLLIN}])
> > read(3, "\0\10Z\314k~c`I\346", 10) = 10
> > futex(0xb6e7d35c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d360, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d364, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d380, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7ac9c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d280, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7b224, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7ad20, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > brk(0xda2000) = 0xda2000
> > futex(0xb6e7d368, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d384, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d3f8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d36c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > futex(0xb6e7d370, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> > write(3, "\200\1\0\0\0\16\0\0\1s\200\0\0\0", 14) = 14
> > poll([{fd=3, events=POLLIN}], 1, -1
> >
> >
> >
> > On Fri, Dec 17, 2021 at 10:29 AM Roberts, William C <
> william.c.roberts(a)intel.com <mailto:william.c.roberts(a)intel.com>> wrote:
> >
> > That's weird, could you strace it and see where it's hanging?
> >
> > What kernel version is that? I'm assuming your using the
> /dev/tpm0 or /dev/tpmrm0 device directly since I see the sudo.
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > *From:* Han <keepsimple(a)gmail.com <mailto:keepsimple(a)gmail.com>>
> > *Sent:* Wednesday, December 15, 2021 5:56 PM
> > *To:* tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org> <
> tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org>>
> > *Subject:* [tpm2] tpm2_flushcontext stuck
> >
> > Hi,
> >
> > I'm using tpm2-tools 5.0 in Debian 11 Bullseye based Raspberry
> Pi OS. I'm trying to run tpm2_flushcontext but the command got stuck and
> it's not showing anything. Is the data in TPM corrupted? How can I check?
> >
> > $ sudo tpm2_flushcontext 0x80000000
> > < no output at all and stuck here >
> >
> > (note: the handle 0x80000000 was obtained from previous command
> output when I was running previous version tpm2-tools 3.1.3 on Debian 10
> Buster based OS:
> >
> > |$ sudo tpm2_createprimary -H o -g sha256 -G ecc -C context.out
> ObjectAttribute: 0x00030072 CreatePrimary Succeed ! Handle: 0x80000000) |
> >
> >
> > _______________________________________________
> > tpm2 mailing list -- tpm2(a)lists.01.org
> > To unsubscribe send an email to tpm2-leave(a)lists.01.org
> > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
> >
>
>
attachment.htm
(text/html, 11.4 KB)
<div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 18, 2021 at 6:11 AM Juergen Repp <<a href="mailto:[email protected]">[email protected]</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I forgot to mention: If /dev/tpm0 was used instead of /dev/tpmrm0 everything worked without problems.<br></blockquote><div><br></div><div>I probably missed it, how can I specify to make sure /dev/tpm0 is used, and not /dev/tpmrm0 ? Is it in some configurations?</div><div><br></div><div>thanks</div><div>Han</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> Am 18.12.21 um 00:58 schrieb Han:<br> > <br> > On Fri, Dec 17, 2021 at 12:51 PM Roberts, William C <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>> wrote:<br> > <br> > I wonder if it's related to this bug, but manifesting itself differently:<br> > - <a href="https://github.com/tpm2-software/tpm2-tools/issues/1356" rel="noreferrer" target="_blank">https://github.com/tpm2-software/tpm2-tools/issues/1356</a> <<a href="https://github.com/tpm2-software/tpm2-tools/issues/1356" rel="noreferrer" target="_blank">https://github.com/tpm2-software/tpm2-tools/issues/1356</a>><br> > <br> > <br> > Not sure. The bug is reported on "tpm2-tools" 3.1.3 with Linux kernel 5.0. I'm using "tpm2-tools" 5.0 now with kernel 5.10.<br> > <br> > <br> > What version of the tpm2-tss libraries are you running? Do commands like tpm2_getrandom work?<br> > <br> > <br> > There are multiple tss libs on my system (see below), but I think it is 3.0.3. Yes commands like `tpm2_getrandom` work, including `tpm2_createprimary`. <br> > <br> > $ apt search tpm2 | grep tss<br> > <br> > WARNING: apt does not have a stable CLI interface. Use with caution in scripts.<br> > <br> > libtss2-dev/stable 3.0.3-2 armhf<br> > libtss2-esys-3.0.2-0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-fapi1/stable 3.0.3-2 armhf<br> > libtss2-mu0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-rc0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-sys1/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-tcti-cmd0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-tcti-device0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-tcti-mssim0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-tcti-swtpm0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > libtss2-tcti-tabrmd-dev/stable 2.3.3-1+b1 armhf<br> > libtss2-tcti-tabrmd0/stable 2.3.3-1+b1 armhf<br> > libtss2-tctildr0/stable,now 3.0.3-2 armhf [installed,automatic]<br> > <br> > <br> > <br> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br> > *From:* Han <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>><br> > *Sent:* Friday, December 17, 2021 2:04 PM<br> > *To:* Roberts, William C <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>><br> > *Cc:* <a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>> <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>><br> > *Subject:* Re: [tpm2] tpm2_flushcontext stuck<br> > <br> > It seems stuck in a call of `poll()` at fd 3, which is /dev/tpmrm0 based on the log (see below). The kernel version is 5.10.63. Yes, I am using /dev/tpm0 and /dev/tpmrm0. <br> > <br> > $ sudo strace tpm2_flushcontext 0x80000000<br> > <br> > <snip><br> > <br> > openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3<br> > fstat64(3, {st_mode=S_IFREG|0644, st_size=72845, ...}) = 0<br> > mmap2(NULL, 72845, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6f74000<br> > close(3) = 0<br> > openat(AT_FDCWD, "/lib/arm-linux-gnueabihf/libtss2-tcti-device.so.0", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3<br> > read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\08\n\0\0004\0\0\0"..., 512) = 512<br> > fstat64(3, {st_mode=S_IFREG|0644, st_size=22028, ...}) = 0<br> > mmap2(NULL, 86236, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb5f22000<br> > mprotect(0xb5f27000, 61440, PROT_NONE) = 0<br> > mmap2(0xb5f36000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0xb5f36000<br> > close(3) = 0<br> > mprotect(0xb5f36000, 4096, PROT_READ) = 0<br> > munmap(0xb6f74000, 72845) = 0<br> > openat(AT_FDCWD, "/dev/tpmrm0", O_RDWR|O_NONBLOCK) = 3<br> > write(3, "\200\1\0\0\0\f\0\0\1{\0\10", 12) = 12<br> > poll([{fd=3, events=POLLIN}], 1, 1000) = 1 ([{fd=3, revents=POLLIN}])<br> > read(3, "\200\1\0\0\0\24\0\0\0\0", 10) = 10<br> > poll([{fd=3, events=POLLIN}], 1, 1000) = 1 ([{fd=3, revents=POLLIN}])<br> > read(3, "\0\10Z\314k~c`I\346", 10) = 10<br> > futex(0xb6e7d35c, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d360, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d364, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d380, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7ac9c, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d280, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7b224, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7ad20, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > brk(0xda2000) = 0xda2000<br> > futex(0xb6e7d368, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d384, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d3f8, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d36c, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > futex(0xb6e7d370, FUTEX_WAKE_PRIVATE, 2147483647) = 0<br> > write(3, "\200\1\0\0\0\16\0\0\1s\200\0\0\0", 14) = 14<br> > poll([{fd=3, events=POLLIN}], 1, -1<br> > <br> > <br> > <br> > On Fri, Dec 17, 2021 at 10:29 AM Roberts, William C <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>> wrote:<br> > <br> > That's weird, could you strace it and see where it's hanging?<br> > <br> > What kernel version is that? I'm assuming your using the /dev/tpm0 or /dev/tpmrm0 device directly since I see the sudo.<br> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br> > *From:* Han <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>><br> > *Sent:* Wednesday, December 15, 2021 5:56 PM<br> > *To:* <a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>> <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>><br> > *Subject:* [tpm2] tpm2_flushcontext stuck<br> > <br> > Hi,<br> > <br> > I'm using tpm2-tools 5.0 in Debian 11 Bullseye based Raspberry Pi OS. I'm trying to run tpm2_flushcontext but the command got stuck and it's not showing anything. Is the data in TPM corrupted? How can I check? <br> > <br> > $ sudo tpm2_flushcontext 0x80000000<br> > < no output at all and stuck here ><br> > <br> > (note: the handle 0x80000000 was obtained from previous command output when I was running previous version tpm2-tools 3.1.3 on Debian 10 Buster based OS: <br> > <br> > |$ sudo tpm2_createprimary -H o -g sha256 -G ecc -C context.out ObjectAttribute: 0x00030072 CreatePrimary Succeed ! Handle: 0x80000000) |<br> > <br> > <br> > _______________________________________________<br> > tpm2 mailing list -- <a href="mailto:[email protected]" target="_blank">[email protected]</a><br> > To unsubscribe send an email to <a href="mailto:[email protected]" target="_blank">[email protected]</a><br> > %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s<br> > <br> <br> </blockquote></div></div>