Skip to contentSkip to conversation

TPM emulator driver status

DISCUSSION David Howells 5 participants 13 messages Jan 13, 2016 – Jan 15, 2016 7 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi Peter, Jarkko,

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

Thanks,
David

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

A message that is not in the archive (sent off-list or not yet received): 11083.1452692382-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org

#2 lore raw
Quoted 4 lines · David Howells

Hi Peter, Jarkko,

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

I'm not Peter or Jarkko, but I maintain the TPM emulator for both TPM 1.2 and TPM 2.0.

TPM 1.2 is very stable. The changes in the last 5 years have been minor. More tracing, spelling errors in comments, etc.

TPM 2.0 is functional, but lacks the maturity and stability of the 1.2 code. I do track the 2.0 specification updates.

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

#3 lore raw

Hi Ken,

Quoted 10 lines

Gesendet: Mittwoch, 13. Januar 2016 um 06:35 Uhr
Von: "Ken Goldman" <kgoldman-r/[email protected]>
An: [email protected]
Betreff: Re: [tpmdd-devel] TPM emulator driver status

Quoted 4 lines · David Howells

Hi Peter, Jarkko,

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

Quoted 8 lines

I'm not Peter or Jarkko, but I maintain the TPM emulator for both TPM 1.2 and TPM 2.0.

TPM 1.2 is very stable. The changes in the last 5 years have been minor. More tracing, spelling errors in comments, etc.

TPM 2.0 is functional, but lacks the maturity and stability of the 1.2 code. I do track the 2.0 specification updates.

What are you exactly refering to? Urls?
David meant the kernel code probably.

Thanks,
Peter

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

#4 lore raw
In reply to a message not in the archive

David Howells <[email protected]> wrote on 01/13/2016 08:39:42 AM:

Quoted 4 lines

Hi Peter, Jarkko,

Is the TPM emulator likely to go upstream at any point? Or is it

waiting for

Quoted 1 line

some sort of update?

David,

I wrote a driver for support of (v)TPM for containers. It has ioctl's for creating and deleting of pairs of devices where one device is used by clients and the other end is used by a TPM emulator to listen for commands. The client device can be 'moved' in the container, meaning a device node with the same major/minor numbers is created inside a container. Any number of such device pairs can be create. Does this driver sound like it would provide more functionality than yours and would it address your use case as well?

Stefan

Quoted 5 lines

Thanks,
David

------------------------------------------------------------------------------

Quoted 10 lines

Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

#5 lore raw
In reply to a message not in the archive

Hi David,

Quoted 4 lines · David Howells

Hi Peter, Jarkko,

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

Saw Kens response and to make sure that we are talking about the same thing we are probably speaking about your patches that currently reside over here:

https://github.com/PeterHuewe/linux-tpmdd/commits/tpm-emulator

and not about anything that actually emulates directly a TPM.

These are my concerns:

* Should be probably broken into two patches with include/linux/wait.h modifications residing in a separate commit.
* Should the module be renamed as something else than tpm_user_emul? It's not a TPM emulator but more like a proxy.
* I have to admit that I haven't deeply dived into functionality that vTPM provides. What does it provide exactly? Does this overlap?

Quoted 2 lines

Thanks,
David

/Jarkko

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

#6 lore raw
In reply to a message not in the archive

Hi David,

Quoted 10 lines

Gesendet: Mittwoch, 13. Januar 2016 um 05:39 Uhr
Von: "David Howells" <[email protected]>
An: "Peter Huewe" <[email protected]>, "Jarkko Sakkinen" <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected]
Betreff: TPM emulator driver status
Hi Peter, Jarkko,

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

you mean the tpm user emul driver you wrote a while ago? Didn't we decide to not upstream it?

Honestly I'm lacking a bit behind on rebasing it on the latest tree.

But maybe it makes sense (e.g. for testing) to upstream it and mark it developers only.

Peter

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

#7 lore raw
Quoted 13 lines · Peter Huewe

Hi David,

Quoted 10 lines

Gesendet: Mittwoch, 13. Januar 2016 um 05:39 Uhr
Von: "David Howells" <[email protected]>
An: "Peter Huewe" <[email protected]>, "Jarkko Sakkinen" <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected]
Betreff: TPM emulator driver status
Hi Peter, Jarkko,

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

Quoted 7 lines

you mean the tpm user emul driver you wrote a while ago? Didn't we decide to not upstream it?

Honestly I'm lacking a bit behind on rebasing it on the latest tree.

But maybe it makes sense (e.g. for testing) to upstream it and mark it developers only.

I have also have a faint memory that there was a decision to not upstream "for now".

Quoted 1 line

Peter

/Jarkko

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 4 lines · Jarkko Sakkinen
Quoted 2 lines

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

Saw Kens response

Ken? Do you mean Stefan? Or have I missed something?

Quoted 4 lines

and to make sure that we are talking about the same thing we are probably speaking about your patches that currently reside over here:

https://github.com/PeterHuewe/linux-tpmdd/commits/tpm-emulator

Yes.

Quoted 1 line

and not about anything that actually emulates directly a TPM.

Sorry, you're right: it's an interface across to a userspace TPM.

Quoted 4 lines

These are my concerns:

* Should be probably broken into two patches with include/linux/wait.h modifications residing in a separate commit.

That would be fine.

Quoted 2 lines

* Should the module be renamed as something else than tpm_user_emul? It's not a TPM emulator but more like a proxy.

tpm_user_proxy maybe?

Quoted 2 lines

* I have to admit that I haven't deeply dived into functionality that vTPM provides. What does it provide exactly? Does this overlap?

That I can't answer at this point without looking into it.

David

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

A message that is not in the archive (sent off-list or not yet received): 25057.1452778946-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org

#11 lore raw
Quoted 8 lines · David Howells
Quoted 4 lines · Jarkko Sakkinen
Quoted 2 lines

Is the TPM emulator likely to go upstream at any point? Or is it waiting for some sort of update?

Saw Kens response

Ken? Do you mean Stefan? Or have I missed something?

Ken replied that he was maintaining TPM 1.x and TPM 2.0 emulators but I guess he was talking about actual user space emulators.

Quoted 16 lines
Quoted 4 lines

and to make sure that we are talking about the same thing we are probably speaking about your patches that currently reside over here:

https://github.com/PeterHuewe/linux-tpmdd/commits/tpm-emulator

Yes.

Quoted 1 line

and not about anything that actually emulates directly a TPM.

Sorry, you're right: it's an interface across to a userspace TPM.

Quoted 4 lines

These are my concerns:

* Should be probably broken into two patches with include/linux/wait.h modifications residing in a separate commit.

Quoted 6 lines

That would be fine.

Quoted 2 lines

* Should the module be renamed as something else than tpm_user_emul? It's not a TPM emulator but more like a proxy.

tpm_user_proxy maybe?

That's much better name (or maybe just tpm_proxy).

Quoted 6 lines
Quoted 2 lines

* I have to admit that I haven't deeply dived into functionality that vTPM provides. What does it provide exactly? Does this overlap?

That I can't answer at this point without looking into it.

David

/Jarkko

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

A message that is not in the archive (sent off-list or not yet received): 201601131436.u0DEaIdD015610-nNA/[email protected]

#13 lore raw
Quoted 7 lines · Stefan Berger

I wrote a driver for support of (v)TPM for containers. It has ioctl's for creating and deleting of pairs of devices where one device is used by clients and the other end is used by a TPM emulator to listen for commands. The client device can be 'moved' in the container, meaning a device node with the same major/minor numbers is created inside a container. Any number of such device pairs can be create. Does this driver sound like it would provide more functionality than yours and would it address your use case as well?

Maybe. Is it accessible through the /dev/tpm<N> just like a h/w tpm? And can it be accessed by in-kernel services that use a tpm?

David

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

A message that is not in the archive (sent off-list or not yet received): 25224.1452779110-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org

#15 lore raw

David Howells <[email protected]> wrote on 01/14/2016 08:45:10 AM:

Quoted 3 lines
Quoted 1 line · Stefan Berger

I wrote a driver for support of (v)TPM for containers. It has ioctl's

for

Quoted 1 line
Quoted 1 line

creating and deleting of pairs of devices where one device is usedby

clients

Quoted 3 lines
Quoted 1 line

and the other end is used by a TPM emulator to listen for

commands. The client

Quoted 1 line

device can be 'moved' in the container, meaning a device node with the

same

Quoted 1 line
Quoted 1 line

major/minor numbers is created inside a container. Any number of such

device

Quoted 4 lines
Quoted 2 lines

pairs can be create. Does this driver sound like it would provide more functionality than yours and would it address your use case as well?

Maybe. Is it accessible through the /dev/tpm<N> just like a h/w tpm?

And can

Quoted 1 line

it be accessed by in-kernel services that use a tpm?

Yes to all of the questions.

The primary target is integration with namespaced IMA and making vTPMs available to each namespaced IMA. However, having the vTPM hooked up to IMA is an extra ioctl that has to be issued at the right moment (essentially before clone()) and is not necessary except for container use-cases. So let me explain how the basic part works.

Using an ioctl, a new device pair is spawned. The core TPM device driver creates /dev/vtpmcX (with X = 0...), which is just another name for /dev/tpm0. I gave it a different name to be able to distinguish the potentially many drivers from h/w tpm /dev/tpmZ (Z = 0...). Also a backend is created by that driver, with a device called /dev/vtpmsY (Y = 0...) . One places a software TPM emulator on this one and have it listen for commands that are sent into /dev/vtpmcX. If there's no software TPM listening on that device, all commands sent to the backend will receive a -EIO. So we have this connected device pair /dev/vtpmsY and /dev/vtpmcX, a server and a client side. Another ioctl can delete the device pair unless the backend is busy.

The above is added by a first series of patches. I can post them today. Subsequent patches would add support for hooking the device pair to IMA namespace...

So there's no device pair unless someone was to issue the ioctl. Then kernel services would be able to find the device using tpm_chip_find_get(int chip_num) and call the normal APIs to send TPM command, though shouldn't do that before the swtpm has been started to listen on the server side, otherwise they will get -EIO's.

There's a function call that could probably also create such a device pair during kernel startup or maybe conditionally if no hardware device is available. Preferably we would leave this up to user space to handle this via the ioctl.

A TPM device that I have been using for this setup is here :

https://github.com/stefanberger/swtpm

swtpm chardev --tpmstate dir=<dir> -c /dev/vtpms1 [other options] can be used to start a TPM emulator listening for commands on /dev/vtpmsY. Since the TPM emulator behave just like a h/w TPM, one still needs to simulate the BIOS initialization of the TPM using the tool swtpm_bios run on /dev/vtpmcX.

So I don't want to hold things up, but maybe this driver addresses your use case as well.

Stefan

Quoted 3 lines

David

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 201601141458.u0EEwsMi006753-4ZtxiNBBw+3ImUpY6SP3GEEOCMrvLtNR@public.gmane.org

#18 lore raw
Quoted 32 lines

Gesendet: Donnerstag, 14. Januar 2016 um 06:58 Uhr
Von: "Stefan Berger" <stefanb-r/[email protected]>
An: "David Howells" <[email protected]>
Cc: [email protected], "Jarkko Sakkinen" <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/[email protected]>, [email protected], "Peter Huewe" <[email protected]>, [email protected]
Betreff: Re: [tpmdd-devel] TPM emulator driver status
David Howells <[email protected]> wrote on 01/14/2016 08:45:10 AM:

Quoted 5 lines
Quoted 3 lines · Stefan Berger

I wrote a driver for support of (v)TPM for containers. It has ioctl's for creating and deleting of pairs of devices where one device is usedby clients and the other end is used by a TPM emulator to listen for

Quoted 8 lines

commands. The client

Quoted 4 lines

device can be 'moved' in the container, meaning a device node with the same major/minor numbers is created inside a container. Any number of such device pairs can be create. Does this driver sound like it would provide more functionality than yours and would it address your use case as well?

Maybe. Is it accessible through the /dev/tpm<N> just like a h/w tpm? And can it be accessed by in-kernel services that use a tpm?

Yes to all of the questions.

The primary target is integration with namespaced IMA and making vTPMs available to each namespaced IMA. However, having the vTPM hooked up to IMA is an extra ioctl that has to be issued at the right moment (essentially before clone()) and is not necessary except for container use-cases. So let me explain how the basic part works.

Using an ioctl, a new device pair is spawned. The core TPM device driver creates /dev/vtpmcX (with X = 0...), which is just another name for /dev/tpm0. I gave it a different name to be able to distinguish the potentially many drivers from h/w tpm /dev/tpmZ (Z = 0...). Also a backend is created by that driver, with a device called /dev/vtpmsY (Y = 0...) . One places a software TPM emulator on this one and have it listen for commands that are sent into /dev/vtpmcX. If there's no software TPM listening on that device, all commands sent to the backend will receive a -EIO. So we have this connected device pair /dev/vtpmsY and /dev/vtpmcX, a server and a client side. Another ioctl can delete the device pair unless the backend is busy.

The above is added by a first series of patches. I can post them today. Subsequent patches would add support for hooking the device pair to IMA namespace...

So there's no device pair unless someone was to issue the ioctl. Then kernel services would be able to find the device using tpm_chip_find_get(int chip_num) and call the normal APIs to send TPM command, though shouldn't do that before the swtpm has been started to listen on the server side, otherwise they will get -EIO's.

Quoted 8 lines

There's a function call that could probably also create such a device pair during kernel startup or maybe conditionally if no hardware device is available. Preferably we would leave this up to user space to handle this via the ioctl.

A TPM device that I have been using for this setup is here :

https://github.com/stefanberger/swtpm

swtpm chardev --tpmstate dir=<dir> -c /dev/vtpms1 [other options] can be used to start a TPM emulator listening for commands on /dev/vtpmsY. Since the TPM emulator behave just like a h/w TPM, one still needs to simulate the BIOS initialization of the TPM using the tool swtpm_bios run on /dev/vtpmcX.

Hmm, interesting.

I like David's driver since it is super simple to use, and works with the old Strasser's TPM Emulator for 1.2 and with the Microsoft TPM Simulator for 2.0.

Have you tested one or the other with your approach?

I'm not 100% sure about the different name for the tpm emulation, as quite some software relies on the /dev/tpmZ naming - e.g. for testing it would be good to not be able to distinguish them. So I have the exact same runs on machines with a emulated tpm and with a real hw one.
BUT on the other hand I think it's good to distinguish both (somehow, maybe a sysfs attribute?).

Honestly I'm lacking a bit behind on the vTPM stuff. Would this work on a regular x86 machine?

Thanks,
Peter

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

#19 lore raw

"Peter Huewe" <[email protected]> wrote on 01/14/2016 02:28:14 PM:

Quoted 9 lines

Hmm, interesting.

I like David's driver since it is super simple to use, and works with the old Strasser's TPM Emulator for 1.2 and with the Microsoft TPM Simulator for 2.0.

Have you tested one or the other with your approach?

No, I haven't, since we have our of TPM 1.2 implementation. The referenced swtpm (and libtpms) projects will at some point be extended with TPM 2.

Quoted 10 lines

I'm not 100% sure about the different name for the tpm emulation, as quite some software relies on the /dev/tpmZ naming - e.g. for testing it would be good to not be able to distinguish them. So I have the exact same runs on machines with a emulated tpm and with a real hw one.
BUT on the other hand I think it's good to distinguish both (somehow, maybe a sysfs attribute?).

Quoted 2 lines

Honestly I'm lacking a bit behind on the vTPM stuff. Would this work on a regular x86 machine?

Yes.

Stefan

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel