Skip to content

Commit 5b7bb1f

Browse files
committed
vtpm: Pass startup-clear as part of flags to avoid kernel logging
We need to startup the TPM as part of starting swtpm so that the Linux driver can successfully send its initial command to the vTPM and does not log a failure and then do the startup itself. Signed-off-by: Stefan Berger <[email protected]>
1 parent fc8d5aa commit 5b7bb1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libcontainer/vtpm/vtpm.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,15 @@ func (vtpm *VTPM) startSwtpm() error {
532532
pidfile := fmt.Sprintf("file=%s", vtpm.getPidFile())
533533
logfile := fmt.Sprintf("file=%s", vtpm.getLogFile())
534534

535+
flags := "not-need-init"
536+
if hasCapability(vtpm.swtpmCaps, "flags-opt-startup") {
537+
flags += ",startup-clear"
538+
}
539+
535540
// child will get first passed fd as '3'
536541
cmd := exec.Command("swtpm", "chardev", "--tpmstate", tpmstate,
537542
"--daemon", "--fd", "3", "--pid", pidfile, "--log", logfile,
538-
"--runas", vtpm.user, "--flags", "not-need-init",
543+
"--runas", vtpm.user, "--flags", flags,
539544
"--locality", "reject-locality-4,allow-set-locality")
540545
if vtpm.Vtpmversion == VTPM_VERSION_2 {
541546
cmd.Args = append(cmd.Args, "--tpm2")

0 commit comments

Comments
 (0)