1 --- b/internal/server/device/tpm.go
2 +++ a/internal/server/device/tpm.go
7 + proc, err := subprocess.NewProcess("swtpm", []string{"socket", "--tpm2", "--tpmstate", fmt.Sprintf("dir=%s", tpmDevPath), "--ctrl", fmt.Sprintf("type=unixio,path=%s", socketPath)}, "", "")
8 - proc, err := subprocess.NewProcess("swtpm", []string{"socket", "--tpm2", "--tpmstate", fmt.Sprintf("dir=%s", tpmDevPath), "--ctrl", fmt.Sprintf("type=unixio,path=swtpm-%s.sock", d.name)}, "", "")
13 - proc.Cwd = tpmDevPath
15 // Start the TPM emulator.
16 err = proc.Start(context.Background())
18 --- b/internal/server/instance/drivers/driver_qemu.go
19 +++ a/internal/server/instance/drivers/driver_qemu.go
23 if len(runConf.TPMDevice) > 0 {
24 + err = d.addTPMDeviceConfig(&cfg, runConf.TPMDevice)
25 - err = d.addTPMDeviceConfig(&cfg, runConf.TPMDevice, fdFiles)
33 +func (d *qemu) addTPMDeviceConfig(cfg *[]cfgSection, tpmConfig []deviceConfig.RunConfigItem) error {
34 -func (d *qemu) addTPMDeviceConfig(cfg *[]cfgSection, tpmConfig []deviceConfig.RunConfigItem, fdFiles *[]*os.File) error {
35 var devName, socketPath string
37 for _, tpmItem := range tpmConfig {
38 @@ -4863,16 +4863,9 @@
42 - fd, err := unix.Open(socketPath, unix.O_PATH, 0)
47 - tpmFD := d.addFileDescriptor(fdFiles, os.NewFile(uintptr(fd), socketPath))
49 tpmOpts := qemuTPMOpts{
52 - path: fmt.Sprintf("/proc/self/fd/%d", tpmFD),
54 *cfg = append(*cfg, qemuTPM(&tpmOpts)...)
56 --- b/shared/subprocess/proc.go
57 +++ a/shared/subprocess/proc.go
59 Name string `yaml:"name"`
60 Args []string `yaml:"args,flow"`
61 Apparmor string `yaml:"apparmor"`
62 - Cwd string `yaml:"cwd"`
63 PID int64 `yaml:"pid"`
64 Stdin io.ReadCloser `yaml:"-"`
65 Stdout io.WriteCloser `yaml:"-"`
69 cmd.SysProcAttr = p.SysProcAttr
75 if cmd.SysProcAttr == nil {
76 cmd.SysProcAttr = &syscall.SysProcAttr{}