From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it, linuxtestproject.agent@gmail.com
Subject: Re: [LTP] ima_tpm.sh: properly detect failure to verify the IMA measurement list
Date: Thu, 27 Aug 2026 12:22:52 +0200 [thread overview]
Message-ID: <20260827102252.GA442795@pevik> (raw)
In-Reply-To: <6a8fdf90.52a3ce3c.38dd62.6301@mx.google.com>
Hi Mimi, Andrea,
> Hi Mimi,
> > > + pcr_aggregate="$(cat tmp.txt | awk '{print $1}')"
> > The cat here is redundant, awk can read the file directly:
> This is valid.
+1, agent did a good job here :). We could even avoid using tail (awk has this
feature), but let's ignore that.
As it is trivial, I can change it before merge (see diff below).
> > > + lineno="$(cat tmp.txt | awk '{print $2}')"
> > Same here:
> > lineno="$(awk '{print $2}' tmp.txt)"
> [..]
> > > + tst_res TPASS "aggregate PCR value matched real PCR value (line: $lineno/$total_measurements)"
> > This line is about 100 columns wide. LTP shell style asks for lines
> > under 80 characters; perhaps wrap it or shorten the message.
> we can ignore this one.
We should teach agent that splitting quotes string does more harm than slightly
longer line.
> @Petr can you please take a look?
Sure :). FYI I already did have a brief look yesterday, and I also triggered CI
jobs for v1 and wait them to finish. Of course I'll rerun them for v2.
@Mimi FYI v1 patch triggers failure - it just calculate a different
aggregate PCR-10. Although the commit subject is "properly detect failure" ..
I'm not sure if this is a false negative or the current code on master just did
not find error (false positive). As I said, I'll rerun v2 and let you know if
it's the same.
Testing on openSUSE Tumbleweed x86_64 VM with kernel: 7.1.8-1, virtualized TPM
2.0, evmctl 1.6.2. Working master [1], broken with your patch [2].
FYI TPM 2.0 used:
swtpm socket --tpmstate dir=/tmp/mytpm25 --ctrl \
type=unixio,path=/tmp/mytpm25/swtpm-sock --log level=20 -d --tpm2
Whole QEMU command:
/usr/bin/qemu-system-x86_64 -device VGA,edid=on,xres=1024,yres=768 \
-only-migratable -chardev ringbuf,id=serial0,logfile=serial0,logappend=on \
-serial chardev:serial0 -audiodev none,id=snd0 -device intel-hda -device \
hda-output,audiodev=snd0 -global isa-fdc.fdtypeA=none -m 1536 -cpu host -netdev \
user,id=qanet0 -device virtio-net,netdev=qanet0,mac=52:54:00:12:34:56 -object \
rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \
-chardev socket,id=chrtpm,path=/tmp/mytpm25/swtpm-sock -tpmdev \
emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0 -boot order=c \
-device qemu-xhci -device usb-tablet -smp 1 -enable-kvm -no-shutdown -vnc \
:115,share=force-shared -device virtio-serial -chardev \
pipe,id=virtio_console,path=virtio_console,logfile=virtio_console.log,logappend=on \
-device \
virtconsole,chardev=virtio_console,name=org.openqa.console.virtio_console \
-chardev \
pipe,id=virtio_console_user,path=virtio_console_user,logfile=virtio_console_user.log,logappend=on \
-device \
virtconsole,chardev=virtio_console_user,name=org.openqa.console.virtio_console_user \
-chardev \
socket,path=qmp_socket,server=on,wait=off,id=qmp_socket,logfile=qmp_socket.log,logappend=on \
-qmp chardev:qmp_socket -S -device virtio-scsi-pci,id=scsi0 -blockdev \
driver=file,node-name=hd0-overlay0-file,filename=/var/lib/openqa/pool/25/raid/hd0-overlay0,cache.no-flush=on \
-blockdev \
driver=qcow2,node-name=hd0-overlay0,file=hd0-overlay0-file,cache.no-flush=on,discard=unmap \
-device virtio-blk,id=hd0-device,drive=hd0-overlay0,bootindex=0,serial=hd0 \
-blockdev \
driver=file,node-name=cd0-overlay0-file,filename=/var/lib/openqa/pool/25/raid/cd0-overlay0,cache.no-flush=on \
-blockdev \
driver=qcow2,node-name=cd0-overlay0,file=cd0-overlay0-file,cache.no-flush=on,discard=unmap \
-device scsi-cd,id=cd0-device,drive=cd0-overlay0,serial=cd0
Kind regards,
Petr
[1] https://openqa.opensuse.org/tests/6185158#step/ima_tpm/4
[2] https://openqa.opensuse.org/tests/6185106#step/ima_tpm/4
[3] https://openqa.opensuse.org/tests/6185106/file/autoinst-log.txt
diff --git testcases/kernel/security/integrity/ima/tests/ima_tpm.sh testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
index 8bb86ea4ac..edf8699f83 100755
--- testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
+++ testcases/kernel/security/integrity/ima/tests/ima_tpm.sh
@@ -295,7 +295,7 @@ test2()
get_pcr10_aggregate > tmp.txt
ret=$?
- pcr_aggregate="$(cat tmp.txt | awk '{print $1}')"
+ pcr_aggregate="$(awk '{print $1}' tmp.txt)"
if [ -z "$pcr_aggregate" ]; then
return
fi
@@ -304,7 +304,7 @@ test2()
if [ "$hash" = "$pcr_aggregate" ]; then
tst_res TPASS "aggregate PCR value matches real PCR value"
elif [ $ret -eq 0 ]; then
- lineno="$(cat tmp.txt | awk '{print $2}')"
+ lineno="$(awk '{print $2}' tmp.txt)"
if [ -z "$lineno" ]; then
return
fi
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-27 10:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 22:29 [LTP] [PATCH v2] ima_tpm.sh: properly detect failure to verify the IMA measurement list Mimi Zohar
2026-08-26 22:29 ` Mimi Zohar
2026-08-27 3:05 ` [LTP] " linuxtestproject.agent
2026-08-27 6:56 ` Andrea Cervesato via ltp
2026-08-27 10:22 ` Petr Vorel [this message]
2026-08-27 12:59 ` Petr Vorel
2026-08-27 13:38 ` Mimi Zohar
2026-09-10 19:41 ` [LTP] [PATCH v2] " Petr Vorel
2026-09-10 19:41 ` Petr Vorel
-- strict thread matches above, loose matches on Subject: below --
2026-08-26 0:34 [LTP] [PATCH] " Mimi Zohar
2026-08-26 1:15 ` [LTP] " linuxtestproject.agent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827102252.GA442795@pevik \
--to=pvorel@suse.cz \
--cc=andrea.cervesato@suse.com \
--cc=linuxtestproject.agent@gmail.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.