[tpm2] Re: tpm2_flushcontext stuck

Han <keepsimple at gmail.com>
Newsgroups dev.linux.lists.tpm2
Message-ID <CAEjGaqdLPaUicAeW-84_C2RRBvkPfXpufsQT_9zCHZf323303g@mail.gmail.com>
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> 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>
> *Sent:* Wednesday, December 15, 2021 5:56 PM
> *To:* tpm2(a)lists.01.org <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)
>
>
attachment.htm (text/html, 5.4 KB)
<div dir="ltr">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.  <div><br></div><div>$ sudo strace tpm2_flushcontext 0x80000000</div><div><br></div><div>&lt;snip&gt;</div><div><br></div><div>openat(AT_FDCWD, &quot;/etc/ld.so.cache&quot;, 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, &quot;/lib/arm-linux-gnueabihf/libtss2-tcti-device.so.0&quot;, O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3<br>read(3, &quot;\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&quot;..., 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, &quot;/dev/tpmrm0&quot;, O_RDWR|O_NONBLOCK) = 3<br>write(3, &quot;\200\1\0\0\0\f\0\0\1{\0\10&quot;, 12) = 12<br>poll([{fd=3, events=POLLIN}], 1, 1000)  = 1 ([{fd=3, revents=POLLIN}])<br>read(3, &quot;\200\1\0\0\0\24\0\0\0\0&quot;, 10)  = 10<br>poll([{fd=3, events=POLLIN}], 1, 1000)  = 1 ([{fd=3, revents=POLLIN}])<br>read(3, &quot;\0\10Z\314k~c`I\346&quot;, 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, &quot;\200\1\0\0\0\16\0\0\1s\200\0\0\0&quot;, 14) = 14<br>poll([{fd=3, events=POLLIN}], 1, -1<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 17, 2021 at 10:29 AM Roberts, William C &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; 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">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
That&#39;s weird, could you strace it and see where it&#39;s hanging?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
What kernel version is that? I&#39;m assuming your using the /dev/tpm0 or /dev/tpmrm0 device directly since I see the sudo.</div>
<div id="gmail-m_-6506513492750421582appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-6506513492750421582divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Han &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;<br>
<b>Sent:</b> Wednesday, December 15, 2021 5:56 PM<br>
<b>To:</b> <a href="mailto:[email protected]" target="_blank">[email protected]</a> &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;<br>
<b>Subject:</b> [tpm2] tpm2_flushcontext stuck</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>I&#39;m using tpm2-tools 5.0 in Debian 11 Bullseye based Raspberry Pi OS.  I&#39;m trying to run tpm2_flushcontext but the command got stuck and it&#39;s not showing anything. Is the data in TPM corrupted?  How can I check? </div>
<div><br>
</div>
<div>$ sudo tpm2_flushcontext 0x80000000<br>
</div>
<div>&lt; no output at all and stuck here &gt;</div>
<div><br>
</div>
<div>(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: </div>
<div><br>
</div>
<div>
<pre style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,&quot;SF Mono&quot;,Menlo,Consolas,&quot;Liberation Mono&quot;,monospace;font-size:11.9px;margin-top:0px;margin-bottom:16px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px;color:rgb(36,41,47)"><code style="box-sizing:border-box;font-family:ui-monospace,SFMono-Regular,&quot;SF Mono&quot;,Menlo,Consolas,&quot;Liberation Mono&quot;,monospace;font-size:11.9px;padding:0px;margin:0px;background:transparent;border-radius:6px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit">$ sudo tpm2_createprimary -H o -g sha256 -G ecc -C context.out
ObjectAttribute: 0x00030072

CreatePrimary Succeed ! Handle: 0x80000000) </code></pre>
</div>
</div>
</div>
</div>

</blockquote></div>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.