Transfer TPM locality info in the ring structure
Subsystems (2)
PATCH 1/1 Transfer TPM locality info in the ring structure
Transfer TPM locality information in the ring structure. Add a version identifier to the ring structure for possible future extensions.
drivers/char/tpm/tpm_vtpm.c +2 -0
@@ -307,6 +307,7 @@ static int vtpm_send(struct tpm_chip *ch rc =vtpm_vd_send (vtpms->tpm_private, buf, count, +0 , t);/* * The generic TPM driver will call
@@ -368,6 +369,7 @@ static int _vtpm_send_queued(struct tpm_ rc =vtpm_vd_send (vtpms->tpm_private, qt->request, qt->request_len, +0 , qt);if (rc <0 ) {
drivers/char/tpm/tpm_vtpm.h +1 -1
@@ -35,7 +35,7 @@ enum vdev_status {/* this function is called from tpm_vtpm.c */ int vtpm_vd_send (struct tpm_private * tp, -const u8 * buf,size_t count,void *ptr); +const u8 * buf,size_t count,u8 locality,void *ptr);/* these functions are offered by tpm_vtpm.c */ struct tpm_chip *init_vtpm(struct device *,
drivers/char/tpm/tpm_xen.c +7 -4
@@ -98,7 +98,7 @@ static void tpmif_set_connected_state(st u8 newstate);static int tpm_xmit (struct tpm_private *tp,const u8 * buf,size_t count,int userbuffer, -void *remember); +u8 locality,void *remember);static void destroy_tpmring (struct tpm_private *tp); void __exit tpmif_exit(void);
@@ -211,12 +211,12 @@ static DEFINE_MUTEX(suspend_lock);* Send data via this module by calling this function */ int vtpm_vd_send (struct tpm_private *tp, -const u8 * buf,size_t count,void *ptr) +const u8 * buf,size_t count,u8 locality,void *ptr) {int sent;mutex_lock (&suspend_lock); - sent =tpm_xmit (tp, buf, count,0 , ptr); + sent =tpm_xmit (tp, buf, count,0 , locality, ptr);mutex_unlock (&suspend_lock);return sent;
@@ -239,6 +239,7 @@ static int setup_tpmring(struct xenbus_dxenbus_dev_fatal (dev, -ENOMEM ,"allocating shared ring" );return -ENOMEM ; } +memset (sring,0 ,PAGE_SIZE ); tp->tx = sring; err =xenbus_grant_ring (dev,virt_to_mfn (tp->tx));
@@ -573,7 +574,7 @@ static irqreturn_t tpmif_int(int irq, vostatic int tpm_xmit (struct tpm_private *tp,const u8 * buf,size_t count,int isuserbuffer, -void *remember) +u8 locality,void *remember) {tpmif_tx_request_t *tx;TPMIF_RING_IDX i;
@@ -617,6 +618,8 @@ static int tpm_xmit(struct tpm_private * tx = &tp->tx->ring[i].req; tx->addr =virt_to_machine (txb->data); tx->size = txb->len; + tx->version =1 ; + tx->locality = locality; DPRINTK("First 4 characters sent by TPM-FE are " "0x%02x 0x%02x 0x%02x 0x%02x\n",
drivers/xen/tpmback/tpmback.c +16 -2
@@ -298,6 +298,18 @@ int _packet_write(struct packet *pak,return rc; } + +static u8 get_locty_ring (tpmif_t *tpmif) +{ +tpmif_tx_request_t *tx = &tpmif->tx->ring[0 ].req; + +if (tx->version ==1 ) +return tx->locality; + +return 0 ; +} + +/* * Read data from the shared memory and copy it directly into the * provided buffer. Advance the read_last indicator which tells
@@ -319,9 +331,11 @@ static int packet_read(struct packet *paif (pak->last_read <4 ) {/* -* copy the instance number into the buffer +* copy the instance number into the buffer along +* with locality information. */ -u32 instance_no =htonl (pak->tpm_instance); +u32 instance_no =htonl (pak->tpm_instance | +get_locty_ring (pak->tpmif) <<29 );u32 last_read = pak->last_read; to_copy =min_t (size_t,4 - last_read, numbytes);
include/xen/interface/io/tpmif.h +2 -1
@@ -39,7 +39,8 @@ struct tpmif_tx_request {struct tpmif_tx_request {unsigned long addr;/* Machine address of packet. */ grant_ref_t ref;/* grant table access reference */ -uint16_t unused; +uint8_t version;/* version of block */ +uint8_t locality;/* locality for command */ uint16_t size;/* Packet size in bytes. */ };typedef struct tpmif_tx_request tpmif_tx_request_t ;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
RE: [PATCH] [Linux] Transfer TPM locality info in the ringstructure
Quoted 4 lines · Stefan Berger
Transfer TPM locality information in the ring structure. Add a version identifier to the ring structure for possible future extensions.
Signed-off-by Stefan Berger <[email protected]>
Stefan,
How do you expect to use the locality value and how would it get set (to a non-zero value)?
Since the locality value is provided by the originating domain, it can't really be "trusted" by the backend without some other type of validation.
Joe
RE: [PATCH] [Linux] Transfer TPM locality info in the ringstructure
"Cihula, Joseph" <[email protected]> wrote on 01/03/2008 08:48:41 PM:
Quoted 10 lines · Stefan Berger
Quoted 4 lines
Transfer TPM locality information in the ring structure. Add a version identifier to the ring structure for possible future extensions.
Signed-off-by Stefan Berger <[email protected]>Stefan,
How do you expect to use the locality value and how would it get set (to a non-zero value)?
The TIS interface offers the different address ranges for using a locality. A TIS driver can make the localities available through an ioctl(). A similar ioctl() could exist for the xen driver that allows the client to choose which locality to use.
Quoted 4 lines
Since the locality value is provided by the originating domain, it can't really be "trusted" by the backend without some other type of validation.
Except for maybe checking that the value of the locality is not out of range I don't see what else would need to be checked or is there maybe some restriction for an OS to let applications use any other locality than locality '0'?
Stefan
Quoted 2 lines
Joe
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
RE: [PATCH] [Linux] Transfer TPM locality info in theringstructure
I think you have lost some of the characteristics of locality in this mechanism, and while I'm not sure what the precise ramifications of this are, I am sure that redefining the characteristics of part of TPM access control mechanism shouldn't be done without careful analysis first.
1) Some localities are protected by the chipset, not the software running on a machine. Locality 4 should only accessible by the Dynamic Root of Trust for Measurement (DRTM). We currently have no virtual DRTM, but if we did, it would need to be outside of the VM's OS in order to satisfy even the loosest interpretation of the TCG DRTM definitions. With the driver specifying the locality, I'm not sure how you will be able limit access to locality 4 to only this "external" DRTM. Locality 3 also has special considerations.
2) TPM Localities are independent from each other. By putting each locality on it's own page, standard memory protection mechanisms can enable different execution contexts to access the appropriate locality and no other. In your mechanism, any driver that can access the shared page can set any locality it wants. This forces us down a different use model of having a single trusted driver who sets locality based on the caller. This leads to a whole different set of questions. How will the trusted driver identify which locality is appropriate based on the caller? An ioctl won't give you this. A locality should be assignable to any arbitrary execution context. What does this all mean for applications that expect the traditional TPM model for localities?
I think in order to keep the characteristics of the TPM locality model, we'd need to have 4 shared pages. The Linux driver only needs to support 1 locality, but flexibility to program it to point it at any locality 0-2 on initialization may be valuable. If a virtual machine wants to use multiple localities, it should have multiple TPM drivers (one per locality), just like TCG forces for physical machines. A more privileged piece of code like a VMM or a trusted reference monitor would use memory protection mechanisms to ensure each driver can only access the correct locality page. How the software running in the VM chooses to create these guarantees is up to them, just like in a physical machine. The locality 4 page would always be inaccessible to code running in the VM. Only some external DRTM code invoked by a hyper call or something would be able to access the locality 4 page.
-Vinnie Scarlata
_____
From: [email protected] [mailto:[email protected]] On Behalf Of Stefan Berger
Sent: Thursday, January 03, 2008 6:26 PM
To: Cihula, Joseph
Cc: [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH] [Linux] Transfer TPM locality info in theringstructure
"Cihula, Joseph" <[email protected]> wrote on 01/03/2008 08:48:41 PM:
Quoted 2 lines · Stefan Berger
Quoted 1 line
Transfer TPM locality information in the ring structure. Add a
version
Quoted 7 lines
Quoted 3 lines
identifier to the ring structure for possible future extensions.
Signed-off-by Stefan Berger <[email protected]>Stefan,
How do you expect to use the locality value and how would it get set
(to
Quoted 1 line
a non-zero value)?
The TIS interface offers the different address ranges for using a locality. A TIS driver can make the localities available through an ioctl(). A similar ioctl() could exist for the xen driver that allows the client to choose which locality to use.
Quoted 2 lines
Since the locality value is provided by the originating domain, it
can't
Quoted 2 lines
really be "trusted" by the backend without some other type of validation.
Except for maybe checking that the value of the locality is not out of range I don't see what else would need to be checked or is there maybe some restriction for an OS to let applications use any other locality than locality '0'?
Stefan
Quoted 2 lines
Joe
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
RE: [PATCH] [Linux] Transfer TPM locality info in theringstructure
"Scarlata, Vincent R" <[email protected]> wrote on 01/04/2008 04:44:42 AM:
Quoted 6 lines
I think you have lost some of the characteristics of locality in this mechanism, and while I'm not sure what the precise ramifications of this are, I am sure that redefining the characteristics of part of TPM access control mechanism shouldn't be done without careful analysis first.
Quoted 8 lines
1) Some localities are protected by the chipset, not the software running on a machine. Locality 4 should only accessible by the Dynamic Root of Trust for Measurement (DRTM). We currently have no virtual DRTM, but if we did, it would need to be outside of the VM's OS in order to satisfy even the loosest interpretation of the TCG DRTM definitions. With the driver specifying the locality, I'm not sure how you will be able limit access to locality 4 to only this "external" DRTM. Locality 3 also has special considerations.
To protect against usage of locality 4 the backend could be used to check for this by either changing it to a value higher than 4 and let the TPM respond with an error message or send an error itself.
Quoted 13 lines
2) TPM Localities are independent from each other. By putting each locality on it's own page, standard memory protection mechanisms can enable different execution contexts to access the appropriate locality and no other. In your mechanism, any driver that can access the shared page can set any locality it wants. This forces us down a different use model of having a single trusted driver who sets locality based on the caller. This leads to a whole different set of questions. How will the trusted driver identify which locality is appropriate based on the caller? An ioctl won't give you this. A locality should be assignable to any arbitrary execution context. What does this all mean for applications that expect the traditional TPM model for localities?
What this seems to mean is that to properly export the TIS functionality one driver per locality is needed because otherwise the functionality offered though the TIS interface is not correctly exported to applications. I am not sure that different /dev/tpm0..<n> would offer the protection you mention since this would set locality by just choosing another chardev.
Quoted 5 lines
I think in order to keep the characteristics of the TPM locality model, we'd need to have 4 shared pages. The Linux driver only needs to support 1 locality, but flexibility to program it to point it at any locality 0-2 on initialization may be valuable. If a virtual
Ok, so locality should be a parameter to the vtpm line in the vm config file.
Stefan
Quoted 24 lines
machine wants to use multiple localities, it should have multiple TPM drivers (one per locality), just like TCG forces for physical machines. A more privileged piece of code like a VMM or a trusted reference monitor would use memory protection mechanisms to ensure each driver can only access the correct locality page. How the software running in the VM chooses to create these guarantees is up to them, just like in a physical machine. The locality 4 page would always be inaccessible to code running in the VM. Only some external DRTM code invoked by a hyper call or something would be able to access the locality 4 page.
-Vinnie Scarlata
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Stefan Berger
Sent: Thursday, January 03, 2008 6:26 PM
To: Cihula, Joseph
Cc: [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH] [Linux] Transfer TPM locality info in theringstructure
Quoted 1 line
"Cihula, Joseph" <[email protected]> wrote on 01/03/2008 08:48:41
PM:
Quoted 3 lines
Quoted 3 lines · Stefan Berger
Quoted 1 line
Transfer TPM locality information in the ring structure. Add a
version
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
identifier to the ring structure for possible future extensions.
Signed-off-by Stefan Berger <[email protected]>Stefan,
How do you expect to use the locality value and how would it get set
(to
Quoted 9 lines
Quoted 1 line
a non-zero value)?
The TIS interface offers the different address ranges for using a locality. A TIS driver can make the localities available through an
ioctl(). A similarioctl()could exist for the xen driver that allows the client to choose which locality to use.Quoted 2 lines
Since the locality value is provided by the originating domain, it
can't
Quoted 12 lines
Quoted 2 lines
really be "trusted" by the backend without some other type of validation.
Except for maybe checking that the value of the locality is not out of range I don't see what else would need to be checked or is there maybe some restriction for an OS to let applications use any other locality than locality '0'?
Stefan
Quoted 2 lines
Joe
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
RE: [PATCH] [Linux] Transfer TPM locality info in theringstructure
"Stefan Berger" <[email protected]> wrote on Friday, January 04, 2008 6:13 AM:
Quoted 1 line
"Scarlata, Vincent R" <[email protected]> wrote on
01/04/2008 04:44:42 AM:
Quoted 16 lines
Quoted 7 lines
I think you have lost some of the characteristics of locality in this mechanism, and while I'm not sure what the precise ramifications of this are, I am sure that redefining the characteristics of part of TPM access control mechanism shouldn't be done without careful analysis first.
Quoted 8 lines
1) Some localities are protected by the chipset, not the software running on a machine. Locality 4 should only accessible by the Dynamic Root of Trust for Measurement (DRTM). We currently have no virtual DRTM, but if we did, it would need to be outside of the VM's OS in order to satisfy even the loosest interpretation of the TCG DRTM definitions. With the driver specifying the locality, I'm not sure how you will be able limit access to locality 4 to only this "external" DRTM. Locality 3 also has special considerations.
Quoted 1 line
To protect against usage of locality 4 the backend could be used to
check for
Quoted 1 line
this by either changing it to a value higher than 4 and let the TPM
respond
Quoted 17 lines
with an error message or send an error itself.
Quoted 7 lines
2) TPM Localities are independent from each other. By putting each locality on it's own page, standard memory protection mechanisms can enable different execution contexts to access the appropriate locality and no other. In your mechanism, any driver that can access the shared page can set any locality it wants. This forces us down a
Quoted 7 lines
different use model of having a single trusted driver who sets locality based on the caller. This leads to a whole different set of questions. How will the trusted driver identify which locality is appropriate based on the caller? An ioctl won't give you this. A locality should be assignable to any arbitrary execution context. What does this all mean for applications that expect the traditional TPM model for localities?
Quoted 1 line
What this seems to mean is that to properly export the TIS
functionality one
Quoted 1 line
driver per locality is needed because otherwise the functionality
offered
Quoted 1 line
though the TIS interface is not correctly exported to applications. I
am not
Quoted 1 line
sure that different /dev/tpm0..<n> would offer the protection you
mention
Quoted 1 line
since this would set locality by just choosing another chardev.
Per-app/user access can be constrained by ACLs/MAC/etc.
This is the approach that we submitted patches to LKML for. It requires the least changes all-around.
Quoted 6 lines
Quoted 4 lines
I think in order to keep the characteristics of the TPM locality model, we'd need to have 4 shared pages. The Linux driver only needs to support 1 locality, but flexibility to program it to point it at any locality 0-2 on initialization may be valuable. If a virtual
Ok, so locality should be a parameter to the vtpm line in the vm
config file.
This would be sufficient if each VM only needed to access a single locality. Given that each VM gets its own virtual TPM, I'm not sure what the value of single non-zero locality is. However, I think that it would be useful to support the model of multiple driver instances within a VM, each for a different locality.
Quoted 28 lines
Stefan
Quoted 25 lines
machine wants to use multiple localities, it should have multiple TPM drivers (one per locality), just like TCG forces for physical machines. A more privileged piece of code like a VMM or a trusted reference monitor would use memory protection mechanisms to ensure each driver can only access the correct locality page. How the software running in the VM chooses to create these guarantees is up to them, just like in a physical machine. The locality 4 page would always be inaccessible to code running in the VM. Only some external DRTM code invoked by a hyper call or something would be able to access the locality 4 page.
-Vinnie Scarlata
From: [email protected] [mailto:xen-devel- [email protected]] On Behalf Of Stefan Berger
Sent: Thursday, January 03, 2008 6:26 PM
To: Cihula, Joseph
Cc: [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH] [Linux] Transfer TPM locality info in theringstructure"Cihula, Joseph" <[email protected]> wrote on 01/03/2008
08:48:41 PM:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Stefan Berger
Quoted 1 line
Transfer TPM locality information in the ring structure. Add a
version
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
identifier to the ring structure for possible future extensions.
Signed-off-by Stefan Berger <[email protected]>Stefan,
How do you expect to use the locality value and how would it get
set (to
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
a non-zero value)?
The TIS interface offers the different address ranges for using a locality. A TIS driver can make the localities available through an
ioctl(). A similarioctl()could exist for the xen driver that allows the client to choose which locality to use.Quoted 2 lines
Since the locality value is provided by the originating domain, it
can't
Quoted 12 lines
Quoted 12 lines
Quoted 2 lines
really be "trusted" by the backend without some other type of validation.
Except for maybe checking that the value of the locality is not out of range I don't see what else would need to be checked or is there maybe some restriction for an OS to let applications use any other locality than locality '0'?
Stefan
Quoted 2 lines
Joe