Bug 11080 - Enabling testing TPM(v1.2) Support on QEMU
Summary: Enabling testing TPM(v1.2) Support on QEMU
Status: RESOLVED FIXED
Alias: None
Product: IoT Reference OS Kit
Classification: Yocto Project Subprojects
Component: intel-iot-refkit-security (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium enhancement
Target Milestone: 2.3 M4
Assignee: Amaranth Valluri
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks: 11201
  Show dependency tree
 
Reported: 2017-02-20 08:15 UTC by Amaranth Valluri
Modified: 2017-04-18 07:31 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amaranth Valluri 2017-02-20 08:15:41 UTC
Using 'swtpm(Software TPM Emulator)' with QEMU is currently depends on  starting swtpm as root before each runqemu invocation. This is neither user-friendly nor compatible with some automated testing environments where 'no-root' is required. 

The reason for this is that swtpm emulates /dev/vtpm0 via CUSE (character device in user space) and needs root privileges for setting that up. qemu communicates with swtpm in two ways: 1) read/write calls 2) ioctl calls.

A better solution would be to connect qemu to swtpm through a unix domain datagram socket (no root rights needed). Read/write can work as before. ioctls could be mapped to out-of-band messages.
Comment 1 Amaranth Valluri 2017-04-10 11:00:18 UTC
Patch set submitted to upstream, currently under review:
http://lists.nongnu.org/archive/html/qemu-devel/2017-04/msg01287.html

From QEMU upstream getting some resistance against using of 'swtpm' for TPM emulation, as it is foreign project to qemu. And suggesting to define a private/protocol protocol specification. So it is not realistic that the current proposal accepted by upstream with in the M4 time frame.
Comment 2 Mikko Ylinen 2017-04-11 05:13:54 UTC
(In reply to comment #1)

> From QEMU upstream getting some resistance against using of 'swtpm' for TPM
> emulation, as it is foreign project to qemu. And suggesting to define a
> private/protocol protocol specification. So it is not realistic that the
> current proposal accepted by upstream with in the M4 time frame.

One may argue whether the upstream acceptance is a criteria to deliver this feature. I think not. Especially if we follow the dependency logic: it would not be possible to deliver bug #11070 either if this was not closed.

AFAICS, the swtpm part is done. Have you submitted a meta-security patch to update the SRCREV?

Also, the qemu part we'd need to maintain in a bbappend until the upstream patch is merged. The upstream status shall be tracked in the patch Upstream-Status.
Comment 3 Amaranth Valluri 2017-04-11 08:45:32 UTC
(In reply to comment #2)
> (In reply to comment #1)
> 
> > From QEMU upstream getting some resistance against using of 'swtpm' for TPM
> > emulation, as it is foreign project to qemu. And suggesting to define a
> > private/protocol protocol specification. So it is not realistic that the
> > current proposal accepted by upstream with in the M4 time frame.
> 
> One may argue whether the upstream acceptance is a criteria to deliver this
> feature. I think not. Especially if we follow the dependency logic: it would
> not be possible to deliver bug #11070 either if this was not closed.
> 
> AFAICS, the swtpm part is done. Have you submitted a meta-security patch to
> update the SRCREV?
I have submitted the PR:
https://lists.yoctoproject.org/pipermail/yocto/2017-April/035572.html
Comment 4 Mikko Ylinen 2017-04-18 07:28:57 UTC
Amarnath, this can be set to 'RESOLVED', IMO.
Comment 5 Amaranth Valluri 2017-04-18 07:31:58 UTC
swtpm/meta-security patches are merged to upstream, and qemu changes are submitted upstream and .bbappended in refkit.