Re: [PATCH v16 15/38] Documentation/security: Secure Launch kernel documentation

2026-05-15 Thread Randy Dunlap



On 5/15/26 2:13 PM, Ross Philipson wrote:
> From: "Daniel P. Smith" 
> 
> Introduce documentation for the Linux Secure Launch feature.
> 
> Co-developed-by: Ross Philipson 
> Signed-off-by: Daniel P. Smith 
> Signed-off-by: Ross Philipson 
> ---
>  Documentation/arch/x86/boot.rst   |   8 +
>  Documentation/security/index.rst  |   1 +
>  .../security/launch-integrity/index.rst   |   9 +
>  .../launch-integrity/secure_launch.rst| 681 ++
>  4 files changed, 699 insertions(+)
>  create mode 100644 Documentation/security/launch-integrity/index.rst
>  create mode 100644 Documentation/security/launch-integrity/secure_launch.rst
> 


> diff --git a/Documentation/security/launch-integrity/secure_launch.rst 
> b/Documentation/security/launch-integrity/secure_launch.rst
> new file mode 100644
> index ..b4c61fdceaf0
> --- /dev/null
> +++ b/Documentation/security/launch-integrity/secure_launch.rst
> @@ -0,0 +1,681 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +.. Copyright (c) 2019-2026 Daniel P. Smith 
> +
> +==
> +Secure Launch Overview
> +==
> +
> +:Author: Daniel P. Smith
> +:Date: February 2026

maybe update?

> +
> +Overview
> +

[snip]

> +Error Codes
> +===
> +
> +The TXT specification defines the layout for TXT 32 bit error code values.

32-bit

> +The bit encodings indicate where the error originated (e.g. with the CPU,
> +in the SINIT ACM, in software). The error is written to a sticky TXT
> +register that persists across resets called TXT.ERRORCODE (see the TXT
> +MLE Development Guide). The errors defined by the Secure Launch feature are
> +those generated in the MLE software. They have the format::
> +
> +  0xc0008XXX
> +
> +The low 12 bits are free for defining the following Secure Launch specific
> +error codes.

[snip]

> +Resources
> +=
> +
> +The TrenchBoot project:
> +
> +https://trenchboot.org
> +
> +Secure Launch Specification:
> +
> +https://trenchboot.org/specifications/Secure_Launch/
> +
> +Trusted Computing Group's D-RTM Architecture:
> +
> +https://trustedcomputinggroup.org/wp-content/uploads/TCG_D-RTM_Architecture_v1-0_Published_06172013.pdf
> +
> +TXT documentation in the Intel TXT MLE Development Guide:
> +
> +https://www.intel.com/content/dam/www/public/us/en/documents/guides/intel-txt-software-development-guide.pdf
> +
> +TXT instructions documentation in the Intel SDM Instruction Set volume:
> +
> +https://software.intel.com/en-us/articles/intel-sdm
> +
> +AMD SKINIT documentation in the System Programming manual:
> +
> +https://www.amd.com/system/files/TechDocs/24593.pdf
> +
> +GRUB Secure Launch support:
> +
> +https://github.com/TrenchBoot/grub/tree/grub-sl-fc-38-dlstub
> +
> +FOSDEM 2021: Secure Upgrades with DRTM
> +
> +https://archive.fosdem.org/2021/schedule/event/firmware_suwd/
> +
> +.. [1]
> +MLE: Measured Launch Environment is the binary runtime that is measured 
> and
> +then run by the TXT SINIT ACM. The TXT MLE Development Guide describes 
> the
> +requirements for the MLE in detail.
> +
> +.. [2]
> +PMR: Intel VTd has a feature in the IOMMU called Protected Memory 
> Registers.
> +There are two of these registers and they allow all DMA to be blocked
> +to large areas of memory. The low PMR can cover all memory below 4Gb on 
> 2Mb
> +boundaries. The high PMR can cover all RAM on the system, again on 2Mb
> +boundaries. This feature is used during a Secure Launch by TXT.
> +
> +.. [3]
> +Secure Launch Specification: 
> https://trenchboot.org/specifications/Secure_Launch/
> +
> +.. [4]
> +ACM: Intel's Authenticated Code Module. This is the 32b bit binary blob 
> that

Does "32b" mean something or should that be 32-bit?

> +is run securely by the GETSEC[SENTER] during a measured launch. It is 
> described
> +in the Intel documentation on TXT and versions for various chipsets are
> +signed and distributed by Intel.

-- 
~Randy




[PATCH v16 15/38] Documentation/security: Secure Launch kernel documentation

2026-05-15 Thread Ross Philipson
From: "Daniel P. Smith" 

Introduce documentation for the Linux Secure Launch feature.

Co-developed-by: Ross Philipson 
Signed-off-by: Daniel P. Smith 
Signed-off-by: Ross Philipson 
---
 Documentation/arch/x86/boot.rst   |   8 +
 Documentation/security/index.rst  |   1 +
 .../security/launch-integrity/index.rst   |   9 +
 .../launch-integrity/secure_launch.rst| 681 ++
 4 files changed, 699 insertions(+)
 create mode 100644 Documentation/security/launch-integrity/index.rst
 create mode 100644 Documentation/security/launch-integrity/secure_launch.rst

diff --git a/Documentation/arch/x86/boot.rst b/Documentation/arch/x86/boot.rst
index dca3875a2435..eb53da9dcbbf 100644
--- a/Documentation/arch/x86/boot.rst
+++ b/Documentation/arch/x86/boot.rst
@@ -482,6 +482,14 @@ Protocol:  2.00+
- If 1, KASLR enabled.
- If 0, KASLR disabled.
 
+  Bit 2 (kernel internal): SLAUNCH_FLAG
+
+   - Used internally by the setup kernel to communicate
+ Secure Launch status to the kernel proper.
+
+   - If 1, Secure Launch enabled.
+   - If 0, Secure Launch disabled.
+
   Bit 5 (write): QUIET_FLAG
 
- If 0, print early messages.
diff --git a/Documentation/security/index.rst b/Documentation/security/index.rst
index 3e0a7114a862..f89741271ed0 100644
--- a/Documentation/security/index.rst
+++ b/Documentation/security/index.rst
@@ -20,3 +20,4 @@ Security Documentation
landlock
secrets/index
ipe
+   launch-integrity/index
diff --git a/Documentation/security/launch-integrity/index.rst 
b/Documentation/security/launch-integrity/index.rst
new file mode 100644
index ..fb9f63f01056
--- /dev/null
+++ b/Documentation/security/launch-integrity/index.rst
@@ -0,0 +1,9 @@
+=
+System Launch Integrity documentation
+=
+
+.. toctree::
+   :maxdepth: 3
+
+   secure_launch
+
diff --git a/Documentation/security/launch-integrity/secure_launch.rst 
b/Documentation/security/launch-integrity/secure_launch.rst
new file mode 100644
index ..b4c61fdceaf0
--- /dev/null
+++ b/Documentation/security/launch-integrity/secure_launch.rst
@@ -0,0 +1,681 @@
+.. SPDX-License-Identifier: GPL-2.0
+.. Copyright (c) 2019-2026 Daniel P. Smith 
+
+==
+Secure Launch Overview
+==
+
+:Author: Daniel P. Smith
+:Date: February 2026
+
+Overview
+
+
+The TrenchBoot project initiated development of the Secure Launch kernel
+feature to establish a generalized framework for dynamic root-of-trust
+measurement (DRTM). The effort addresses two core objectives: (1) exposing the
+platform-specific launch protocols (e.g., Intel TXT, AMD SKINIT, Arm DRTM, and
+potentially OpenPOWER) directly to the Linux kernel, and (2) enabling the
+kernel to act as the dynamic launch initiator. This design provides the
+necessary foundation for the Linux kernel to support a broad range of dynamic
+launch use cases without platform-specific user-space intermediaries.
+
+.. note::
+A quick note on terminology. The larger open source project itself is
+called TrenchBoot, which is hosted on GitHub (links below). The kernel
+feature enabling the use of the x86 technology is referred to as "Secure
+Launch" within the kernel code.
+
+Goals
+=
+
+The primary use case initially targeted by the TrenchBoot project is the
+ability for the Linux kernel to be launched via a dynamic launch during the
+early boot sequence. In this scenario, the dynamic launch is initiated by a
+bootloader that has been extended with Secure Launch support. The first
+bootloader targeted was GRUB2.
+
+An essential part of establishing measurement-based launch integrity is
+ensuring that all components intended for execution (kernel image, initrd,
+etc.) and all configuration data that will affect kernel execution (command
+line, boot parameters, etc.) are measured prior to execution. These
+measurements are then stored securely using the Trusted Platform Module (TPM).
+
+Both Intel TXT and AMD dynamic launch implementations use the TPM for this
+purpose. The architecture is designed so that a dynamic launch unlocks a
+specific set of Platform Configuration Registers (PCRs) reserved for DRTM
+(Dynamic Root of Trust for Measurement) measurements. These registers are known
+as the **DRTM PCRs** (PCRs 17-22).
+
+Further details on the hardware mechanisms are documented in Intel's Trusted
+Execution Technology specification for the ``GETSEC`` instruction and AMD's
+documentation for the ``SKINIT`` instruction. See the `Resources` section for
+references.
+
+.. note::
+Currently, only Intel TXT is supported in this first release of the Secure
+Launch feature. AMD/Hygon SKINIT and Arm support will be added in a
+subsequent release.
+
+To enable the Linux kernel to be launched via the Intel ``GETSEC`` instruction,
+a Secure Launch entry point is built into