Intel TXT driver
cover Intel TXT driver
This module is expected to be a better tool to access below resources
- TXT config space
- Tboot log mem
- SMX parameter
Intel TXT (Trusted Execution Technology) will provide higher assurance of system configuration and initial state as well as data reset protection. It also helps solve real end user concerns about having confidence that their hardware is running the VMM or kernel that it was configured with, especially since they may be responsible for providing such assurances to VMs and services running on it.
See <http://www.intel.com/technology/security/> for more information about Intel(R) TXT.
Intel TXT configuration registers are a subset of chipset registers. These chipset registers that interact with SMX are accessed from two regions of memory, which represent the public and private configuration spaces, by system software using memory read/write protocols.
With this module, it will be easier to access TXT/tboot related information/logs.
Qiaowei Ren (4):
driver: add TXT driver in kernel
driver: provide sysfs interfaces to access TXT config space
driver: provide sysfs interfaces to access TXT log
driver: provide sysfs interfaces to access SMX parameter
Documentation/ABI/testing/sysfs-platform-intel-txt | 402 ++++++++ drivers/platform/x86/Kconfig | 2 + drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_txt/Kconfig | 17 + drivers/platform/x86/intel_txt/Makefile | 5 + drivers/platform/x86/intel_txt/txt-config.c | 1032 ++++++++++++++++++++ drivers/platform/x86/intel_txt/txt-config.h | 138 +++ drivers/platform/x86/intel_txt/txt-log.c | 131 +++ drivers/platform/x86/intel_txt/txt-log.h | 27 + drivers/platform/x86/intel_txt/txt-parameter.c | 253 +++++ drivers/platform/x86/intel_txt/txt-parameter.h | 40 + drivers/platform/x86/intel_txt/txt-sysfs.c | 60 ++ 12 files changed, 2108 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-intel-txt create mode 100644 drivers/platform/x86/intel_txt/Kconfig create mode 100644 drivers/platform/x86/intel_txt/Makefile create mode 100644 drivers/platform/x86/intel_txt/txt-config.c create mode 100644 drivers/platform/x86/intel_txt/txt-config.h create mode 100644 drivers/platform/x86/intel_txt/txt-log.c create mode 100644 drivers/platform/x86/intel_txt/txt-log.h create mode 100644 drivers/platform/x86/intel_txt/txt-parameter.c create mode 100644 drivers/platform/x86/intel_txt/txt-parameter.h create mode 100644 drivers/platform/x86/intel_txt/txt-sysfs.c
Signature · 1 line
1.7.9.5
PATCH 1/4 driver: add TXT driver in kernel
TXT driver is expected to be a better tool to access below resources:
TXT config space, TXT log and SMX parameter.
--- drivers/platform/x86/Kconfig | 2 ++ drivers/platform/x86/Makefile | 1 + drivers/platform/x86/intel_txt/Kconfig | 17 +++++++++++++ drivers/platform/x86/intel_txt/Makefile | 5 ++++ drivers/platform/x86/intel_txt/txt-sysfs.c | 38 ++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+) create mode 100644 drivers/platform/x86/intel_txt/Kconfig create mode 100644 drivers/platform/x86/intel_txt/Makefile create mode 100644 drivers/platform/x86/intel_txt/txt-sysfs.c
drivers/platform/x86/Kconfig +2 -0
@@ -693,6 +693,8 @@ config INTEL_IPS functionality. If in doubt, say Y here; it will only load on supported platforms. +source "drivers/platform/x86/intel_txt/Kconfig" + config IBM_RTL tristate "Device driver to enable PRTL support" depends on X86 && PCI
drivers/platform/x86/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o obj-$(CONFIG_INTEL_MFLD_THERMAL) += intel_mid_thermal.o obj-$(CONFIG_INTEL_IPS) += intel_ips.o +obj-$(CONFIG_INTEL_TXT_DRIVER) += intel_txt/ obj-$(CONFIG_GPIO_INTEL_PMIC) += intel_pmic_gpio.o obj-$(CONFIG_XO1_RFKILL) += xo1-rfkill.o obj-$(CONFIG_XO15_EBOOK) += xo15-ebook.o
drivers/platform/x86/intel_txt/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# +# intel TXT driver configuration +# + +config INTEL_TXT_DRIVER + tristate "INTEL TXT sysfs driver" + default m + depends on INTEL_TXT + select SECURITYFS + ---help--- + TXT Driver is expected to be a better tool to access below resources: + - TXT config space + - Tboot log mem + - SMX parameter + + To compile this driver as a module, choose M here; the module will be + called txt.
drivers/platform/x86/intel_txt/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for the intel TXT drivers. +# +obj-$(CONFIG_INTEL_TXT_DRIVER) += intel_txt.o +intel_txt-y := txt-sysfs.o
drivers/platform/x86/intel_txt/txt-sysfs.c new file +38 -0
@@ -0,0 +1,38 @@ +/* +* txt-sysfs.c +* +* This module is expected to be a better tool to access below resources +* - TXT config space +* - Tboot log mem +* - SMX parameter +* +* Data is currently found below +* /sys/devices/platform/intel_txt/... +*/ + +#include <linux/init.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/sysfs.h> + +#define DEV_NAME "intel_txt" +static struct platform_device *txt_pdev; + +static int __init txt_sysfs_init (void ) +{ + txt_pdev =platform_device_register_simple (DEV_NAME ,-1 ,NULL ,0 ); +if (IS_ERR (txt_pdev)) +return PTR_ERR (txt_pdev); + +return 0 ; +} + +static void __exit txt_sysfs_exit(void) +{ +platform_device_unregister (txt_pdev); +} + +module_init (txt_sysfs_init); +module_exit (txt_sysfs_exit); + +MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.9.5
Re: [PATCH 1/4] driver: add TXT driver in kernel
Quoted 2 lines · Qiaowei Ren
TXT driver is expected to be a better tool to access below resources:
TXT config space, TXT log and SMX parameter.
Please explain what these things are in the commit log, the config help and the comment at the top of the driver - it'll make things easier for people later.
drivers/platform/x86/intel_txt/Kconfig line 17
Quoted 2 lines
drivers/platform/x86/intel_txt/Kconfig new file +2
-0+ To compile this driver as a module, choose M here; the module will be + called txt.
That's an awfully generic name. intel_txt would be better.
Quoted 1 line
+ * This module is expected to be a better tool to access below resources
Expected to be or is? :)
Quoted 1 line
+ * Data is currently found below
You're adding it to ABI, so it shouldn't just be current - are you planning on moving it at any point? Is this functionality that should be under securityfs instead?
drivers/platform/x86/intel_txt/txt-sysfs.c line 23
Quoted 1 line
drivers/platform/x86/intel_txt/txt-sysfs.c new file +1
-0+ txt_pdev =platform_device_register_simple (DEV_NAME ,-1 ,NULL ,0 );
This will register even if there's no TXT support on the platform, right? Is there no mechanism for determining whether a platform has TXT support before registering a device?
drivers/platform/x86/intel_txt/txt-sysfs.c line 36
Quoted 2 lines
drivers/platform/x86/intel_txt/txt-sysfs.c new file +2
-0+module_init (txt_sysfs_init); +module_exit (txt_sysfs_exit);
And you've got no module aliases, so this will never be autoloaded. How does the OS know that the platform implements TXT?
Signature · 1 line
Matthew Garrett | [email protected]
RE: [PATCH 1/4] driver: add TXT driver in kernel
Quoted 6 lines · Matthew Garrett
Quoted 2 lines · Qiaowei Ren
+ * This module is expected to be a better tool to access below
+ resourcesExpected to be or is? :)
"is" :)
Quoted 12 lines
Quoted 1 line
+ * Data is currently found below
You're adding it to ABI, so it shouldn't just be current - are you planning on moving it at any point? Is this functionality that should be under securityfs instead?
drivers/platform/x86/intel_txt/txt-sysfs.c line 23
Quoted 1 line
drivers/platform/x86/intel_txt/txt-sysfs.c new file +1
-0+ txt_pdev =platform_device_register_simple (DEV_NAME ,-1 ,NULL ,0 );This will register even if there's no TXT support on the platform, right? Is there no mechanism for determining whether a platform has TXT support before registering a device?
Quoted 5 lines
drivers/platform/x86/intel_txt/txt-sysfs.c line 36
Quoted 2 lines
drivers/platform/x86/intel_txt/txt-sysfs.c new file +2
-0+module_init (txt_sysfs_init); +module_exit (txt_sysfs_exit);And you've got no module aliases, so this will never be autoloaded. How does the OS know that the platform implements TXT?
Currently this driver only depends on CONFIG_INTEL_TXT, which is the kernel option for enabling Intel TXT support. And there is no explicit interface to check whether txt is supported in this txt enabling part of kernel. But since the tboot code will detect whether the platform actually supports Intel TXT, and so tboot_enabled() in include/linux/tboot.h may be used to determine whether a platform has TXT support.
In fact, we may also check CPU feature ECX[6] (SMX) for this purpose.
Thanks,
Qiaowei
PATCH 2/4 driver: provide sysfs interfaces to access TXT config space
In reply to Qiaowei RenThese interfaces are located in /sys/devices/platform/intel_txt/config, and including totally 37 files, providing access to Intel TXT configuration registers.
--- Documentation/ABI/testing/sysfs-platform-intel-txt | 309 ++++++ drivers/platform/x86/intel_txt/Makefile | 2 +- drivers/platform/x86/intel_txt/txt-config.c | 1032 ++++++++++++++++++++ drivers/platform/x86/intel_txt/txt-config.h | 138 +++ drivers/platform/x86/intel_txt/txt-sysfs.c | 12 + 5 files changed, 1492 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-platform-intel-txt create mode 100644 drivers/platform/x86/intel_txt/txt-config.c create mode 100644 drivers/platform/x86/intel_txt/txt-config.h
Documentation/ABI/testing/sysfs-platform-intel-txt new file +309 -0
@@ -0,0 +1,309 @@ +What: /sys/devices/platform/intel_txt/config/ +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The config/ directory exposes Intel TXT configuration + registers. These registers are a subset of chipset registers. + They are mapped into two regions of memory, representing the + public and private configuration spaces. + + Registers in the private space can only be accessed after a + measured environment has been established and before the + TXT.CMD.CLOSE-PRIVATE command has been issued. The public space + registers are available before, during and after a measured + environment launch. All registers are available within both + spaces, though with different permissions. + +What: /sys/devices/platform/intel_txt/config/STS_raw +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.STS is the general status register. This read-only register + is used by AC modules and the MLE to get the status of various + Intel TXT features. + +What: /sys/devices/platform/intel_txt/config/STS_enter_done +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The chipset sets SENTER.DONE.STS status bit when it sees all + of the threads have done an TXT.CYC.SENTER-ACK. + +What: /sys/devices/platform/intel_txt/config/STS_sexit_done +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: SEXIT.DONE.STS status bit is set when all of the bits in the + TXT.THREADS.JOIN register are clear. Thus, this bit will be + set immediately after reset. + +What: /sys/devices/platform/intel_txt/config/STS_mem_config_lock +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: MEM-CONFIG-LOCK.STS status bit will be set to 1 when the memory + configuration has been locked. Cleared by + TXT.CMD.UNLOCK.MEMCONFIG or by a system reset. + +What: /sys/devices/platform/intel_txt/config/STS_private_open +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: PRIVATE-OPEN.STS status bit will be set to 1 when + TXT.CMD.OPEN-PRIVATE is performed. Cleared by + TXT.CMD.CLOSE-PRIVATE or by a system reset. + +What: /sys/devices/platform/intel_txt/config/STS_locality_1_open +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.LOCALITY1.OPEN.STS status bit is set when the + TXT.CMD.OPEN.LOCALITY1 command is seen by the chipset. + It is cleared on reset or when TXT.CMD.CLOSE.LOCALITY1 is seen. + +What: /sys/devices/platform/intel_txt/config/STS_locality_2_open +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.LOCALITY2.OPEN.STS status bit is set when either the + TXT.CMD.OPEN.LOCALITY2 command or the TXT.CMD.OPEN.PRIVATE + is seen by the chipset. It is cleared on reset, when either + TXT.CMD.CLOSE.LOCALITY2 or TXT.CMD.CLOSE.PRIVATE is seen, + and by the GETSEC[SEXIT] instruction. + +What: /sys/devices/platform/intel_txt/config/ESTS_raw +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.ESTS is the error status register which contains status + information associated with various error conditions. The + contents of this read-only register are preserved across + soft resets. + +What: /sys/devices/platform/intel_txt/config/ESTS_intel_txt_reset +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT_RESET.STS bit is set to '1' to indicate that an event + occurred which may prevent the proper use of TXT (possibly + including a TXT reset). + +What: /sys/devices/platform/intel_txt/config/ERRORCODE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.ERRORCODE register holds the Intel TXT shutdown error code. + A soft reset does not clear the contents of this register; + a hard reset/power cycle will clear the contents. This was + formerly labeled the TXT.CRASH register. + +What: /sys/devices/platform/intel_txt/config/CMD_RESET +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: A write to TXT.CMD.RESET register causes a system reset. + This is performed by the processor as part of an Intel TXT + shutdown, after writing to the TXT.ERRORCODE register. + +What: /sys/devices/platform/intel_txt/config/CMD_CLOSE_PRIVATE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: A write to TXT.CMD.CLOSE-PRIVATE register causes the Intel + TXT-capable chipset private configuration space to be locked. + Locality 2 will also be closed. Once locked, conventional + memory read/write operations can no longer be used to access + these registers. The private configuration space can only be + opened for the MLE by successfully executing GETSEC[SENTER]. + +What: /sys/devices/platform/intel_txt/config/VER_FSBIF +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.VER.FSBIF register identifies whether the chipset is + debug or release fused. + +What: /sys/devices/platform/intel_txt/config/DIDVID_raw +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.DIDVID register contains the vendor, device, and revision + IDs for the memory controller or chipset. + +What: /sys/devices/platform/intel_txt/config/DIDVID_vendor_id +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Vendor ID. + +What: /sys/devices/platform/intel_txt/config/DIDVID_device_id +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Device ID. + +What: /sys/devices/platform/intel_txt/config/DIDVID_revision_id +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Revision ID. + +What: /sys/devices/platform/intel_txt/config/VER_QPIIF +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.VER.QPIIF register identifies whether the memory + controller or chipset is debug or release fused. + +What: /sys/devices/platform/intel_txt/config/CMD_UNLOCK_MEM_CONFIG +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: When TXT.CMD.UNLOCK-MEM-CONFIG command is invoked, the + chipset unlocks all memory configuration registers. + +What: /sys/devices/platform/intel_txt/config/SINIT_BASE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.SINIT.BASE register contains the physical base address + of the memory region set aside by the BIOS for loading an + SINIT AC module. If BIOS has provided an SINIT AC module, + it will be located at this address. System software that + provides an SINIT AC module must store it to this location. + +What: /sys/devices/platform/intel_txt/config/SINIT_SIZE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.SINIT.SIZE register contains the size (in bytes) of + the memory region set aside by the BIOS for loading an + SINIT AC module. This register is initialized by the BIOS. + +What: /sys/devices/platform/intel_txt/config/MLE_JOIN +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Holds a physical address pointer to the base of the join + data structure used to initialize RLPs in response to + GETSEC[WAKEUP]. + +What: /sys/devices/platform/intel_txt/config/HEAP_BASE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.HEAP.BASE register contains the physical base address + of the Intel TXT Heap memory region. The BIOS initializes + this register. + +What: /sys/devices/platform/intel_txt/config/HEAP_SIZE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.HEAP.SIZE register contains the size (in bytes) of the + Intel TXT Heap memory region. The BIOS initializes this + register. + +What: /sys/devices/platform/intel_txt/config/DPR_raw +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.DPR register defines the DMA Protected Range of memory + in which the TXT heap and SINIT region are located. + +What: /sys/devices/platform/intel_txt/config/DPR_lock +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Bits 19:0 are locked down in this register when this Lock + bit is set. + +What: /sys/devices/platform/intel_txt/config/DPR_top +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Top address + 1 of DPR. + +What: /sys/devices/platform/intel_txt/config/DPR_size +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: This is the size of memory, in MB, that will be protected from + DMA accesses. A value of 0x00 in this field means no additional + memory is protected. + +What: /sys/devices/platform/intel_txt/config/CMD_OPEN_LOCALITY1 +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Writing to this TXT.CMD.OPEN.LOCALITY1 register "opens" the + TPM locality 1 address range, enabling decoding by the chipset + and thus access to the TPM. + +What: /sys/devices/platform/intel_txt/config/CMD_CLOSE_LOCALITY1 +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Writing to this TXT.CMD.CLOSE.LOCALITY1 register "closes" the + TPM locality 1 address range, disabling decoding by the chipset + and thus access to the TPM. + +What: /sys/devices/platform/intel_txt/config/CMD_OPEN_LOCALITY2 +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Writing to this TXT.CMD.OPEN.LOCALITY2 register "opens" the + TPM locality 2 address range, enabling decoding by the chipset + and thus access to the TPM. + +What: /sys/devices/platform/intel_txt/config/CMD_CLOSE_LOCALITY2 +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Writing to this TXT.CMD.CLOSE.LOCALITY2 register "closes" the + TPM locality 2 address range, disabling decoding by the chipset + and thus access to the TPM. + +What: /sys/devices/platform/intel_txt/config/PUBLIC_KEY +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: This read-only TXT.PUBLIC.KEY register contains the hash of + the public key used for the verification of AC Modules. + The size, hash algorithm, and value are specific to the memory + controller or chipset. + +What: /sys/devices/platform/intel_txt/config/CMD_SECRETS +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Writing to this TXT.CMD.SECRETS register indicates to the + chipset that there are secrets in memory. The chipset tracks + this fact with a sticky bit. If the platform reboots with this + sticky bit set the BIOS AC module (or BIOS on multiprocessor + TXT systems) will scrub memory. The chipset also uses this + bit to detect invalid sleep state transitions. If software + tries to transition to S3, S4, or S5 while secrets are in + memory then the chipset will reset the system. + +What: /sys/devices/platform/intel_txt/config/CMD_NO_SECRETS +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Writing to this TXT.CMD.NO-SECRETS register indicates there + are no secrets in memory. + +What: /sys/devices/platform/intel_txt/config/E2STS_raw +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: This TXT.E2STS register is used to read the status associated + with various errors that might be detected. + +What: /sys/devices/platform/intel_txt/config/E2STS_secrets +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: 0 = Chipset acknowledges that no secrets are in memory. + 1 = Chipset believes that secrets are in memory and will + provide reset protection.
drivers/platform/x86/intel_txt/Makefile +1 -1
@@ -2,4 +2,4 @@ # Makefile for the intel TXT drivers. # obj-$(CONFIG_INTEL_TXT_DRIVER) += intel_txt.o -intel_txt-y := txt-sysfs.o +intel_txt-y := txt-sysfs.o txt-config.o
drivers/platform/x86/intel_txt/txt-config.c new file +1032 -0
1,032 lines not on this page · raw message
drivers/platform/x86/intel_txt/txt-config.h new file +138 -0
138 lines not on this page · raw message
drivers/platform/x86/intel_txt/txt-sysfs.c +12 -0
@@ -15,16 +15,28 @@#include <linux/platform_device.h> #include <linux/sysfs.h> +#include "txt-config.h" +#define DEV_NAME "intel_txt"static struct platform_device *txt_pdev;static int __init txt_sysfs_init (void ) { +int retval; + txt_pdev =platform_device_register_simple (DEV_NAME ,-1 ,NULL ,0 );if (IS_ERR (txt_pdev))return PTR_ERR (txt_pdev); + retval =sysfs_create_config (&txt_pdev->dev.kobj); +if (retval) + goto err; +return 0 ; + +err: +platform_device_unregister (txt_pdev); +return retval; } static void __exit txt_sysfs_exit(void)
Signature · 1 line
1.7.9.5
Re: [PATCH 2/4] driver: provide sysfs interfaces to access TXT config space
Documentation/ABI/testing/sysfs-platform-intel-txt
Quoted 3 lines · Qiaowei Ren
Documentation/ABI/testing/sysfs-platform-intel-txt new file +3
-0+ Registers in the private space can only be accessed after a + measured environment has been established and before the + TXT.CMD.CLOSE-PRIVATE command has been issued.
Is userspace ever going to be running in this situation?
Documentation/ABI/testing/sysfs-platform-intel-txt line 23
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +7
-0+What: /sys/devices/platform/intel_txt/config/STS_raw +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.STS is the general status register. This read-only register + is used by AC modules and the MLE to get the status of various + Intel TXT features.
AC? MLE?
Documentation/ABI/testing/sysfs-platform-intel-txt line 30
Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +6
-0+What: /sys/devices/platform/intel_txt/config/STS_enter_done +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The chipset sets SENTER.DONE.STS status bit when it sees all + of the threads have done an TXT.CYC.SENTER-ACK.
All of which threads? It might be worth adding a general introduction to TXT in Documentation and referencing it in these entries.
Documentation/ABI/testing/sysfs-platform-intel-txt line 38
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +7
-0+What: /sys/devices/platform/intel_txt/config/STS_sexit_done +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: SEXIT.DONE.STS status bit is set when all of the bits in the + TXT.THREADS.JOIN register are clear. Thus, this bit will be + set immediately after reset.
It will? When will it be clear? What would userspace ever want this for?
Documentation/ABI/testing/sysfs-platform-intel-txt line 173
Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +6
-0+Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.SINIT.BASE register contains the physical base address + of the memory region set aside by the BIOS for loading an + SINIT AC module. If BIOS has provided an SINIT AC module, + it will be located at this address. System software that + provides an SINIT AC module must store it to this location.
Why would userspace ever care about this?
Documentation/ABI/testing/sysfs-platform-intel-txt line 181
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +7
-0+What: /sys/devices/platform/intel_txt/config/SINIT_SIZE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.SINIT.SIZE register contains the size (in bytes) of + the memory region set aside by the BIOS for loading an + SINIT AC module. This register is initialized by the BIOS.
Or this?
Documentation/ABI/testing/sysfs-platform-intel-txt line 189
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +7
-0+What: /sys/devices/platform/intel_txt/config/MLE_JOIN +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: Holds a physical address pointer to the base of the join + data structure used to initialize RLPs in response to + GETSEC[WAKEUP].
RLPs?
Documentation/ABI/testing/sysfs-platform-intel-txt line 197
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +7
-0+What: /sys/devices/platform/intel_txt/config/HEAP_BASE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.HEAP.BASE register contains the physical base address + of the Intel TXT Heap memory region. The BIOS initializes + this register.
Again, it doesn't seem obvious why userspace would ever want this...
Documentation/ABI/testing/sysfs-platform-intel-txt line 205
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-intel-txt new file +7
-0+What: /sys/devices/platform/intel_txt/config/HEAP_SIZE +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: TXT.HEAP.SIZE register contains the size (in bytes) of the + Intel TXT Heap memory region. The BIOS initializes this + register.
Or this.
Basically, don't just define what these files do - make it clear why they'd be used. Right now I have no idea whether these are diagnostic, likely to be used during runtime or basically completely useless.
drivers/platform/x86/intel_txt/txt-config.c line 528
Quoted 5 lines
drivers/platform/x86/intel_txt/txt-config.c new file +5
-0+static ssize_t txt_show_ERRORCODE (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return show_config (buf, off_ERRORCODE); +}
Much as I usually hate it, these all seem pretty boilerplate. It would arguably be cleaner to replace them all with something like:
#define config_func(x) static size_t txt_show_x(struct device *dev, struct device_attribute *attr, char *buf) { return show_config(buf off_x);}\ntxt_store_x(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { blah blah
config_func(ERRORCODE)config_func(ESTS_raw)
and so on.
drivers/platform/x86/intel_txt/txt-config.c line 1029
Quoted 5 lines
drivers/platform/x86/intel_txt/txt-config.c new file +5
-0+int sysfs_create_config (struct kobject *parent) +{ +return sysfs_create_group (parent, &config_attr_grp); +} +EXPORT_SYMBOL_GPL (sysfs_create_config);
This doesn't seem right. You're linking this into the existing txt module - you don't need to export symbols.
Quoted 1 line
+MODULE_LICENSE("GPL");
Or declare a module license.
Signature · 1 line
Matthew Garrett | [email protected]
PATCH 3/4 driver: provide sysfs interfaces to access TXT log
In reply to Qiaowei RenThese interfaces are located in /sys/devices/platform/intel_txt/log/.
--- Documentation/ABI/testing/sysfs-platform-intel-txt | 28 +++++ drivers/platform/x86/intel_txt/Makefile | 2 +- drivers/platform/x86/intel_txt/txt-log.c | 131 ++++++++++++++++++++ drivers/platform/x86/intel_txt/txt-log.h | 27 ++++ drivers/platform/x86/intel_txt/txt-sysfs.c | 5 + 5 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 drivers/platform/x86/intel_txt/txt-log.c create mode 100644 drivers/platform/x86/intel_txt/txt-log.h
Documentation/ABI/testing/sysfs-platform-intel-txt +28 -0
@@ -307,3 +307,31 @@ Contact: "Qiaowei Ren" <[email protected]> Description: 0 = Chipset acknowledges that no secrets are in memory. 1 = Chipset believes that secrets are in memory and will provide reset protection. + +What: /sys/devices/platform/intel_txt/log/ +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The log/ directory exposes tboot log memory. + +What: /sys/devices/platform/intel_txt/log/log_header +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "log_header" property will output log header, including + max_size and curr_pos. + +What: /sys/devices/platform/intel_txt/log/block +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "block" property will dump pure log in block style, + 1 page size. + +What: /sys/devices/platform/intel_txt/log/block_index +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "block_index" property allows you to set the block + index for output. +
drivers/platform/x86/intel_txt/Makefile +1 -1
@@ -2,4 +2,4 @@ # Makefile for the intel TXT drivers. # obj-$(CONFIG_INTEL_TXT_DRIVER) += intel_txt.o -intel_txt-y := txt-sysfs.o txt-config.o +intel_txt-y := txt-sysfs.o txt-config.o txt-log.o
drivers/platform/x86/intel_txt/txt-log.c new file +131 -0
131 lines not on this page · raw message
drivers/platform/x86/intel_txt/txt-log.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef __LOG_H__ +#define __LOG_H__ + +struct uuid { +uint32_t data1; +uint16_t data2; +uint16_t data3; +uint16_t data4; +uint8_t data5[6 ]; +} __packed; + +struct tboot_log { +struct uuid uuid; +uint32_t max_size; +uint32_t curr_pos; +char buf[]; +}; + +#define TBOOT_LOG_UUID {0xc0192526, 0x6b30, 0x4db4, 0x844c, \ + {0xa3, 0xe9, 0x53, 0xb8, 0x81, 0x74} } +#define TBOOT_SERIAL_LOG_ADDR 0x60000 +#define TBOOT_SERIAL_LOG_SIZE 0x08000 + +extern int sysfs_create_log (struct kobject *parent); + +#endif /* __LOG_H__ */ +
drivers/platform/x86/intel_txt/txt-sysfs.c +5 -0
@@ -16,6 +16,7 @@#include <linux/sysfs.h> #include "txt-config.h" +#include "txt-log.h" #define DEV_NAME "intel_txt"static struct platform_device *txt_pdev;
@@ -32,6 +33,10 @@ static int __init txt_sysfs_init(void)if (retval) goto err; + retval =sysfs_create_log (&txt_pdev->dev.kobj); +if (retval) + goto err; +return 0 ; err:
Signature · 1 line
1.7.9.5
Re: [PATCH 3/4] driver: provide sysfs interfaces to access TXT log
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 319
Quoted 3 lines · Qiaowei Ren
Documentation/ABI/testing/sysfs-platform-intel-txt +3
-0+What: /sys/devices/platform/intel_txt/log/log_header +Date: May 2013 +KernelVersion: 3.9
How different are these logs to the TPM measurements exported via securityfs?
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 336
Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/log/block_index +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "block_index" property allows you to set the block + index for output.
So I write a value here and then I see different chunks of log? This doesn't seem like an optimal interface. What do these logs actually contain? How do I know which block I should be reading?
drivers/platform/x86/intel_txt/txt-log.c line 25
Quoted 5 lines
drivers/platform/x86/intel_txt/txt-log.c new file +5
-0+static int are_uuids_equal (const struct uuid *uuid1, +const struct uuid *uuid2) +{ +return (memcmp (uuid1, uuid2,sizeof (*uuid1)) ==0 ) ?1 :0 ; +}
Use one of the uuidcmp functions from uuid.h?
drivers/platform/x86/intel_txt/txt-log.c line 130
Quoted 3 lines
drivers/platform/x86/intel_txt/txt-log.c new file +3
-0+EXPORT_SYMBOL_GPL (sysfs_create_log); + +MODULE_LICENSE ("GPL" );
Same as for the previous patch - you don't need these.
drivers/platform/x86/intel_txt/txt-log.h line 10
Quoted 7 lines
drivers/platform/x86/intel_txt/txt-log.h new file +7
-0+struct uuid { +uint32_t data1; +uint16_t data2; +uint16_t data3; +uint16_t data4; +uint8_t data5[6 ]; +} __packed;
There's already UUID structures in uuid.h
drivers/platform/x86/intel_txt/txt-log.h line 20
Quoted 2 lines
drivers/platform/x86/intel_txt/txt-log.h new file +2
-0+#define TBOOT_LOG_UUID {0xc0192526, 0x6b30, 0x4db4, 0x844c, \ + {0xa3, 0xe9, 0x53, 0xb8, 0x81, 0x74} }
uuid.h again.
Signature · 1 line
Matthew Garrett | [email protected]
RE: [PATCH 3/4] driver: provide sysfs interfaces to access TXT log
Quoted 8 lines · Matthew Garrett
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 319
Quoted 3 lines · Qiaowei Ren
Documentation/ABI/testing/sysfs-platform-intel-txt +3
-0+What: /sys/devices/platform/intel_txt/log/log_header +Date: May 2013 +KernelVersion: 3.9How different are these logs to the TPM measurements exported via securityfs?
These logs come from tboot (Trusted Boot, an open source, pre-kernel/VMM module that uses Intel® Trusted Execution Technology (Intel® TXT) to perform a measured and verified launch of an OS kernel/VMM.), and should be different from those TPM measurements (from BIOS?) exported via security.
Quoted 10 lines
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 336
Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/log/block_index +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "block_index" property allows you to set the block + index for output.So I write a value here and then I see different chunks of log? This doesn't seem like an optimal interface. What do these logs actually contain? How do I know which block I should be reading?
Yes. Since total log size is bigger than one page 4K, the log have to be displayed in 4K-block indexed by block_index. These logs will be very helpful for txt related debugging.
Thanks,
Qiaowei
Re: [PATCH 3/4] driver: provide sysfs interfaces to access TXT log
Quoted 5 lines · Qiaowei
Quoted 2 lines · Matthew Garrett
How different are these logs to the TPM measurements exported via securityfs?
These logs come from tboot (Trusted Boot, an open source, pre-kernel/VMM module that uses Intel® Trusted Execution Technology (Intel® TXT) to perform a measured and verified launch of an OS kernel/VMM.), and should be different from those TPM measurements (from BIOS?) exported via security.
Different in what way? What are they actually logging?
Quoted 6 lines
Quoted 3 lines
So I write a value here and then I see different chunks of log? This doesn't seem like an optimal interface. What do these logs actually contain? How do I know which block I should be reading?
Yes. Since total log size is bigger than one page 4K, the log have to be displayed in 4K-block indexed by
block_index. These logs will be very helpful for txt related debugging.
If they're only intended for debugging then sysfs probably isn't the best place for them. debugfs might make more sense.
Signature · 1 line
Matthew Garrett | [email protected]
RE: [PATCH 3/4] driver: provide sysfs interfaces to access TXT log
Quoted 11 lines · Matthew Garrett
Quoted 5 lines · Qiaowei
Quoted 2 lines · Matthew Garrett
How different are these logs to the TPM measurements exported via securityfs?
These logs come from tboot (Trusted Boot, an open source, pre-kernel/VMM
module that uses Intel® Trusted Execution Technology (Intel® TXT) to perform a measured and verified launch of an OS kernel/VMM.), and should be different from those TPM measurements (from BIOS?) exported via security.
Different in what way? What are they actually logging?
Tboot log should also contain txt heap memory content, a lot of event log, etc.
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
So I write a value here and then I see different chunks of log? This doesn't seem like an optimal interface. What do these logs actually contain? How do I know which block I should be reading?
Yes. Since total log size is bigger than one page 4K, the log have to be
displayed in 4K-block indexed by
block_index.Quoted 1 line
These logs will be very helpful for txt related debugging.
If they're only intended for debugging then sysfs probably isn't the best place for them. debugfs might make more sense.
Yes. Debugfs seems to be better choice. Maybe we need to further consider the purpose of outputting tboot log. So I will temporarily remove this feature from this patch.
Thanks,
Qiaowei
PATCH 4/4 driver: provide sysfs interfaces to access SMX parameter
In reply to Qiaowei RenThese interfaces are located in /sys/devices/platform/intel_txt/parameter/, showing specific parameter information for SMX features supported by the processor.
--- Documentation/ABI/testing/sysfs-platform-intel-txt | 65 +++++ drivers/platform/x86/intel_txt/Makefile | 2 +- drivers/platform/x86/intel_txt/txt-parameter.c | 253 ++++++++++++++++++++ drivers/platform/x86/intel_txt/txt-parameter.h | 40 ++++ drivers/platform/x86/intel_txt/txt-sysfs.c | 5 + 5 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 drivers/platform/x86/intel_txt/txt-parameter.c create mode 100644 drivers/platform/x86/intel_txt/txt-parameter.h
Documentation/ABI/testing/sysfs-platform-intel-txt +65 -0
@@ -335,3 +335,68 @@ Contact: "Qiaowei Ren" <[email protected]> Description: The "block_index" property allows you to set the block index for output. +What: /sys/devices/platform/intel_txt/parameter/ +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The parameter/ directory exposes specific parameter + information for SMX features supported by the processor. + +What: /sys/devices/platform/intel_txt/parameter/acm_max_size +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_size" property will show max size of + authenticated code execution area. + +What: /sys/devices/platform/intel_txt/parameter/acm_mem_types +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_types" property will show external memory + types supported during AC mode. + +What: /sys/devices/platform/intel_txt/parameter/senter_controls +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "senter_controls" property will show selective SENTER + functionality control. + +What: /sys/devices/platform/intel_txt/parameter/preserve_mce +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "preserve_mce" property produces a '1' if machine + check status registers can be preserved through ENTERACCS + and SENTER. + +What: /sys/devices/platform/intel_txt/parameter/proc_based_scrtm +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "proc_based_scrtm" property produces a '1' if this + processor implements a processorrooted S-CRTM capability + and '0' if not (S-CRTM is rooted in BIOS). + +What: /sys/devices/platform/intel_txt/parameter/n_versions +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "n_versions" property will show AC module version + numbers supported. + +What: /sys/devices/platform/intel_txt/parameter/acm_version +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_version" property will output supported AC + module version, including version comparison mask and + version index. + +What: /sys/devices/platform/intel_txt/parameter/acm_version_index +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_version_index" property allows you to set the + version index for output.
drivers/platform/x86/intel_txt/Makefile +1 -1
@@ -2,4 +2,4 @@ # Makefile for the intel TXT drivers. # obj-$(CONFIG_INTEL_TXT_DRIVER) += intel_txt.o -intel_txt-y := txt-sysfs.o txt-config.o txt-log.o +intel_txt-y := txt-sysfs.o txt-config.o txt-log.o txt-parameter.o
drivers/platform/x86/intel_txt/txt-parameter.c new file +253 -0
253 lines not on this page · raw message
drivers/platform/x86/intel_txt/txt-parameter.h new file +40 -0
@@ -0,0 +1,40 @@ +#ifndef __PARAMETER_H__ +#define __PARAMETER_H__ + +#define CR4_SMXE 0x00004000 +#define MAX_SUPPORTED_ACM_VERSIONS 16 + +#define DEF_ACM_MAX_SIZE 0x8000 +#define DEF_ACM_VER_MASK 0xffffffff +#define DEF_ACM_VER_SUPPORTED 0x00 +#define DEF_ACM_MEM_TYPES 0x0100 +#define DEF_SENTER_CTRLS 0x00 + +#define IA32_GETSEC_OPCODE ".byte 0x0f,0x37" +#define IA32_GETSEC_PARAMETERS 6 + +#define off_n_versions 1 +#define off_acm_max_size 2 +#define off_acm_mem_types 3 +#define off_senter_controls 4 +#define off_proc_based_scrtm 5 +#define off_preserve_mce 6 +#define off_acm_version 7 + +typedef struct getsec_parameters { +struct { +uint32_t mask; +uint32_t version; + } acm_versions[MAX_SUPPORTED_ACM_VERSIONS ]; +int n_versions; +uint32_t acm_max_size; +uint32_t acm_mem_types; +uint32_t senter_controls; +bool proc_based_scrtm; +bool preserve_mce; +}getsec_parameters_t ; + +extern int sysfs_create_parameter (struct kobject *parent); + +#endif /* __PARAMETER_H__ */ +
drivers/platform/x86/intel_txt/txt-sysfs.c +5 -0
@@ -17,6 +17,7 @@#include "txt-config.h" #include "txt-log.h" +#include "txt-parameter.h" #define DEV_NAME "intel_txt"static struct platform_device *txt_pdev;
@@ -37,6 +38,10 @@ static int __init txt_sysfs_init(void)if (retval) goto err; + retval =sysfs_create_parameter (&txt_pdev->dev.kobj); +if (retval) + goto err; +return 0 ; err:
Signature · 1 line
1.7.9.5
Re: [PATCH 4/4] driver: provide sysfs interfaces to access SMX parameter
Quoted 3 lines · Qiaowei Ren
These interfaces are located in
/sys/devices/platform/intel_txt/parameter/, showing specific parameter information for SMX features supported by the processor.
Explain what SMX is here.
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 343
Quoted 3 lines
Documentation/ABI/testing/sysfs-platform-intel-txt +3
-0+Contact: "Qiaowei Ren" <[email protected]> +Description: The parameter/ directory exposes specific parameter + information for SMX features supported by the processor.
Also here.
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 350
Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/parameter/acm_max_size +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_size" property will show max size of + authenticated code execution area.
What would userspace use this for?
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 357
Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/parameter/acm_mem_types +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_types" property will show external memory + types supported during AC mode.
Or this? And what's AC mode?
drivers/platform/x86/intel_txt/txt-parameter.c line 28
Quoted 5 lines
drivers/platform/x86/intel_txt/txt-parameter.c new file +5
-0+static void __getsec_parameters (uint32_t index,int *param_type, +uint32_t *peax,uint32_t *pebx, +uint32_t *pecx) +{ +uint32_t eax =0 , ebx =0 , ecx =0 ;
These are all going to be overwritten by the getsec operation? Do they really need to be initialised?
drivers/platform/x86/intel_txt/txt-parameter.c line 37
Quoted 8 lines
drivers/platform/x86/intel_txt/txt-parameter.c new file +8
-0+ __asm__ __volatile__ (IA32_GETSEC_OPCODE "\n" + :"=a" (eax),"=b" (ebx),"=c" (ecx) + :"a" (IA32_GETSEC_PARAMETERS ),"b" (index)); + + *param_type = eax &0x1f ; + *peax = eax; + *pebx = ebx; + *pecx = ecx;
Should there be a check for failure here? Is it possible for this operation to fail?
drivers/platform/x86/intel_txt/txt-parameter.c line 45
Quoted 1 line
drivers/platform/x86/intel_txt/txt-parameter.c new file +1
-0+write_cr4 (read_cr4 () |CR4_SMXE );
Whoo. This needs at least a giant comment and probably some locking, but if this is supposed to be set during runtime then it should be done in core architecture code rather than just in this driver.
drivers/platform/x86/intel_txt/txt-parameter.c line 206
Quoted 1 line
drivers/platform/x86/intel_txt/txt-parameter.c new file +1
-0+sscanf (buf,"%d" , &index);
What if this fails?
drivers/platform/x86/intel_txt/txt-parameter.c line 252
Quoted 3 lines
drivers/platform/x86/intel_txt/txt-parameter.c new file +3
-0+EXPORT_SYMBOL_GPL (sysfs_create_parameter); + +MODULE_LICENSE ("GPL" );
Not needed.
Quoted 1 line
+#define
IA32_GETSEC_OPCODE".byte 0x0f,0x37"
Nnf. Does the assembler really not know about this instruction?
Signature · 1 line
Matthew Garrett | [email protected]
RE: [PATCH 4/4] driver: provide sysfs interfaces to access SMX parameter
Quoted 10 lines · Matthew Garrett
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 350
Quoted 6 lines · Qiaowei Ren
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/parameter/acm_max_size +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_size" property will show max size of + authenticated code execution area.What would userspace use this for?
These sysfs files are just export SMX & TXT related information to userspace. So that other developers (or OSV & ISV) can be able to develop txt related applications or tools based on these information.
Quoted 8 lines
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 357
Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/parameter/acm_mem_types +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_types" property will show external memory + types supported during AC mode.Or this? And what's AC mode?
It means that the property will show supportable memory types for memory mapped outside of the authenticated code execution area.
Quoted 10 lines
drivers/platform/x86/intel_txt/txt-parameter.c line 37
Quoted 8 lines
drivers/platform/x86/intel_txt/txt-parameter.c new file +8
-0+ __asm__ __volatile__ (IA32_GETSEC_OPCODE "\n" + :"=a" (eax),"=b" (ebx),"=c" (ecx) + :"a" (IA32_GETSEC_PARAMETERS ),"b" (index)); + + *param_type = eax &0x1f ; + *peax = eax; + *pebx = ebx; + *pecx = ecx;Should there be a check for failure here? Is it possible for this operation to fail?
You mean GETSEC instruction? I don't notice related description in manual. Next function get_parameters() will process return eax/ebx/ecx returned by this instruction.
Quoted 5 lines
drivers/platform/x86/intel_txt/txt-parameter.c line 45
Quoted 1 line
drivers/platform/x86/intel_txt/txt-parameter.c new file +1
-0+write_cr4 (read_cr4 () |CR4_SMXE );Whoo. This needs at least a giant comment and probably some locking, but if this is supposed to be set during runtime then it should be done in core architecture code rather than just in this driver.
Oh. This code should be removed, because tboot code have set SMXE bit.
Thanks,
Qiaowei
Re: [PATCH 4/4] driver: provide sysfs interfaces to access SMX parameter
Quoted 12 lines · Qiaowei
Quoted 10 lines · Matthew Garrett
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 350
Quoted 6 lines · Qiaowei Ren
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/parameter/acm_max_size +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_size" property will show max size of + authenticated code execution area.What would userspace use this for?
Quoted 1 line
These sysfs files are just export SMX & TXT related information to userspace. So that other developers (or OSV & ISV) can be able to develop txt related applications or tools based on these information.
If they're only using it for debugging purposes then sysfs probably isn't the right place. Is there any reason tools would need to know this during normal usage?
Signature · 1 line
Matthew Garrett | [email protected]
RE: [PATCH 4/4] driver: provide sysfs interfaces to access SMX parameter
Quoted 13 lines · Matthew Garrett
Quoted 12 lines · Qiaowei
Quoted 10 lines · Matthew Garrett
Documentation/ABI/testing/sysfs-platform-intel-txt Contact: "Qiaowei Ren" <[email protected]> · line 350
Quoted 6 lines · Qiaowei Ren
Documentation/ABI/testing/sysfs-platform-intel-txt +6
-0+What: /sys/devices/platform/intel_txt/parameter/acm_max_size +Date: May 2013 +KernelVersion: 3.9 +Contact: "Qiaowei Ren" <[email protected]> +Description: The "acm_max_size" property will show max size of + authenticated code execution area.What would userspace use this for?
Quoted 6 lines
Quoted 1 line
These sysfs files are just export SMX & TXT related information to userspace.
So that other developers (or OSV & ISV) can be able to develop txt related applications or tools based on these information.
If they're only using it for debugging purposes then sysfs probably
isn't the right place. Is there any reason tools would need to know this during normal usage?
Unlike tboot log, these properties are not used for debugging purposes.
They are used to report attributes, options and limitations of SMX operation. Software may use them to identify operations limits or additional options.
Thanks,
Qiaowei
Quoted 4 lines · Qiaowei Ren
This module is expected to be a better tool to access below resources
- TXT config space
- Tboot log mem
- SMX parameter
What's SMX?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Qiaowei Ren
This module is expected to be a better tool to access below resources
- TXT config space
- Tboot log mem
- SMX parameterWhat's SMX?
Safer Mode Extensions (SMX) provide a programming interface for system software to establish a measured environment within the platform to support trust decisions by end users. SMX functionality is provided in an Intel 64 processor through the GETSEC instruction via leaf functions.
Thanks,
Qiaowei
Quoted 10 lines · Qiaowei
Quoted 7 lines · Matthew Garrett
Quoted 4 lines · Qiaowei Ren
This module is expected to be a better tool to access below resources
- TXT config space
- Tboot log mem
- SMX parameterWhat's SMX?
Safer Mode Extensions (SMX) provide a programming interface for system software to establish a measured environment within the platform to support trust decisions by end users. SMX functionality is provided in an Intel 64 processor through the GETSEC instruction via leaf functions.
Great. Can you include that in the patches and help text?
Signature · 1 line
Matthew Garrett | [email protected]
Quoted 8 lines · Matthew Garrett
Quoted 7 lines · Qiaowei
Quoted 6 lines · Matthew Garrett
Quoted 4 lines · Qiaowei Ren
This module is expected to be a better tool to access below resources
- TXT config space
- Tboot log mem
- SMX parameter
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
What's SMX?
Safer Mode Extensions (SMX) provide a programming interface for system
software to establish a measured environment within the platform to support trust decisions by end users. SMX functionality is provided in an Intel 64 processor through the GETSEC instruction via leaf functions.
Great. Can you include that in the patches and help text?
Ok.
Thanks,
Qiaowei