You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: specs/unified_kernel_image.md
+38-16Lines changed: 38 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,11 @@ or through a boot loader
15
15
(which is generally useful to allow multiple kernel versions with interactive or
16
16
automatic selection of version to boot into).
17
17
18
-
Various components of the UKI are provided as PE/COFF sections of the executable.
19
-
The stub is a small program that can be executed in UEFI mode
20
-
that forms the main executable part of the combined image.
21
-
The stub program loads other resources from its file,
22
-
including in particular the kernel and initrd,
23
-
and transitions into the kernel.
18
+
Various components of the UKI are provided as PE/COFF sections of the
19
+
executable. The stub is a small program that can be executed in UEFI
20
+
mode that forms the initial executable part of the combined image.
21
+
The stub program loads other resources from its executable, including
22
+
in particular the kernel and initrd, and transitions into the kernel.
24
23
25
24
This specification defines the format and components (mandatory and optional) of UKIs.
26
25
@@ -40,22 +39,45 @@ that glues the listed components together, generating one PE binary that then ca
40
39
UKIs consist of the following resources:
41
40
42
41
* An UEFI boot stub that forms the initial program.
43
-
It contains various sections normally required for a program,
42
+
It contains various PE sections normally required for a program,
44
43
including `.text`, `.reloc`, `.data`, and others.
45
-
* The Linux kernel in the `.linux` section.
46
-
* The initrd that the kernel shall unpack and invoke, in the `.initrd` section.
47
-
* Optionally, the kernel command line in the `.cmdline` section. If this is absent, the loader implementation may allow local overrides instead.
44
+
* The Linux kernel in the `.linux` PE section.
48
45
* Optionally, information describing the OS this kernel is intended for, in the `.osrel` section. The contents of this section are derived from `/etc/os-release` of the target OS. They can be useful for presentation of the UKI in the boot loader menu, and ordering it against other entries using the included version information.
49
-
* Optionally, information describing kernel release information (i.e. `uname -r` output) in the `.uname` section. This is also useful for presentation of the UKI in the boot loader menu, and ordering it against other entries.
46
+
* Optionally, the kernel command line in the `.cmdline` section. If this is absent, the loader implementation may allow local overrides instead.
47
+
* The initrd that the kernel shall unpack and invoke, in the `.initrd` section.
50
48
* Optionally, a splash image to bring to screen before transitioning into the Linux kernel, in the `.splash` section.
51
49
* Optionally, one or more compiled Device Trees, for systems which need it, each in its separate `.dtb` section. If multiple `.dtb` sections exist then one of them is selected according to an implementation-specific algorithm.
52
-
* Optionally, the public part of a public-private key pair in PEM format used to sign the image, in the `.pcrpkey` section.
53
-
* Optionally, a JSON file encoding expected PCR 11 hash values seen from userspace once the UKI has booted up, along with signatures of these expected PCR 11 hash values, in the `.pcrsig` section. The signatures must also match the abovementioned key pair.
50
+
* Optionally, information describing kernel release information (i.e. `uname -r` output) in the `.uname` section. This is also useful for presentation of the UKI in the boot loader menu, and ordering it against other entries.
54
51
* Optionally, a CSV file encoding the SBAT metadata for the image, in the `.sbat` section. The [SBAT format is defined by the Shim project](https://github.com/rhboot/shim/blob/main/SBAT.md), and used for UEFI revocation purposes.
52
+
* Optionally, a JSON file encoding expected PCR 11 hash values seen from userspace once the UKI has booted up, along with signatures of these expected PCR 11 hash values, in the `.pcrsig` section. The signatures must also match the key pair described below.
53
+
* Optionally, the public part of a public-private key pair in PEM format used to sign the expected PCR 11 value of the image, in the `.pcrpkey` section.
54
+
55
+
Note that all of the sections defined above are singletons: they may
56
+
appear once at most – except for the `.dtb` section which may
57
+
appear more than once.
58
+
59
+
## UKI TPM PCR Measurements
60
+
61
+
On systems with a Trusted Platform Module (TPM) the UEFI boot stub
62
+
shall measure the payload sections (i.e. the PE sections listed above,
63
+
starting from the `.linux` one), in the order as listed above (which
64
+
should be considered the *canonical**order*).
65
+
66
+
For each section two measurements shall be made into PCR 11 with the
67
+
event code `EV_IPL`:
68
+
69
+
1. The section name in ASCII (including one trailing NUL byte)
70
+
2. The (binary) section contents
71
+
72
+
The above should be repeated for every section defined above, so that
73
+
the measurements are interleaved: section name followed by section
74
+
data, followed by the next section name and its section data, and so
75
+
on.
55
76
56
-
Note that all of the sections defined above are singletons: they may appear once at most – except for the `.dtb` section which may be appear more than once.
77
+
If multiple `.dtb` sections are present, they shall be measured in the
78
+
order they appear in the PE file.
57
79
58
-
###JSON Format for `.pcrsig`
80
+
## JSON Format for `.pcrsig`
59
81
The format is a single JSON object, encoded as a zero-terminated `UTF-8` string. Each name in the object
60
82
shall be unique as per recommendations of
61
83
[RFC8259](https://datatracker.ietf.org/doc/html/rfc8259#section-4). Strings shall not contain any control
@@ -108,7 +130,7 @@ through single file atomic updates, which is useful given that the primary expec
108
130
UKIs is the UEFI System Partition (ESP), which is a vFAT file system, with its limited data safety guarantees.
109
131
110
132
## Security
111
-
Given UKIs are regular UEFI PE files, they can thus be signed as one for SecureBoot, protecting all of the
133
+
Given UKIs are regular UEFI PE files, they can thus be signed as one for Secure Boot, protecting all of the
112
134
individual resources listed above at once, and their combination. Standard Linux tools such as
113
135
[`sbsigntool`](https://manpages.debian.org/unstable/sbsigntool/sbsign.1.en.html) and
114
136
[`pesign`](https://github.com/rhboot/pesign) can be used to sign UKI files. The signature format and process
0 commit comments