[PATCH v10 04/20] x86: Secure Launch main header file

2024-08-26 Thread Ross Philipson
Introduce the main Secure Launch header file used in the early SL stub and the early setup code. Signed-off-by: Ross Philipson --- include/linux/slaunch.h | 548 1 file changed, 548 insertions(+) create mode 100644 include/linux/slaunch.h diff --git a/i

[PATCH v10 00/20] x86: Trenchboot secure dynamic launch Linux kernel support

2024-08-26 Thread Ross Philipson
The larger focus of the TrenchBoot project (https://github.com/TrenchBoot) is to enhance the boot security and integrity in a unified manner. The first area of focus has been on the Trusted Computing Group's Dynamic Launch for establishing a hardware Root of Trust for Measurement, also know as DRTM

[PATCH v10 20/20] x86/efi: EFI stub DRTM launch support for Secure Launch

2024-08-26 Thread Ross Philipson
This support allows the DRTM launch to be initiated after an EFI stub launch of the Linux kernel is done. This is accomplished by providing a handler to jump to when a Secure Launch is in progress. This has to be called after the EFI stub does Exit Boot Services. Signed-off-by: Ross Philipson ---

[PATCH v10 19/20] x86: Secure Launch late initcall platform module

2024-08-26 Thread Ross Philipson
From: "Daniel P. Smith" The Secure Launch platform module is a late init module. During the init call, the TPM event log is read and measurements taken in the early boot stub code are located. These measurements are extended into the TPM PCRs using the mainline TPM kernel driver. The platform mo

[PATCH v10 18/20] tpm: Add sysfs interface to allow setting and querying the default locality

2024-08-26 Thread Ross Philipson
Expose a sysfs interface to allow user mode to set and query the default locality set for the TPM chip. Signed-off-by: Ross Philipson --- drivers/char/tpm/tpm-sysfs.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/t

[PATCH v10 17/20] tpm: Add ability to set the default locality the TPM chip uses

2024-08-26 Thread Ross Philipson
Curently the locality is hard coded to 0 but for DRTM support, access is needed to localities 1 through 4. Signed-off-by: Ross Philipson --- drivers/char/tpm/tpm-chip.c | 24 +++- include/linux/tpm.h | 4 2 files changed, 27 insertions(+), 1 deletion(-) diff --

[PATCH v10 16/20] tpm: Make locality requests return consistent values

2024-08-26 Thread Ross Philipson
From: "Daniel P. Smith" The function tpm_tis_request_locality() is expected to return the locality value that was requested, or a negative error code upon failure. If it is called while locality_count of struct tis_data is non-zero, no actual locality request will be sent. Because the ret variabl

[PATCH v10 15/20] tpm: Ensure tpm is in known state at startup

2024-08-26 Thread Ross Philipson
From: "Daniel P. Smith" When tis_tis_core initializes, it assumes all localities are closed. There are cases when this may not be the case. This commit addresses this by ensuring all localities are closed before initializing begins. Signed-off-by: Daniel P. Smith Signed-off-by: Ross Philipson

[PATCH v10 14/20] tpm: Protect against locality counter underflow

2024-08-26 Thread Ross Philipson
From: "Daniel P. Smith" Commit 933bfc5ad213 introduced the use of a locality counter to control when a locality request is allowed to be sent to the TPM. In the commit, the counter is indiscriminately decremented. Thus creating a situation for an integer underflow of the counter. Signed-off-by:

[PATCH v10 13/20] x86/reboot: Secure Launch SEXIT support on reboot paths

2024-08-26 Thread Ross Philipson
If the MLE kernel is being powered off, rebooted or halted, then SEXIT must be called. Note that the SEXIT GETSEC leaf can only be called after a machine_shutdown() has been done on these paths. The machine_shutdown() is not called on a few paths like when poweroff action does not have a poweroff c

[PATCH v10 12/20] kexec: Secure Launch kexec SEXIT support

2024-08-26 Thread Ross Philipson
Prior to running the next kernel via kexec, the Secure Launch code closes down private SMX resources and does an SEXIT. This allows the next kernel to start normally without any issues starting the APs etc. Signed-off-by: Ross Philipson --- arch/x86/kernel/slaunch.c | 72

[PATCH v10 09/20] x86: Secure Launch kernel early boot stub

2024-08-26 Thread Ross Philipson
The Secure Launch (SL) stub provides the entry point for Intel TXT (and later AMD SKINIT) to vector to during the late launch. The symbol sl_stub_entry is that entry point and its offset into the kernel is conveyed to the launching code using the MLE (Measured Launch Environment) header in the stru

[PATCH v10 11/20] x86: Secure Launch SMP bringup support

2024-08-26 Thread Ross Philipson
On Intel, the APs are left in a well documented state after TXT performs the late launch. Specifically they cannot have #INIT asserted on them so a standard startup via INIT/SIPI/SIPI cannot be performed. Instead the early SL stub code uses MONITOR and MWAIT to park the APs. The realmode/init.c cod

[PATCH v10 10/20] x86: Secure Launch kernel late boot stub

2024-08-26 Thread Ross Philipson
The routine slaunch_setup is called out of the x86 specific setup_arch() routine during early kernel boot. After determining what platform is present, various operations specific to that platform occur. This includes finalizing setting for the platform late launch and verifying that memory protecti

[PATCH v10 08/20] x86/boot: Place TXT MLE header in the kernel_info section

2024-08-26 Thread Ross Philipson
The MLE (measured launch environment) header must be locatable by the boot loader and TXT must be setup to do a launch with this header's location. While the offset to the kernel_info structure does not need to be at a fixed offset, the offsets in the header must be relative offsets from the start

[PATCH v10 01/20] Documentation/x86: Secure Launch kernel documentation

2024-08-26 Thread Ross Philipson
From: "Daniel P. Smith" Introduce background, overview and configuration/ABI information for the Secure Launch kernel feature. Signed-off-by: Daniel P. Smith Signed-off-by: Ross Philipson Reviewed-by: Bagas Sanjaya --- Documentation/security/index.rst | 1 + .../security/launc

[PATCH v10 07/20] x86/msr: Add variable MTRR base/mask and x2apic ID registers

2024-08-26 Thread Ross Philipson
These values are needed by Secure Launch to locate particular CPUs during AP startup and to restore the MTRR state after a TXT launch. Signed-off-by: Ross Philipson --- arch/x86/include/asm/msr-index.h | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/ar

[PATCH v10 06/20] x86: Add early SHA-256 support for Secure Launch early measurements

2024-08-26 Thread Ross Philipson
From: "Daniel P. Smith" The SHA-256 algorithm is necessary to measure configuration information into the TPM as early as possible before using the values. This implementation uses the established approach of #including the SHA-256 libraries directly in the code since the compressed kernel is not

[PATCH v10 05/20] x86: Add early SHA-1 support for Secure Launch early measurements

2024-08-26 Thread Ross Philipson
From: "Daniel P. Smith" Secure Launch is written to be compliant with the Intel TXT Measured Launch Developer's Guide. The MLE Guide dictates that the system can be configured to use both the SHA-1 and SHA-2 hashing algorithms. Regardless of the preference towards SHA-2, if the firmware elected

[PATCH v10 03/20] x86: Secure Launch Resource Table header file

2024-08-26 Thread Ross Philipson
Introduce the Secure Launch Resource Table which forms the formal interface between the pre and post launch code. Signed-off-by: Ross Philipson --- include/linux/slr_table.h | 276 ++ 1 file changed, 276 insertions(+) create mode 100644 include/linux/slr_tabl

[PATCH v10 02/20] x86: Secure Launch Kconfig

2024-08-26 Thread Ross Philipson
Initial bits to bring in Secure Launch functionality. Add Kconfig options for compiling in/out the Secure Launch code. Signed-off-by: Ross Philipson --- arch/x86/Kconfig | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 007bab9f2a0e..24df5