Skip to content

Commit 3ae684e

Browse files
committed
Merge branch 'x86-txt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-txt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, tboot: Add support for S3 memory integrity protection
2 parents c4fd308 + 4bd96a7 commit 3ae684e

4 files changed

Lines changed: 37 additions & 17 deletions

File tree

‎Documentation/intel_txt.txt‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ o In order to put a system into any of the sleep states after a TXT
161161
has been restored, it will restore the TPM PCRs and then
162162
transfer control back to the kernel's S3 resume vector.
163163
In order to preserve system integrity across S3, the kernel
164-
provides tboot with a set of memory ranges (kernel
165-
code/data/bss, S3 resume code, and AP trampoline) that tboot
166-
will calculate a MAC (message authentication code) over and then
167-
seal with the TPM. On resume and once the measured environment
168-
has been re-established, tboot will re-calculate the MAC and
169-
verify it against the sealed value. Tboot's policy determines
170-
what happens if the verification fails.
164+
provides tboot with a set of memory ranges (RAM and RESERVED_KERN
165+
in the e820 table, but not any memory that BIOS might alter over
166+
the S3 transition) that tboot will calculate a MAC (message
167+
authentication code) over and then seal with the TPM. On resume
168+
and once the measured environment has been re-established, tboot
169+
will re-calculate the MAC and verify it against the sealed value.
170+
Tboot's policy determines what happens if the verification fails.
171+
Note that the c/s 194 of tboot which has the new MAC code supports
172+
this.
171173

172174
That's pretty much it for TXT support.
173175

‎MAINTAINERS‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,6 +2953,17 @@ S: Odd Fixes
29532953
F: Documentation/networking/README.ipw2200
29542954
F: drivers/net/wireless/ipw2x00/ipw2200.*
29552955

2956+
INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
2957+
M: Joseph Cihula <joseph.cihula@intel.com>
2958+
M: Shane Wang <shane.wang@intel.com>
2959+
L: tboot-devel@lists.sourceforge.net
2960+
W: http://tboot.sourceforge.net
2961+
T: Mercurial http://www.bughost.org/repos.hg/tboot.hg
2962+
S: Supported
2963+
F: Documentation/intel_txt.txt
2964+
F: include/linux/tboot.h
2965+
F: arch/x86/kernel/tboot.c
2966+
29562967
INTEL WIRELESS WIMAX CONNECTION 2400
29572968
M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
29582969
M: linux-wimax@intel.com

‎arch/x86/include/asm/e820.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@
4545
#define E820_NVS 4
4646
#define E820_UNUSABLE 5
4747

48-
/* reserved RAM used by kernel itself */
48+
/*
49+
* reserved RAM used by kernel itself
50+
* if CONFIG_INTEL_TXT is enabled, memory of this type will be
51+
* included in the S3 integrity calculation and so should not include
52+
* any memory that BIOS might alter over the S3 transition
53+
*/
4954
#define E820_RESERVED_KERN 128
5055

5156
#ifndef __ASSEMBLY__

‎arch/x86/kernel/tboot.c‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ static void add_mac_region(phys_addr_t start, unsigned long size)
175175
struct tboot_mac_region *mr;
176176
phys_addr_t end = start + size;
177177

178+
if (tboot->num_mac_regions >= MAX_TB_MAC_REGIONS)
179+
panic("tboot: Too many MAC regions\n");
180+
178181
if (start && size) {
179182
mr = &tboot->mac_regions[tboot->num_mac_regions++];
180183
mr->start = round_down(start, PAGE_SIZE);
@@ -184,18 +187,17 @@ static void add_mac_region(phys_addr_t start, unsigned long size)
184187

185188
static int tboot_setup_sleep(void)
186189
{
190+
int i;
191+
187192
tboot->num_mac_regions = 0;
188193

189-
/* S3 resume code */
190-
add_mac_region(acpi_wakeup_address, WAKEUP_SIZE);
194+
for (i = 0; i < e820.nr_map; i++) {
195+
if ((e820.map[i].type != E820_RAM)
196+
&& (e820.map[i].type != E820_RESERVED_KERN))
197+
continue;
191198

192-
#ifdef CONFIG_X86_TRAMPOLINE
193-
/* AP trampoline code */
194-
add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE);
195-
#endif
196-
197-
/* kernel code + data + bss */
198-
add_mac_region(virt_to_phys(_text), _end - _text);
199+
add_mac_region(e820.map[i].addr, e820.map[i].size);
200+
}
199201

200202
tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
201203

0 commit comments

Comments
 (0)