vTPM: event channel bind interdomain with para/hvm virtual machine
PATCH v2 1/5 vTPM: event channel bind interdomain with para/hvm virtual machine
--- extras/mini-os/include/tpmback.h | 3 +++ extras/mini-os/tpmback.c | 20 +++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-)
extras/mini-os/include/tpmback.h +3 -0
@@ -41,6 +41,9 @@ #ifndef TPMBACK_H #define TPMBACK_H +#define T_DOMAIN_TYPE_HVM 1 +#define T_DOMAIN_TYPE_PV 2 + struct tpmcmd { domid_t domid; /* Domid of the frontend */ uint8_t locality; /* Locality requested by the frontend */
extras/mini-os/tpmback.c +17 -3
@@ -555,7 +555,7 @@ int connect_fe(tpmif_t* tpmif) {char path[512 ];char * err, *value; -uint32_t domid; +uint32_t domid, domtype;grant_ref_t ringref;evtchn_port_t evtchn;
@@ -608,14 +608,28 @@ int connect_fe(tpmif_t* tpmif) }free (value); - domid = tpmif->domid; +/* get the domain type*/ +snprintf (path,512 ,"%s/domain-type" , tpmif->fe_path); +if ((err =xenbus_read (XBT_NIL , path, &value))) { +TPMBACK_ERR ("xenbus_read(%s) Error = %s" , path, err); +free (err); +return -1 ; + } +if (sscanf (value,"%d" , &domtype) !=1 ) { +TPMBACK_ERR ("Non integer value (%s) \n" , value); +free (value); +return -1 ; + } + +printk ("domtype = %d \n" ,domtype); + domid = (domtype ==T_DOMAIN_TYPE_HVM ) ?0 : tpmif->domid;if ((tpmif->page =gntmap_map_grant_refs (>pmdev.map,1 , &domid,0 , &ringref,PROT_READ |PROT_WRITE )) ==NULL ) {TPMBACK_ERR ("Failed to map grant reference %u/%u\n" , (unsigned int ) tpmif->domid, tpmif->handle);return -1 ; }/*Bind the event channel */ -if ((evtchn_bind_interdomain (tpmif->domid, evtchn, tpmback_handler, tpmif, &tpmif->evtchn))) +if ((evtchn_bind_interdomain (domid, evtchn, tpmback_handler, tpmif, &tpmif->evtchn))) {TPMBACK_ERR ("%u/%u Unable to bind to interdomain event channel!\n" , (unsigned int ) tpmif->domid, tpmif->handle); goto error_post_map;
Signature · 1 line
1.8.3.2
On 12/30/2014 11:44 PM, Quan Xu wrote:[...]
Quoted 1 line
extras/mini-os/tpmback.c +0
-0
[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
Signature · 2 lines
Daniel De Graaf National Security Agency
Quoted 10 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Tuesday, January 06, 2015 12:06 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machine
Quoted 9 lines
On 12/30/2014 11:44 PM, Quan Xu wrote:[...]
Quoted 1 line
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0.
as similar to Linux PV frontend driver, this frontend driver is enabled in QEMU.
*ARCHITECTURE*
The architecture of stubdom vTPM for HVM virtual machine:
+--------------------+
| Windows/Linux DomU | ... (tpm_tis.ko)
| | ^ |
| v | |
| Qemu tpm1.2 Tis | (Seabios patch will enable this TPM 1.2 TIS, including ACPI for 0xfed40000 -- / register enables)
| | ^ | (Seabios, I did not send out, maybe this is the missed.)
| v | |
| XenStubdoms backend|
+--------------------+
| ^ (XenStubdoms backend/ XenDevOps are QEMU parts provide the glue for the TPM_TIS(Qemu frontend) to Xen
stubdom vTPM domain)
v |
+--------------------+
| XenDevOps |
+--------------------+
| ^
v |
+--------------------+
| mini-os/tpmback |Any doubt, feel free to contact. I will try my best to explain. I think your suggestions are very helpful in previous email(Oct. 31th, 2014. ' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine')
Maybe this is still a vague description :(
BTW, professor J. Wang(Wuhan University, China) and I have enabled TPM 2.0 simulator for Linux, Maybe we will try to integrate with vtpm domain to provide TPM 2.0 vtpm function for virtual machine in Q2 or later.
Thanks
Quan Xu
Quoted 3 lines
--
Daniel De Graaf
National Security Agency
Quoted 1 line · Xu, Quan, le Tue 06 Jan 2015 16:46:58 +0000, a écrit :
QEMU is running in Dom0 as usual, so the domid is 0.
One can also run the HVM QEMU inside a stubdomain.
Samuel
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Samuel Thibault
Sent: Wednesday, January 07, 2015 12:57 AM
To: Xu, Quan
Cc: Daniel De Graaf; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machine
Quoted 4 lines
Quoted 1 line · Xu, Quan, le Tue 06 Jan 2015 16:46:58 +0000, a écrit :
QEMU is running in Dom0 as usual, so the domid is 0.
One can also run the HVM QEMU inside a stubdomain.
A good case, thanks Samuel.
Once running the HVM QEMU inside a stubdomain, the domain type is para-virtualization(T_DOMAIN_TYPE_PV)
#define T_DOMAIN_TYPE_HVM 1
#define T_DOMAIN_TYPE_PV 2
Thanks
Quan
Quoted 7 lines
Samuel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 26 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Xu, Quan
Sent: Wednesday, January 07, 2015 9:45 AM
To: Samuel Thibault
Cc: Daniel De Graaf; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 13 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Samuel Thibault
Sent: Wednesday, January 07, 2015 12:57 AM
To: Xu, Quan
Cc: Daniel De Graaf; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 1 line · Xu, Quan, le Tue 06 Jan 2015 16:46:58 +0000, a écrit :
QEMU is running in Dom0 as usual, so the domid is 0.
Quoted 9 lines
Quoted 1 line
One can also run the HVM QEMU inside a stubdomain.
A good case, thanks Samuel.
Once running the HVM QEMU inside a stubdomain, the domain type is para-virtualization(T_DOMAIN_TYPE_PV)#define
T_DOMAIN_TYPE_HVM1
#defineT_DOMAIN_TYPE_PV2
I missed this case, described by Graaf. I have not tried it.
###
[...]
[minios or Linux tpmfront]
|
QEMU stub-domain
|
[MMIO emulation]
| Any HVM guest
###
Thanks
Quan
Quoted 14 lines
Thanks
QuanQuoted 7 lines
Samuel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines · Quan
Quoted 7 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]] On 12/30/2014 11:44 PM, Quan Xu wrote:[...]Quoted 1 line
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;
Quoted 7 lines
Quoted 4 lines
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0.
as similar to Linux PV frontend driver, this frontend driver is enabled in QEMU.
This is a valid configuration of Xen and these patches do suffice to make it work. I am trying to ensure that an additional type of guest setup will also work with these patches.
A useful feature of Xen is the ability to execute the QEMU device model in a domain instead of a process in dom0. When combined with driver domains for devices, this can significantly reduce both the attack surface of and amount of trust required of domain 0.
Quoted 3 lines
Any doubt, feel free to contact. I will try my best to explain. I think your suggestions are very helpful in previous email(Oct. 31th, 2014. ' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine')
Maybe this is still a vague description :(
This is accurate but possibly incomplete.
This is my current understanding of the communications paths and support for vTPMs in Xen:
Physical TPM (1.2; with new patches, may also be 2.0)
|
[MMIO pass-through]
|
vtpmmgr domain
|
[minios tpmback/front] ----- ((other domains' vTPMs))
|
vTPM domain (currently always emulates a TPM v1.2)
|
[minios tpmback]+----[Linux tpmfront]-- PV Linux domain (fully working)
| \
| +--[Linux tpmfront]-- HVM Linux with optional PV drivers
| \
[QEMU XenDevOps] [minios or Linux tpmfront]
| |
QEMU dom0 process QEMU stub-domain
| |
[MMIO emulation] [MMIO emulation]
| |
Any HVM guest Any HVM guestThe series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to consider:
* This stub domain will not have domain 0; the vTPM must bind to another domain ID.
* It is possible to use the native TPM driver for the stub domain (which may either run Linux or mini-os) because there is no conflict with a real TPM software stack running inside domain 0
Supporting this feature requires more granularity in the TPM backend changes. The vTPM domain's backend must be able to handle:
(1) guest domains which talk directly to the vTPM on their own behalf
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of a guest
Cases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest A
Domain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest B
/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PV
/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
/local/domain/4/backend/vtpm/5/0/*: backend B-QEMU /local/domain/5/device/vtpm/0/*: frontend B-QEMU
/local/domain/4/backend/vtpm/6/0/*: backend B-PV
/local/domain/6/device/vtpm/0/*: frontend B-PV
Connections A-PV, B-PV, and B-QEMU would be created in the same manner as the existing "xl vtpm-attach" command does now. If the HVM guest is not running Linux with the Xen tpmfront.ko loaded, the A-PV and B-PV devices will remain unconnected; this is fine.
Connection A-QEMU has a modified frontend state path to prevent Linux from attaching its own TPM driver to the guest's TPM. This requires a few changes:
libxl must support changing the frontend path; this is similar to how disk backend supports both qdisk and vbd (and others), but instead changes the path for the frontend. The minios backend also needs to change the sscanf in parse_eventstr to something like "/local/domain/%u/%*[^/]/vtpm/%u/%40s".
In any case, the vTPM does not need to know if the guest is PV, HVM, or PVH.
Quoted 2 lines
BTW, professor J.
Wang(Wuhan University, China)and I have enabled TPM 2.0 simulator for Linux, Maybe we will try to integrate with vtpm domain to provide TPM 2.0 vtpm function for virtual machine in Q2 or later.
This would be quite useful as it would allow people to use TPM 2.0 features in guests, which may be expected when TPM 2.0 becomes more prevalent. It may also aid in the adoption of TPM 2.0 features because it enables those who only have a 1.2 hardware TPM to still write and use software that interfaces with a TPM 2.0.
Signature · 2 lines
Daniel De Graaf National Security Agency
Quoted 60 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:47 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 7 lines · Quan
Quoted 7 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]] On 12/30/2014 11:44 PM, Quan Xu wrote:[...]Quoted 1 line
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;Quoted 7 lines
Quoted 4 lines
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0.
as similar to Linux PV frontend driver, this frontend driver is enabled inQEMU.
This is a valid configuration of Xen and these patches do suffice to make it work. I am trying to ensure that an additional type of guest setup will also work with these patches.
A useful feature of Xen is the ability to execute the QEMU device model in a domain instead of a process in dom0. When combined with driver domains for devices, this can significantly reduce both the attack surface of and amount of trust required of domain 0.
Quoted 1 line
Any doubt, feel free to contact. I will try my best to explain. I think your
suggestions are very helpful in previous email(Oct. 31th, 2014.
Quoted 2 lines
' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine') Maybe this is still a vague description :(
This is accurate but possibly incomplete.
This is my current understanding of the communications paths and support for vTPMs in Xen:
Physical TPM (1.2; with new patches, may also be 2.0)
| [MMIO pass-through] | vtpmmgr domain | [minios tpmback/front] ----- ((other domains' vTPMs)) | vTPM domain (currently always emulates a TPM v1.2) |[minios tpmback]+----[Linux tpmfront]-- PV Linux domain (fully working)
| \
| +--[Linux tpmfront]-- HVM Linux with optional PV
drivers
Quoted 9 lines
| \
[QEMU XenDevOps] [minios or Linux tpmfront]
| |
QEMU dom0 process QEMU stub-domain
| |
[MMIO emulation] [MMIO emulation]
| |
Any HVM guest Any HVM guestGreat, good architecture. The following part is not put into account in my previous design.
[minios or Linux tpmfront]
|
QEMU stub-domain
|
[MMIO emulation]
|Any HVM guest
Thanks Graaf for sharing your design.
Quoted 43 lines
The series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to consider:
* This stub domain will not have domain 0; the vTPM must bind to
another
domain ID.
* It is possible to use the native TPM driver for the stub domain (which
may
either run Linux or mini-os) because there is no conflict with a real TPM software stack running inside domain 0Supporting this feature requires more granularity in the TPM backend changes.
The vTPM domain's backend must be able to handle:(1) guest domains which talk directly to the vTPM on their own behalf
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of a guestCases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest ADomain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest B
Quoted 6 lines
/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PV/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
I think '/local/domain/0/frontend/vtpm/3/0' is much better. Similar as some backend in Qemu running in Domain-0, it always Stores as '/local/domain/0/backend/qdisk/1 .etc'. I will also modify QEMU code to make '/local/domain/0/frontend/DEVICE' As a general design for general QEMU frontend running in Domain-0.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest A
I will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""
0 = ""
frontend = ""
vtpm = ""
3 = ""
0 = ""
backend = "/local/domain/2/backend/vtpm/3/0"
backend-id = "2"
state = "*"
handle = "0"
ring-ref = "*"
event-channel = "*"
feature-protocol-v2 = "1"
backend = ""
qdisk = ""
[...]
console = ""
vif = ""
[...]
2 = ""
[...]
backend = ""
vtpm = ""
3 = ""
0 = ""
frontend = "/local/domain/0/frontend/vtpm/3/0"
frontend-id = "0" ('0', frontend is running in Domain-0)
[...]
3 = ""
[...]
device = "" (frontend device, the backend is running in QEMU/.etc)
vkbd = ""
[...]
vif = ""
[...]## XenStore << ##
Then, the source code can read xenStore to get frontend-id or frontend directly. If you agree with it, I will modify source code to align with above XenStore design.
Quoted 7 lines
/local/domain/4/backend/vtpm/5/0/*: backend B-QEMU /local/domain/5/device/vtpm/0/*: frontend B-QEMU
/local/domain/4/backend/vtpm/6/0/*: backend B-PV
/local/domain/6/device/vtpm/0/*: frontend B-PV
Quoted 7 lines
Connections A-PV, B-PV, and B-QEMU would be created in the same manner as the existing "xl vtpm-attach" command does now. If the HVM guest is not running Linux with the Xen tpmfront.ko loaded, the A-PV and B-PV devices will remain unconnected; this is fine.
Connection A-QEMU has a modified frontend state path to prevent Linux from attaching its own TPM driver to the guest's TPM.
Your design is working. For this case,
Domain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest B
As my understanding, Xl tools will create Donmain 5 as a PV domain. It works as Existing solutions. I think it can extend with libvirt too.
You can make Domain 6 connected Domain 5 by QEMU command line options, and it
Is quite similar to TPM passthrough.
So in this case, we don't care '-PV' or '-Qemu'. also '-pv'/'-QEMU' are confusing in XenStore.
Quoted 10 lines
This requires a few
changes:
libxl must support changing the frontend path; this is similar to how disk backend supports both qdisk and vbd (and others), but instead changes the path for the frontend. The minios backend also needs to change the sscanf inparse_eventstrto something like "/local/domain/%u/%*[^/]/vtpm/%u/%40s".In any case, the vTPM does not need to know if the guest is PV, HVM, or PVH.
Correct me, if I am wrong.
Thanks
Quan
Quoted 3 lines
--
Daniel De Graaf
National Security Agency
Quoted 180 lines · Quan
Quoted 60 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:47 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 7 lines · Quan
Quoted 7 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]] On 12/30/2014 11:44 PM, Quan Xu wrote:[...]Quoted 1 line
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;Quoted 7 lines
Quoted 4 lines
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0.
as similar to Linux PV frontend driver, this frontend driver is enabled inQEMU.
This is a valid configuration of Xen and these patches do suffice to make it work. I am trying to ensure that an additional type of guest setup will also work with these patches.
A useful feature of Xen is the ability to execute the QEMU device model in a domain instead of a process in dom0. When combined with driver domains for devices, this can significantly reduce both the attack surface of and amount of trust required of domain 0.
Quoted 1 line
Any doubt, feel free to contact. I will try my best to explain. I think your
suggestions are very helpful in previous email(Oct. 31th, 2014.
Quoted 2 lines
' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine') Maybe this is still a vague description :(
This is accurate but possibly incomplete.
This is my current understanding of the communications paths and support for vTPMs in Xen:
Physical TPM (1.2; with new patches, may also be 2.0)
|
[MMIO pass-through]| vtpmmgr domain | [minios tpmback/front] ----- ((other domains' vTPMs)) | vTPM domain (currently always emulates a TPM v1.2) |[minios tpmback]+----[Linux tpmfront]-- PV Linux domain (fully working)
| \
| +--[Linux tpmfront]-- HVM Linux with optional PV
driversQuoted 9 lines
| \ [QEMU XenDevOps] [minios or Linux tpmfront] | | QEMU dom0 process QEMU stub-domain | | [MMIO emulation] [MMIO emulation] | | Any HVM guest Any HVM guestGreat, good architecture. The following part is not put into account in my previous design.
[minios or Linux tpmfront]
| QEMU stub-domain |[MMIO emulation]
|
Any HVM guestThanks Graaf for sharing your design.
Quoted 43 lines
The series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to consider:
* This stub domain will not have domain 0; the vTPM must bind to
another
domain ID.
* It is possible to use the native TPM driver for the stub domain (which
may
either run Linux or mini-os) because there is no conflict with a real TPM software stack running inside domain 0Supporting this feature requires more granularity in the TPM backend changes.
The vTPM domain's backend must be able to handle:(1) guest domains which talk directly to the vTPM on their own behalf
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of a guestCases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest ADomain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest BQuoted 6 lines
/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PV/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
I think '/local/domain/0/frontend/vtpm/3/0' is much better. Similar as some backend in Qemu running in Domain-0, it always Stores as '/local/domain/0/backend/qdisk/1 .etc'. I will also modify QEMU code to make '/local/domain/0/frontend/DEVICE' As a general design for general QEMU frontend running in Domain-0.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AI will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""
0 = ""frontend = "" vtpm = "" 3 = "" 0 = "" backend = "/local/domain/2/backend/vtpm/3/0" backend-id = "2" state = "*" handle = "0" ring-ref = "*" event-channel = "*" feature-protocol-v2 = "1" backend = "" qdisk = "" [...] console = "" vif = "" [...] 2 = "" [...] backend = "" vtpm = "" 3 = "" 0 = "" frontend = "/local/domain/0/frontend/vtpm/3/0" frontend-id = "0" ('0', frontend is running in Domain-0) [...] 3 = "" [...] device = "" (frontend device, the backend is running in QEMU/.etc) vkbd = "" [...] vif = "" [...]
Quoted 4 lines
## XenStore << ##
Then, the source code can read xenStore to get frontend-id or frontend directly. If you agree with it, I will modify source code to align with above XenStore design.
I like the /local/domain/0/frontend/* path better than my initial qemu suggestion, but I think the domain ID used should be the domain ID of the vTPM domain, similar to how backends for the qemu stubdom are done. In this example, the paths would be "/local/domain/0/frontend/vtpm/2/0" and "/local/domain/2/backend/vtpm/0/0". This avoids introducing a dependency on the domain ID of the guest in a connection that does not directly involve that domain. If a guest ever needs two vTPMs or multiple guests share a vTPM, this method of constructing the paths will avoid unneeded conflicts (though I don't expect either of these situations to be normal).
Quoted 17 lines
Quoted 7 lines
/local/domain/4/backend/vtpm/5/0/*: backend B-QEMU /local/domain/5/device/vtpm/0/*: frontend B-QEMU
/local/domain/4/backend/vtpm/6/0/*: backend B-PV
/local/domain/6/device/vtpm/0/*: frontend B-PVQuoted 7 lines
Connections A-PV, B-PV, and B-QEMU would be created in the same manner as the existing "xl vtpm-attach" command does now. If the HVM guest is not running Linux with the Xen tpmfront.ko loaded, the A-PV and B-PV devices will remain unconnected; this is fine.
Connection A-QEMU has a modified frontend state path to prevent Linux from attaching its own TPM driver to the guest's TPM.
Your design is working. For this case,
Quoted 8 lines
Domain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest BAs my understanding, Xl tools will create Donmain 5 as a PV domain. It works as Existing solutions. I think it can extend with libvirt too.
You can make Domain 6 connected Domain 5 by QEMU command line options, and it Is quite similar to TPM passthrough.
Yes, this setup should be possible today once the proper device configuration is added to the QEMU configuration.
Quoted 1 line
So in this case, we don't care '-PV' or '-Qemu'. also '-pv'/'-QEMU' are confusing in XenStore.
Yes; this was one reason I did not want to introduce an "HVM" type in Xenstore.
Signature · 2 lines
Daniel De Graaf National Security Agency
Quoted 203 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Thursday, January 08, 2015 11:55 PM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 73 lines · Quan
Quoted 63 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:47 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 7 lines · Quan
Quoted 7 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]] On 12/30/2014 11:44 PM, Quan Xu wrote:[...]Quoted 1 line
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;Quoted 8 lines
Quoted 4 lines
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0. as similar to Linux PV frontend driver, this frontend driver is enabled in
QEMU.
This is a valid configuration of Xen and these patches do suffice to make it work. I am trying to ensure that an additional type of guest setup will also work with these patches.
A useful feature of Xen is the ability to execute the QEMU device model in a domain instead of a process in dom0. When combined with driver domains for devices, this can significantly reduce both the attack surface of and amount of trust required of domain 0.
Quoted 2 lines
Any doubt, feel free to contact. I will try my best to explain. I think your
suggestions are very helpful in previous email(Oct. 31th, 2014.
Quoted 3 lines
' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine') Maybe this is still a vague description :(
This is accurate but possibly incomplete.
This is my current understanding of the communications paths and support for vTPMs in Xen:
Physical TPM (1.2; with new patches, may also be 2.0)
|
[MMIO pass-through]| vtpmmgr domain | [minios tpmback/front] ----- ((other domains' vTPMs)) | vTPM domain (currently always emulates a TPM v1.2) |[minios tpmback]+----[Linux tpmfront]-- PV Linux domain (fully working)
| \
| +--[Linux tpmfront]-- HVM Linux with optional PV
driversQuoted 9 lines
| \ [QEMU XenDevOps] [minios or Linux tpmfront] | | QEMU dom0 process QEMU stub-domain | | [MMIO emulation] [MMIO emulation] | | Any HVM guest Any HVM guestQuoted 1 line
Great, good architecture. The following part is not put into account in my
previous design.
Quoted 25 lines
[minios or Linux tpmfront]
| QEMU stub-domain |[MMIO emulation]
|
Any HVM guestThanks Graaf for sharing your design.
Quoted 15 lines
The series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to consider:
* This stub domain will not have domain 0; the vTPM must bind to
another
domain ID.
* It is possible to use the native TPM driver for the stub domain
(which may
either run Linux or mini-os) because there is no conflict with a realTPM
Quoted 32 lines
Quoted 32 lines
software stack running inside domain 0
Supporting this feature requires more granularity in the TPM backend changes.
The vTPM domain's backend must be able to handle:(1) guest domains which talk directly to the vTPM on their own behalf
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of a
guestCases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest ADomain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest B/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PVQuoted 6 lines
Quoted 3 lines
/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
I think '/local/domain/0/frontend/vtpm/3/0' is much better. Similar as some backend in Qemu running in Domain-0, it always Stores as
'/local/domain/0/backend/qdisk/1 .etc'. I will also modify QEMU code to make '/local/domain/0/frontend/DEVICE'
Quoted 47 lines
As a general design for general QEMU frontend running in Domain-0.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AI will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""
0 = ""frontend = "" vtpm = "" 3 = "" 0 = "" backend = "/local/domain/2/backend/vtpm/3/0" backend-id = "2" state = "*" handle = "0" ring-ref = "*" event-channel = "*" feature-protocol-v2 = "1" backend = "" qdisk = "" [...] console = "" vif = "" [...] 2 = "" [...] backend = "" vtpm = "" 3 = "" 0 = "" frontend = "/local/domain/0/frontend/vtpm/3/0" frontend-id = "0" ('0', frontend is running in Domain-0) [...] 3 = "" [...] device = "" (frontend device, the backend is running in QEMU/.etc) vkbd = "" [...] vif = "" [...]Quoted 3 lines
## XenStore << ##
Then, the source code can read xenStore to get frontend-id or frontend
directly.
Quoted 8 lines
Quoted 1 line
If you agree with it, I will modify source code to align with above XenStore
design.
I like the /local/domain/0/frontend/* path better than my initial qemu suggestion, but I think the domain ID used should be the domain ID of the vTPM domain, similar to how backends for the qemu stubdom are done. In this example, the paths would be "/local/domain/0/frontend/vtpm/2/0" and "/local/domain/2/backend/vtpm/0/0".
Thanks Graaf.
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest A
/local/domain/0/frontend/vtpm/2/0
/local/domain/2/backend/vtpm/0/0
I have one question. How does Domain 3 read/write XenStore? Such as /local/domain/0/frontend/vtpm/2/*
In QEMU frontend, it can get Domain ID -- '3', but it does know the backend domain ID is '2'.
Quoted 33 lines
This avoids introducing a dependency on the domain ID of the guest in a connection that does not directly involve that domain. If a guest ever needs two vTPMs or multiple guests share a vTPM, this method of constructing the paths will avoid unneeded conflicts (though I don't expect either of these situations to be normal).
Quoted 17 lines
Quoted 7 lines
/local/domain/4/backend/vtpm/5/0/*: backend B-QEMU /local/domain/5/device/vtpm/0/*: frontend B-QEMU
/local/domain/4/backend/vtpm/6/0/*: backend B-PV
/local/domain/6/device/vtpm/0/*: frontend B-PVQuoted 7 lines
Connections A-PV, B-PV, and B-QEMU would be created in the same manner as the existing "xl vtpm-attach" command does now. If the HVM guest is not running Linux with the Xen tpmfront.ko loaded, the A-PV and B-PV devices will remain unconnected; this is fine.
Connection A-QEMU has a modified frontend state path to prevent Linux from attaching its own TPM driver to the guest's TPM.
Your design is working. For this case,
Quoted 7 lines
Domain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest BAs my understanding, Xl tools will create Donmain 5 as a PV domain. It works as Existing solutions. I think it can extend with libvirt too. You can make Domain 6 connected Domain 5 by QEMU command line
options,
Quoted 1 line
and it Is quite similar to TPM passthrough.
Quoted 8 lines
Yes, this setup should be possible today once the proper device configuration is added to the QEMU configuration.
Quoted 1 line
So in this case, we don't care '-PV' or '-Qemu'. also '-pv'/'-QEMU' are
confusing in XenStore.
Yes; this was one reason I did not want to introduce an "HVM" type in Xenstore.
Hope someone can implement it...:)
Intel
Quan Xu
Quoted 3 lines
--
Daniel De Graaf
National Security Agency
Quoted 218 lines · Quan
Quoted 203 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Thursday, January 08, 2015 11:55 PM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 73 lines · Quan
Quoted 62 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:47 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 7 lines · Quan
Quoted 7 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]] On 12/30/2014 11:44 PM, Quan Xu wrote:[...]Quoted 1 line
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;Quoted 8 lines
Quoted 4 lines
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0. as similar to Linux PV frontend driver, this frontend driver is enabled in
QEMU.
This is a valid configuration of Xen and these patches do suffice to make it work. I am trying to ensure that an additional type of guest setup will also work with these patches.
A useful feature of Xen is the ability to execute the QEMU device model in a domain instead of a process in dom0. When combined with driver domains for devices, this can significantly reduce both the attack surface of and amount of trust required of domain 0.
Quoted 2 lines
Any doubt, feel free to contact. I will try my best to explain. I think your
suggestions are very helpful in previous email(Oct. 31th, 2014.
Quoted 3 lines
' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine') Maybe this is still a vague description :(
This is accurate but possibly incomplete.
This is my current understanding of the communications paths and support for vTPMs in Xen:
Physical TPM (1.2; with new patches, may also be 2.0) | [MMIO pass-through] | vtpmmgr domain | [minios tpmback/front] ----- ((other domains' vTPMs)) | vTPM domain (currently always emulates a TPM v1.2) | [minios tpmback]+----[Linux tpmfront]-- PV Linux domain (fully working) | \ | +--[Linux tpmfront]-- HVM Linux with optional PVQuoted 10 lines
drivers
| \
[QEMU XenDevOps] [minios or Linux tpmfront]
| |
QEMU dom0 process QEMU stub-domain
| |
[MMIO emulation] [MMIO emulation]
| |
Any HVM guest Any HVM guestQuoted 1 line
Great, good architecture. The following part is not put into account in my
previous design.
Quoted 25 lines
[minios or Linux tpmfront]
| QEMU stub-domain |[MMIO emulation]
|
Any HVM guestThanks Graaf for sharing your design.
Quoted 15 lines
The series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to consider:
* This stub domain will not have domain 0; the vTPM must bind to
another
domain ID.
* It is possible to use the native TPM driver for the stub domain
(which may
either run Linux or mini-os) because there is no conflict with a realTPM
Quoted 32 lines
Quoted 32 lines
software stack running inside domain 0
Supporting this feature requires more granularity in the TPM backend changes.
The vTPM domain's backend must be able to handle:(1) guest domains which talk directly to the vTPM on their own behalf
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of a
guestCases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest ADomain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest B/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PVQuoted 6 lines
Quoted 3 lines
/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
I think '/local/domain/0/frontend/vtpm/3/0' is much better. Similar as some backend in Qemu running in Domain-0, it always Stores as
'/local/domain/0/backend/qdisk/1 .etc'. I will also modify QEMU code to make '/local/domain/0/frontend/DEVICE'
Quoted 47 lines
As a general design for general QEMU frontend running in Domain-0.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AI will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""0 = "" frontend = "" vtpm = "" 3 = "" 0 = "" backend = "/local/domain/2/backend/vtpm/3/0" backend-id = "2" state = "*" handle = "0" ring-ref = "*" event-channel = "*" feature-protocol-v2 = "1" backend = "" qdisk = "" [...] console = "" vif = "" [...] 2 = "" [...] backend = "" vtpm = "" 3 = "" 0 = "" frontend = "/local/domain/0/frontend/vtpm/3/0" frontend-id = "0" ('0', frontend is running in Domain-0) [...] 3 = "" [...] device = "" (frontend device, the backend is running in QEMU/.etc) vkbd = "" [...] vif = "" [...]Quoted 3 lines
## XenStore << ##
Then, the source code can read xenStore to get frontend-id or frontend
directly.
Quoted 8 lines
Quoted 1 line
If you agree with it, I will modify source code to align with above XenStore
design.
I like the /local/domain/0/frontend/* path better than my initial qemu suggestion, but I think the domain ID used should be the domain ID of the vTPM domain, similar to how backends for the qemu stubdom are done. In this example, the paths would be "/local/domain/0/frontend/vtpm/2/0" and "/local/domain/2/backend/vtpm/0/0".
Thanks Graaf.
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest A
Quoted 7 lines
/local/domain/0/frontend/vtpm/2/0
/local/domain/2/backend/vtpm/0/0I have one question. How does Domain 3 read/write XenStore? Such as /local/domain/0/frontend/vtpm/2/*
In QEMU frontend, it can get Domain ID -- '3', but it does know the backend domain ID is '2'.
I would have this as a parameter in describing the vTPM device, similar to how the file name of the disk images are described. The actual command line or configuration for QEMU might use a domain name instead of a domain ID. I would check to see how disk or network backend domains are handled (I assume they are supported by qemu-in-dom0; I don't recall testing that setup myself).
Quoted 52 lines
Quoted 33 lines
This avoids introducing a dependency on the domain ID of the guest in a connection that does not directly involve that domain. If a guest ever needs two vTPMs or multiple guests share a vTPM, this method of constructing the paths will avoid unneeded conflicts (though I don't expect either of these situations to be normal).
Quoted 17 lines
Quoted 7 lines
/local/domain/4/backend/vtpm/5/0/*: backend B-QEMU /local/domain/5/device/vtpm/0/*: frontend B-QEMU
/local/domain/4/backend/vtpm/6/0/*: backend B-PV
/local/domain/6/device/vtpm/0/*: frontend B-PVQuoted 7 lines
Connections A-PV, B-PV, and B-QEMU would be created in the same manner as the existing "xl vtpm-attach" command does now. If the HVM guest is not running Linux with the Xen tpmfront.ko loaded, the A-PV and B-PV devices will remain unconnected; this is fine.
Connection A-QEMU has a modified frontend state path to prevent Linux from attaching its own TPM driver to the guest's TPM.
Your design is working. For this case,
Quoted 7 lines
Domain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest BAs my understanding, Xl tools will create Donmain 5 as a PV domain. It works as Existing solutions. I think it can extend with libvirt too. You can make Domain 6 connected Domain 5 by QEMU command line
options,
Quoted 1 line
and it Is quite similar to TPM passthrough.
Quoted 8 lines
Yes, this setup should be possible today once the proper device configuration is added to the QEMU configuration.
Quoted 1 line
So in this case, we don't care '-PV' or '-Qemu'. also '-pv'/'-QEMU' are
confusing in XenStore.
Yes; this was one reason I did not want to introduce an "HVM" type in Xenstore.
Hope someone can implement it...:)
Intel
Quan XuQuoted 3 lines
--
Daniel De Graaf
National Security Agency
Signature · 2 lines
Daniel De Graaf National Security Agency
Quoted 246 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Friday, January 09, 2015 1:48 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 61 lines · Quan
Quoted 61 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Thursday, January 08, 2015 11:55 PM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 50 lines · Quan
Quoted 50 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:47 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 8 lines · Quan
Quoted 8 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]] On 12/30/2014
11:44 PM, Quan Xu wrote:[...]Quoted 1 line
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :tpmif->domid;Quoted 8 lines
Quoted 4 lines
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0. as similar to Linux PV frontend driver, this frontend driver is enabled in
QEMU.
This is a valid configuration of Xen and these patches do suffice to make it work. I am trying to ensure that an additional type of guest setup will also work with these patches.
A useful feature of Xen is the ability to execute the QEMU device model in a domain instead of a process in dom0. When combined with driver domains for devices, this can significantly reduce both the attack surface of and amount of trust required of domain 0.
Quoted 2 lines
Any doubt, feel free to contact. I will try my best to explain. I think your
suggestions are very helpful in previous email(Oct. 31th, 2014.
Quoted 3 lines
' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine') Maybe this is still a vague description :(
This is accurate but possibly incomplete.
This is my current understanding of the communications paths and support for vTPMs in Xen:
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Physical TPM (1.2; with new patches, may also be 2.0) | [MMIO pass-through] | vtpmmgr domain | [minios tpmback/front] ----- ((other domains' vTPMs)) | vTPM domain (currently always emulates a TPM v1.2) | [minios tpmback]+----[Linux tpmfront]-- PV Linux domain (fullyworking)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
| \
| +--[Linux tpmfront]-- HVM Linux with optionalPV
Quoted 41 lines
Quoted 41 lines
Quoted 11 lines
Quoted 10 lines
drivers
| \
[QEMU XenDevOps] [minios or Linux tpmfront]
| |
QEMU dom0 process QEMU stub-domain
| |
[MMIO emulation] [MMIO emulation]
| |
Any HVM guest Any HVM guestQuoted 2 lines
Great, good architecture. The following part is not put into account in my
previous design.
Quoted 27 lines
[minios or Linux tpmfront]
| QEMU stub-domain |[MMIO emulation]
|
Any HVM guestThanks Graaf for sharing your design.
Quoted 17 lines
The series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to
consider:* This stub domain will not have domain 0; the vTPM must bind
to another
domain ID.
* It is possible to use the native TPM driver for the stub
domain (which may
either run Linux or mini-os) because there is no conflict
with a realQuoted 8 lines
Quoted 8 lines
TPM
Quoted 7 lines
Quoted 7 lines
software stack running inside domain 0
Supporting this feature requires more granularity in the TPM backend changes.
The vTPM domain's backend must be able to handle:(1) guest domains which talk directly to the vTPM on their own
behalf
Quoted 87 lines
Quoted 87 lines
Quoted 25 lines
Quoted 25 lines
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of a
guestCases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest ADomain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest B/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PVQuoted 6 lines
Quoted 3 lines
/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
I think '/local/domain/0/frontend/vtpm/3/0' is much better. Similar as some backend in Qemu running in Domain-0, it always Stores as
'/local/domain/0/backend/qdisk/1 .etc'. I will also modify QEMU code to make '/local/domain/0/frontend/DEVICE'
Quoted 47 lines
As a general design for general QEMU frontend running in Domain-0.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AI will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""0 = "" frontend = "" vtpm = "" 3 = "" 0 = "" backend = "/local/domain/2/backend/vtpm/3/0" backend-id = "2" state = "*" handle = "0" ring-ref = "*" event-channel = "*" feature-protocol-v2 = "1" backend = "" qdisk = "" [...] console = "" vif = "" [...] 2 = "" [...] backend = "" vtpm = "" 3 = "" 0 = "" frontend = "/local/domain/0/frontend/vtpm/3/0" frontend-id = "0" ('0', frontend is running in Domain-0) [...] 3 = "" [...] device = "" (frontend device, the backend is running in QEMU/.etc) vkbd = "" [...] vif = "" [...]Quoted 4 lines
## XenStore << ##
Then, the source code can read xenStore to get frontend-id or frontend
directly.
Quoted 2 lines
If you agree with it, I will modify source code to align with above XenStore
Quoted 7 lines
Quoted 7 lines
design.
I like the /local/domain/0/frontend/* path better than my initial qemu suggestion, but I think the domain ID used should be the domain ID of the vTPM domain, similar to how backends for the qemu stubdom are done. In this example, the paths would be "/local/domain/0/frontend/vtpm/2/0" and
"/local/domain/2/backend/vtpm/0/0".
Quoted 7 lines
Thanks Graaf.
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AQuoted 7 lines
/local/domain/0/frontend/vtpm/2/0
/local/domain/2/backend/vtpm/0/0I have one question. How does Domain 3 read/write XenStore? Such as /local/domain/0/frontend/vtpm/2/*
In QEMU frontend, it can get Domain ID -- '3', but it does know the backend
Quoted 8 lines
domain ID is '2'.
I would have this as a parameter in describing the vTPM device, similar to how the file name of the disk images are described. The actual command line or configuration for QEMU might use a domain name instead of a domain ID. I would check to see how disk or network backend domains are handled (I assume they are supported by qemu-in-dom0; I don't recall testing that setup myself)
.
Thanks.
I will also check to see how disk or network backend domains are handled. Any result, I will send out.
Quan
Quoted 60 lines
Quoted 34 lines
Quoted 34 lines
This avoids introducing a dependency on the domain ID of the guest in a connection that does not directly involve that domain. If a guest ever needs two vTPMs or multiple guests share a vTPM, this method of constructing the paths will avoid unneeded conflicts (though I don't expect either of these situations to be normal).
Quoted 17 lines
Quoted 7 lines
/local/domain/4/backend/vtpm/5/0/*: backend B-QEMU /local/domain/5/device/vtpm/0/*: frontend B-QEMU
/local/domain/4/backend/vtpm/6/0/*: backend B-PV
/local/domain/6/device/vtpm/0/*: frontend B-PVQuoted 7 lines
Connections A-PV, B-PV, and B-QEMU would be created in the same manner as the existing "xl vtpm-attach" command does now. If the HVM guest is not running Linux with the Xen tpmfront.ko loaded, the A-PV and B-PV devices will remain unconnected; this is fine.
Connection A-QEMU has a modified frontend state path to prevent Linux from attaching its own TPM driver to the guest's TPM.
Your design is working. For this case,
Quoted 7 lines
Domain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest BAs my understanding, Xl tools will create Donmain 5 as a PV domain. It works as Existing solutions. I think it can extend with libvirt too. You can make Domain 6 connected Domain 5 by QEMU command line
options,
Quoted 1 line
and it Is quite similar to TPM passthrough.
Quoted 8 lines
Quoted 8 lines
Yes, this setup should be possible today once the proper device configuration is added to the QEMU configuration.
Quoted 2 lines
So in this case, we don't care '-PV' or '-Qemu'. also '-pv'/'-QEMU' are
confusing in XenStore.
Yes; this was one reason I did not want to introduce an "HVM" type in
Xenstore.
Quoted 12 lines
Quoted 1 line
Hope someone can implement it...:)
Intel
Quan XuQuoted 3 lines
--
Daniel De Graaf
National Security Agency--
Daniel De Graaf
National Security Agency
Quoted 98 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Xu, Quan
Sent: Friday, January 09, 2015 9:25 AM
To: Daniel De Graaf; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 8 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Friday, January 09, 2015 1:48 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 32 lines
Quoted 31 lines · Quan
Quoted 31 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Thursday, January 08, 2015 11:55 PM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 20 lines · Quan
Quoted 20 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:47 AM
To: Xu, Quan; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 1/5] vTPM: event channel bind interdomain with para/hvm virtual machineQuoted 8 lines · Quan
Quoted 8 lines
-----Original Message-----
From: Daniel De Graaf [mailto:[email protected]] On 12/30/2014
11:44 PM, Quan Xu wrote:[...]Quoted 2 lines
extras/mini-os/tpmback.c +0
-0[...]
Quoted 1 line
+ domid = (domtype ==
T_DOMAIN_TYPE_HVM) ? 0 :
tpmif->domid;Quoted 44 lines
Quoted 44 lines
Quoted 44 lines
Quoted 44 lines
Quoted 44 lines
Quoted 9 lines
Quoted 5 lines
Unless I'm missing something, this still assumes that the HVM device model is located in domain 0, and so it will not work if a stub domain is used for qemu.
QEMU is running in Dom0 as usual, so the domid is 0. as similar to Linux PV frontend driver, this frontend driver is enabled in
QEMU.
This is a valid configuration of Xen and these patches do suffice to make it work. I am trying to ensure that an additional type of guest setup will also work with these patches.
A useful feature of Xen is the ability to execute the QEMU device model in a domain instead of a process in dom0. When combined with driver domains for devices, this can significantly reduce both the attack surface of and amount of trust required of domain 0.
Quoted 2 lines
Any doubt, feel free to contact. I will try my best to explain. I think your
suggestions are very helpful in previous email(Oct. 31th, 2014.
Quoted 3 lines
' Re: FW: [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm virtual machine') Maybe this is still a vague description :(
This is accurate but possibly incomplete.
This is my current understanding of the communications paths and support for vTPMs in Xen:
Physical TPM (1.2; with new patches, may also be 2.0) | [MMIO pass-through] | vtpmmgr domain | [minios tpmback/front] ----- ((other domains' vTPMs)) | vTPM domain (currently always emulates a TPM v1.2) | [minios tpmback]+----[Linux tpmfront]-- PV Linux domain(fully
Quoted 153 lines
Quoted 3 lines
working)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
| \
| +--[Linux tpmfront]-- HVM Linux withoptional
Quoted 149 lines
PV
Quoted 42 lines
Quoted 42 lines
Quoted 11 lines
Quoted 10 lines
drivers
| \
[QEMU XenDevOps] [minios or Linux tpmfront]
| |
QEMU dom0 process QEMU stub-domain
| |
[MMIO emulation] [MMIO emulation]
| |
Any HVM guest Any HVM guestQuoted 2 lines
Great, good architecture. The following part is not put into account in my
previous design.
Quoted 27 lines
[minios or Linux tpmfront]
| QEMU stub-domain |[MMIO emulation]
|
Any HVM guestThanks Graaf for sharing your design.
Quoted 17 lines
The series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to
consider:* This stub domain will not have domain 0; the vTPM must bind
to another
domain ID.
* It is possible to use the native TPM driver for the stub
domain (which may
either run Linux or mini-os) because there is no conflict
with a realTPM
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
software stack running inside domain 0
Supporting this feature requires more granularity in the TPM backend changes.
The vTPM domain's backend must be able to handle:(1) guest domains which talk directly to the vTPM on their
ownbehalf
Quoted 87 lines
Quoted 87 lines
Quoted 24 lines
Quoted 24 lines
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of
a guestCases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest ADomain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B Domain 6: HVM guest B/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PVQuoted 7 lines
Quoted 3 lines
/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
I think '/local/domain/0/frontend/vtpm/3/0' is much better. Similar as some backend in Qemu running in Domain-0, it always Stores as
'/local/domain/0/backend/qdisk/1 .etc'. I will also modify QEMU code to make '/local/domain/0/frontend/DEVICE'
Quoted 47 lines
As a general design for general QEMU frontend running in Domain-0.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AI will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""0 = "" frontend = "" vtpm = "" 3 = "" 0 = "" backend = "/local/domain/2/backend/vtpm/3/0" backend-id = "2" state = "*" handle = "0" ring-ref = "*" event-channel = "*" feature-protocol-v2 = "1" backend = "" qdisk = "" [...] console = "" vif = "" [...] 2 = "" [...] backend = "" vtpm = "" 3 = "" 0 = "" frontend = "/local/domain/0/frontend/vtpm/3/0" frontend-id = "0" ('0', frontend is running in Domain-0) [...] 3 = "" [...] device = "" (frontend device, the backend is running in QEMU/.etc) vkbd = "" [...] vif = "" [...]Quoted 4 lines
## XenStore << ##
Then, the source code can read xenStore to get frontend-id or frontend
directly.
Quoted 2 lines
If you agree with it, I will modify source code to align with above XenStore
Quoted 7 lines
Quoted 7 lines
design.
I like the /local/domain/0/frontend/* path better than my initial qemu suggestion, but I think the domain ID used should be the domain ID of the vTPM domain, similar to how backends for the qemu stubdom are done. In this example, the paths would be "/local/domain/0/frontend/vtpm/2/0" and
"/local/domain/2/backend/vtpm/0/0".
Quoted 2 lines
Thanks Graaf.
Stefano,
Do you have some idea of this XenStore design? QEMU is running in Dom0 as usual,
, and the frontend driver is enabled in QEMU. Thanks.
Quan
Quoted 95 lines
Quoted 15 lines
Quoted 5 lines
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AQuoted 8 lines
/local/domain/0/frontend/vtpm/2/0
/local/domain/2/backend/vtpm/0/0I have one question. How does Domain 3 read/write XenStore? Such as /local/domain/0/frontend/vtpm/2/*
In QEMU frontend, it can get Domain ID -- '3', but it does know the backend
domain ID is '2'.
Quoted 7 lines
I would have this as a parameter in describing the vTPM device, similar to how the file name of the disk images are described. The actual command line or configuration for QEMU might use a domain name instead of a domain ID. I would check to see how disk or network backend domains are handled (I assume they are supported by qemu-in-dom0; I don't recall testing that setup
myself).
Thanks.
I will also check to see how disk or network backend domains are handled. Any result, I will send out.Quan
Quoted 57 lines
Quoted 36 lines
Quoted 36 lines
This avoids introducing a dependency on the domain ID of the guest in a connection that does not directly involve that domain. If a guest ever needs two vTPMs or multiple guests share a vTPM, this method of constructing the paths will avoid unneeded conflicts (though I don't expect either of these situations to be normal).
Quoted 15 lines
Quoted 7 lines
/local/domain/4/backend/vtpm/5/0/*: backend B-QEMU /local/domain/5/device/vtpm/0/*: frontend B-QEMU
/local/domain/4/backend/vtpm/6/0/*: backend B-PV
/local/domain/6/device/vtpm/0/*: frontend B-PVQuoted 7 lines
Connections A-PV, B-PV, and B-QEMU would be created in the same manner as the existing "xl vtpm-attach" command does now. If the HVM guest is not running Linux with the Xen tpmfront.ko loaded, the A-PV and B-PV devices will remain unconnected; this is fine.
Connection A-QEMU has a modified frontend state path to prevent Linux from attaching its own TPM driver to the guest's TPM.
Quoted 8 lines
Your design is working. For this case,
Domain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B Domain 6: HVM guest BAs my understanding, Xl tools will create Donmain 5 as a PV domain. It works as Existing solutions. I think it can extend with libvirt too. You can make Domain 6 connected Domain 5 by QEMU command line
options,
Quoted 1 line
and it Is quite similar to TPM passthrough.
Yes, this setup should be possible today once the proper device configuration is added to the QEMU configuration.
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
So in this case, we don't care '-PV' or '-Qemu'. also '-pv'/'-QEMU' are
confusing in XenStore.
Yes; this was one reason I did not want to introduce an "HVM" type in
Xenstore.
Quoted 12 lines
Quoted 1 line
Hope someone can implement it...:)
Intel
Quan XuQuoted 3 lines
--
Daniel De Graaf
National Security AgencyQuoted 3 lines
--
Daniel De Graaf
National Security Agency_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Also CC Stefan Berger.
Quoted 148 lines
Quoted 27 lines
Quoted 17 lines
This is my current understanding of the communications paths and support for vTPMs in Xen:
Physical TPM (1.2; with new patches, may also be 2.0)
|
[MMIO pass-through]| vtpmmgr domain | [minios tpmback/front] ----- ((other domains' vTPMs)) | vTPM domain (currently always emulates a TPM v1.2) |[minios tpmback]+----[Linux tpmfront]-- PV Linux domain (fully working)
| \
| +--[Linux tpmfront]-- HVM Linux with optional PV
driversQuoted 9 lines
| \ [QEMU XenDevOps] [minios or Linux tpmfront] | | QEMU dom0 process QEMU stub-domain | | [MMIO emulation] [MMIO emulation] | | Any HVM guest Any HVM guestQuoted 1 line
Great, good architecture. The following part is not put into account in my
previous design.
Quoted 57 lines
[minios or Linux tpmfront]
| QEMU stub-domain |[MMIO emulation]
|
Any HVM guestThanks Graaf for sharing your design.
Quoted 47 lines
The series you are sending will enable QEMU to talk to tpmback directly. This is the best solution when QEMU is running inside domain 0, because it is not currently a good idea to use Linux's tpmfront driver to talk to each guest's vTPM domain.
When QEMU is run inside a stub domain, there are a few more things to consider:
* This stub domain will not have domain 0; the vTPM must bind to
another
domain ID.
* It is possible to use the native TPM driver for the stub domain
(which may
either run Linux or mini-os) because there is no conflict with a real TPM software stack running inside domain 0Supporting this feature requires more granularity in the TPM backend changes.
The vTPM domain's backend must be able to handle:(1) guest domains which talk directly to the vTPM on their own behalf
(2) QEMU processes in domain 0
(3) QEMU domains which talk directly to the vTPM on behalf of a
guestCases (1) and (3) are already handled by the existing tpmback if the proper domain ID is used.
Your patch set currently breaks case (1) and (3) for HVM guests while enabling case (2). An alternate solution that does not break these cases while enabling case (2) is preferable.
My thoughts on extending the xenstore interface via an example:
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest ADomain 4: vTPM for guest B
Domain 5: QEMU stubdom for guest B
Domain 6: HVM guest B/local/domain/2/backend/vtpm/3/0/*: backend A-PV
/local/domain/3/device/vtpm/0/*: frontend A-PVQuoted 6 lines
Quoted 3 lines
/local/domain/2/backend/vtpm/0/3/*: backend A-QEMU /local/domain/0/qemu-device/vtpm/3/*: frontend A-QEMU (uses XenDevOps)
I think '/local/domain/0/frontend/vtpm/3/0' is much better. Similar as some backend in Qemu running in Domain-0, it always Stores as
'/local/domain/0/backend/qdisk/1 .etc'. I will also modify QEMU code to make '/local/domain/0/frontend/DEVICE'
Quoted 47 lines
As a general design for general QEMU frontend running in Domain-0.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest AI will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""
0 = ""frontend = "" vtpm = "" 3 = "" 0 = "" backend = "/local/domain/2/backend/vtpm/3/0" backend-id = "2" state = "*" handle = "0" ring-ref = "*" event-channel = "*" feature-protocol-v2 = "1" backend = "" qdisk = "" [...] console = "" vif = "" [...] 2 = "" [...] backend = "" vtpm = "" 3 = "" 0 = "" frontend = "/local/domain/0/frontend/vtpm/3/0" frontend-id = "0" ('0', frontend is running in Domain-0) [...] 3 = "" [...] device = "" (frontend device, the backend is running in QEMU/.etc) vkbd = "" [...] vif = "" [...]Quoted 3 lines
## XenStore << ##
Then, the source code can read xenStore to get frontend-id or frontend
directly.
Quoted 1 line
If you agree with it, I will modify source code to align with above XenStore
design.
Quoted 10 lines
I like the /local/domain/0/frontend/* path better than my initial qemu suggestion, but I think the domain ID used should be the domain ID of the vTPM domain, similar to how backends for the qemu stubdom are done. In this example, the paths would be "/local/domain/0/frontend/vtpm/2/0" and "/local/domain/2/backend/vtpm/0/0".
This avoids introducing a dependency on the domain ID of the guest in a connection that does not directly involve that domain. If a guest ever needs two vTPMs or multiple guests share a vTPM, this method of constructing the paths will avoid unneeded conflicts (though I don't expect either of these situations to be normal).
Agree with you. I will send out v3 based on it.
For this example,
Domain 0: runs QEMU for guest A
Domain 1: vtpmmgr
Domain 2: vTPM for guest A
Domain 3: HVM guest A
I will design XenStore as following:
## XenStore >> ###
local = ""
domain = ""
0 = ""
frontend = ""
vtpm = ""
2 = ""
0 = ""
backend = "/local/domain/2/backend/vtpm/0/0"
backend-id = "2"
state = "*"
handle = "0"
domain = "Domain3's name"
ring-ref = "*"
event-channel = "*"
feature-protocol-v2 = "1"
backend = ""
qdisk = ""
[...]
console = ""
vif = ""
[...]
2 = ""
[...]
backend = ""
vtpm = ""
0 = ""
0 = ""
frontend = "/local/domain/0/frontend/vtpm/2/0"
frontend-id = "0" ('0', frontend is running in Domain-0)
[...]
3 = ""
[...]
device = "" (frontend device, the backend is running in QEMU/.etc)
vkbd = ""
[...]
vif = ""
[...]## XenStore << ##
Add [domain = "Domain3's name"] under /local/domain/0/frontend/vtpm/2/0. Then, 'xs_directory()' can help to find out which domain is the backend. It can be of low efficiency.
-Quan