Commit 1aaf2e59 authored by Linus Torvalds's avatar Linus Torvalds

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, intel_txt: clean up the impact on generic code, unbreak non-x86
  x86, intel_txt: Handle ACPI_SLEEP without X86_TRAMPOLINE
  x86, intel_txt: Fix typos in Kconfig help
  x86, intel_txt: Factor out the code for S3 setup
  x86, intel_txt: tboot.c needs <asm/fixmap.h>
  intel_txt: Force IOMMU on for Intel TXT launch
  x86, intel_txt: Intel TXT Sx shutdown support
  x86, intel_txt: Intel TXT reboot/halt shutdown support
  x86, intel_txt: Intel TXT boot support
parents 66a4fe0c 936e894a
This diff is collapsed.
...@@ -12,6 +12,7 @@ Offset Proto Name Meaning ...@@ -12,6 +12,7 @@ Offset Proto Name Meaning
000/040 ALL screen_info Text mode or frame buffer information 000/040 ALL screen_info Text mode or frame buffer information
(struct screen_info) (struct screen_info)
040/014 ALL apm_bios_info APM BIOS information (struct apm_bios_info) 040/014 ALL apm_bios_info APM BIOS information (struct apm_bios_info)
058/008 ALL tboot_addr Physical address of tboot shared page
060/010 ALL ist_info Intel SpeedStep (IST) BIOS support information 060/010 ALL ist_info Intel SpeedStep (IST) BIOS support information
(struct ist_info) (struct ist_info)
080/010 ALL hd0_info hd0 disk parameter, OBSOLETE!! 080/010 ALL hd0_info hd0 disk parameter, OBSOLETE!!
......
...@@ -179,6 +179,10 @@ config ARCH_SUPPORTS_OPTIMIZED_INLINING ...@@ -179,6 +179,10 @@ config ARCH_SUPPORTS_OPTIMIZED_INLINING
config ARCH_SUPPORTS_DEBUG_PAGEALLOC config ARCH_SUPPORTS_DEBUG_PAGEALLOC
def_bool y def_bool y
config HAVE_INTEL_TXT
def_bool y
depends on EXPERIMENTAL && DMAR && ACPI
# Use the generic interrupt handling code in kernel/irq/: # Use the generic interrupt handling code in kernel/irq/:
config GENERIC_HARDIRQS config GENERIC_HARDIRQS
bool bool
......
...@@ -85,7 +85,8 @@ struct efi_info { ...@@ -85,7 +85,8 @@ struct efi_info {
struct boot_params { struct boot_params {
struct screen_info screen_info; /* 0x000 */ struct screen_info screen_info; /* 0x000 */
struct apm_bios_info apm_bios_info; /* 0x040 */ struct apm_bios_info apm_bios_info; /* 0x040 */
__u8 _pad2[12]; /* 0x054 */ __u8 _pad2[4]; /* 0x054 */
__u64 tboot_addr; /* 0x058 */
struct ist_info ist_info; /* 0x060 */ struct ist_info ist_info; /* 0x060 */
__u8 _pad3[16]; /* 0x070 */ __u8 _pad3[16]; /* 0x070 */
__u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */
......
...@@ -131,6 +131,9 @@ enum fixed_addresses { ...@@ -131,6 +131,9 @@ enum fixed_addresses {
#endif #endif
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
FIX_WP_TEST, FIX_WP_TEST,
#endif
#ifdef CONFIG_INTEL_TXT
FIX_TBOOT_BASE,
#endif #endif
__end_of_fixed_addresses __end_of_fixed_addresses
}; };
......
...@@ -52,6 +52,7 @@ obj-$(CONFIG_X86_DS_SELFTEST) += ds_selftest.o ...@@ -52,6 +52,7 @@ obj-$(CONFIG_X86_DS_SELFTEST) += ds_selftest.o
obj-$(CONFIG_X86_32) += tls.o obj-$(CONFIG_X86_32) += tls.o
obj-$(CONFIG_IA32_EMULATION) += tls.o obj-$(CONFIG_IA32_EMULATION) += tls.o
obj-y += step.o obj-y += step.o
obj-$(CONFIG_INTEL_TXT) += tboot.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-y += cpu/ obj-y += cpu/
obj-y += acpi/ obj-y += acpi/
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/efi.h> #include <linux/efi.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/tboot.h>
#include <acpi/reboot.h> #include <acpi/reboot.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/apic.h> #include <asm/apic.h>
...@@ -508,6 +509,8 @@ static void native_machine_emergency_restart(void) ...@@ -508,6 +509,8 @@ static void native_machine_emergency_restart(void)
if (reboot_emergency) if (reboot_emergency)
emergency_vmx_disable_all(); emergency_vmx_disable_all();
tboot_shutdown(TB_SHUTDOWN_REBOOT);
/* Tell the BIOS if we want cold or warm reboot */ /* Tell the BIOS if we want cold or warm reboot */
*((unsigned short *)__va(0x472)) = reboot_mode; *((unsigned short *)__va(0x472)) = reboot_mode;
...@@ -634,6 +637,8 @@ static void native_machine_halt(void) ...@@ -634,6 +637,8 @@ static void native_machine_halt(void)
/* stop other cpus and apics */ /* stop other cpus and apics */
machine_shutdown(); machine_shutdown();
tboot_shutdown(TB_SHUTDOWN_HALT);
/* stop this cpu */ /* stop this cpu */
stop_this_cpu(NULL); stop_this_cpu(NULL);
} }
...@@ -645,6 +650,8 @@ static void native_machine_power_off(void) ...@@ -645,6 +650,8 @@ static void native_machine_power_off(void)
machine_shutdown(); machine_shutdown();
pm_power_off(); pm_power_off();
} }
/* a fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
} }
struct machine_ops machine_ops = { struct machine_ops machine_ops = {
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/crash_dump.h> #include <linux/crash_dump.h>
#include <linux/tboot.h>
#include <video/edid.h> #include <video/edid.h>
...@@ -977,6 +978,8 @@ void __init setup_arch(char **cmdline_p) ...@@ -977,6 +978,8 @@ void __init setup_arch(char **cmdline_p)
paravirt_pagetable_setup_done(swapper_pg_dir); paravirt_pagetable_setup_done(swapper_pg_dir);
paravirt_post_allocator_init(); paravirt_post_allocator_init();
tboot_probe();
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
map_vsyscall(); map_vsyscall();
#endif #endif
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/nmi.h> #include <linux/nmi.h>
#include <linux/tboot.h>
#include <asm/acpi.h> #include <asm/acpi.h>
#include <asm/desc.h> #include <asm/desc.h>
...@@ -1318,6 +1319,7 @@ void play_dead_common(void) ...@@ -1318,6 +1319,7 @@ void play_dead_common(void)
void native_play_dead(void) void native_play_dead(void)
{ {
play_dead_common(); play_dead_common();
tboot_shutdown(TB_SHUTDOWN_WFS);
wbinvd_halt(); wbinvd_halt();
} }
......
This diff is collapsed.
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include "accommon.h" #include "accommon.h"
#include "actables.h" #include "actables.h"
#include <linux/tboot.h>
#define _COMPONENT ACPI_HARDWARE #define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwsleep") ACPI_MODULE_NAME("hwsleep")
...@@ -342,6 +343,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) ...@@ -342,6 +343,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE(); ACPI_FLUSH_CPU_CACHE();
tboot_sleep(sleep_state, pm1a_control, pm1b_control);
/* Write #2: Write both SLP_TYP + SLP_EN */ /* Write #2: Write both SLP_TYP + SLP_EN */
status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control); status = acpi_hw_write_pm1_control(pm1a_control, pm1b_control);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/tboot.h>
#undef PREFIX #undef PREFIX
#define PREFIX "DMAR:" #define PREFIX "DMAR:"
...@@ -413,6 +414,12 @@ parse_dmar_table(void) ...@@ -413,6 +414,12 @@ parse_dmar_table(void)
*/ */
dmar_table_detect(); dmar_table_detect();
/*
* ACPI tables may not be DMA protected by tboot, so use DMAR copy
* SINIT saved in SinitMleData in TXT heap (which is DMA protected)
*/
dmar_tbl = tboot_get_dmar_table(dmar_tbl);
dmar = (struct acpi_table_dmar *)dmar_tbl; dmar = (struct acpi_table_dmar *)dmar_tbl;
if (!dmar) if (!dmar)
return -ENODEV; return -ENODEV;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/iommu.h> #include <linux/iommu.h>
#include <linux/intel-iommu.h> #include <linux/intel-iommu.h>
#include <linux/sysdev.h> #include <linux/sysdev.h>
#include <linux/tboot.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/iommu.h> #include <asm/iommu.h>
#include "pci.h" #include "pci.h"
...@@ -3183,12 +3184,22 @@ static int __init init_iommu_sysfs(void) ...@@ -3183,12 +3184,22 @@ static int __init init_iommu_sysfs(void)
int __init intel_iommu_init(void) int __init intel_iommu_init(void)
{ {
int ret = 0; int ret = 0;
int force_on = 0;
if (dmar_table_init()) /* VT-d is required for a TXT/tboot launch, so enforce that */
force_on = tboot_force_iommu();
if (dmar_table_init()) {
if (force_on)
panic("tboot: Failed to initialize DMAR table\n");
return -ENODEV; return -ENODEV;
}
if (dmar_dev_scope_init()) if (dmar_dev_scope_init()) {
if (force_on)
panic("tboot: Failed to initialize DMAR device scope\n");
return -ENODEV; return -ENODEV;
}
/* /*
* Check the need for DMA-remapping initialization now. * Check the need for DMA-remapping initialization now.
...@@ -3204,6 +3215,8 @@ int __init intel_iommu_init(void) ...@@ -3204,6 +3215,8 @@ int __init intel_iommu_init(void)
ret = init_dmars(); ret = init_dmars();
if (ret) { if (ret) {
if (force_on)
panic("tboot: Failed to initialize DMARs\n");
printk(KERN_ERR "IOMMU: dmar init failed\n"); printk(KERN_ERR "IOMMU: dmar init failed\n");
put_iova_domain(&reserved_iova_list); put_iova_domain(&reserved_iova_list);
iommu_exit_mempool(); iommu_exit_mempool();
......
/*
* tboot.h: shared data structure with tboot and kernel and functions
* used by kernel for runtime support of Intel(R) Trusted
* Execution Technology
*
* Copyright (c) 2006-2009, Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#ifndef _LINUX_TBOOT_H
#define _LINUX_TBOOT_H
/* these must have the values from 0-5 in this order */
enum {
TB_SHUTDOWN_REBOOT = 0,
TB_SHUTDOWN_S5,
TB_SHUTDOWN_S4,
TB_SHUTDOWN_S3,
TB_SHUTDOWN_HALT,
TB_SHUTDOWN_WFS
};
#ifdef CONFIG_INTEL_TXT
#include <acpi/acpi.h>
/* used to communicate between tboot and the launched kernel */
#define TB_KEY_SIZE 64 /* 512 bits */
#define MAX_TB_MAC_REGIONS 32
struct tboot_mac_region {
u64 start; /* must be 64 byte -aligned */
u32 size; /* must be 64 byte -granular */
} __packed;
/* GAS - Generic Address Structure (ACPI 2.0+) */
struct tboot_acpi_generic_address {
u8 space_id;
u8 bit_width;
u8 bit_offset;
u8 access_width;
u64 address;
} __packed;
/*
* combines Sx info from FADT and FACS tables per ACPI 2.0+ spec
* (http://www.acpi.info/)
*/
struct tboot_acpi_sleep_info {
struct tboot_acpi_generic_address pm1a_cnt_blk;
struct tboot_acpi_generic_address pm1b_cnt_blk;
struct tboot_acpi_generic_address pm1a_evt_blk;
struct tboot_acpi_generic_address pm1b_evt_blk;
u16 pm1a_cnt_val;
u16 pm1b_cnt_val;
u64 wakeup_vector;
u32 vector_width;
u64 kernel_s3_resume_vector;
} __packed;
/*
* shared memory page used for communication between tboot and kernel
*/
struct tboot {
/*
* version 3+ fields:
*/
/* TBOOT_UUID */
u8 uuid[16];
/* version number: 5 is current */
u32 version;
/* physical addr of tb_log_t log */
u32 log_addr;
/*
* physical addr of entry point for tboot shutdown and
* type of shutdown (TB_SHUTDOWN_*) being requested
*/
u32 shutdown_entry;
u32 shutdown_type;
/* kernel-specified ACPI info for Sx shutdown */
struct tboot_acpi_sleep_info acpi_sinfo;
/* tboot location in memory (physical) */
u32 tboot_base;
u32 tboot_size;
/* memory regions (phys addrs) for tboot to MAC on S3 */
u8 num_mac_regions;
struct tboot_mac_region mac_regions[MAX_TB_MAC_REGIONS];
/*
* version 4+ fields:
*/
/* symmetric key for use by kernel; will be encrypted on S3 */
u8 s3_key[TB_KEY_SIZE];
/*
* version 5+ fields:
*/
/* used to 4byte-align num_in_wfs */
u8 reserved_align[3];
/* number of processors in wait-for-SIPI */
u32 num_in_wfs;
} __packed;
/*
* UUID for tboot data struct to facilitate matching
* defined as {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} by tboot, which is
* represented as {} in the char array used here
*/
#define TBOOT_UUID {0xff, 0x8d, 0x3c, 0x66, 0xb3, 0xe8, 0x82, 0x4b, 0xbf,\
0xaa, 0x19, 0xea, 0x4d, 0x5, 0x7a, 0x8}
extern struct tboot *tboot;
static inline int tboot_enabled(void)
{
return tboot != NULL;
}
extern void tboot_probe(void);
extern void tboot_shutdown(u32 shutdown_type);
extern void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control);
extern struct acpi_table_header *tboot_get_dmar_table(
struct acpi_table_header *dmar_tbl);
extern int tboot_force_iommu(void);
#else
#define tboot_probe() do { } while (0)
#define tboot_shutdown(shutdown_type) do { } while (0)
#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
do { } while (0)
#define tboot_get_dmar_table(dmar_tbl) (dmar_tbl)
#define tboot_force_iommu() 0
#endif /* !CONFIG_INTEL_TXT */
#endif /* _LINUX_TBOOT_H */
...@@ -401,6 +401,7 @@ int disable_nonboot_cpus(void) ...@@ -401,6 +401,7 @@ int disable_nonboot_cpus(void)
break; break;
} }
} }
if (!error) { if (!error) {
BUG_ON(num_online_cpus() > 1); BUG_ON(num_online_cpus() > 1);
/* Make sure the CPUs won't be enabled by someone else */ /* Make sure the CPUs won't be enabled by someone else */
......
...@@ -113,6 +113,36 @@ config SECURITY_ROOTPLUG ...@@ -113,6 +113,36 @@ config SECURITY_ROOTPLUG
If you are unsure how to answer this question, answer N. If you are unsure how to answer this question, answer N.
config INTEL_TXT
bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
depends on HAVE_INTEL_TXT
help
This option enables support for booting the kernel with the
Trusted Boot (tboot) module. This will utilize
Intel(R) Trusted Execution Technology to perform a measured launch
of the kernel. If the system does not support Intel(R) TXT, this
will have no effect.
Intel TXT will provide higher assurance of system configuration and
initial state as well as data reset protection. This is used to
create a robust initial kernel measurement and verification, which
helps to ensure that kernel security mechanisms are functioning
correctly. This level of protection requires a root of trust outside
of the kernel itself.
Intel TXT 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.
See <http://tboot.sourceforge.net> for more information about tboot.
See Documentation/intel_txt.txt for a description of how to enable
Intel TXT support in a kernel boot.
If you are unsure as to whether this is required, answer N.
config LSM_MMAP_MIN_ADDR config LSM_MMAP_MIN_ADDR
int "Low address space for LSM to protect from user allocation" int "Low address space for LSM to protect from user allocation"
depends on SECURITY && SECURITY_SELINUX depends on SECURITY && SECURITY_SELINUX
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment