xref: /OK3568_Linux_fs/kernel/Documentation/x86/intel_txt.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=====================
2*4882a593SmuzhiyunIntel(R) TXT Overview
3*4882a593Smuzhiyun=====================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunIntel's technology for safer computing, Intel(R) Trusted Execution
6*4882a593SmuzhiyunTechnology (Intel(R) TXT), defines platform-level enhancements that
7*4882a593Smuzhiyunprovide the building blocks for creating trusted platforms.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunIntel TXT was formerly known by the code name LaGrande Technology (LT).
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunIntel TXT in Brief:
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun-  Provides dynamic root of trust for measurement (DRTM)
14*4882a593Smuzhiyun-  Data protection in case of improper shutdown
15*4882a593Smuzhiyun-  Measurement and verification of launched environment
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunIntel TXT is part of the vPro(TM) brand and is also available some
18*4882a593Smuzhiyunnon-vPro systems.  It is currently available on desktop systems
19*4882a593Smuzhiyunbased on the Q35, X38, Q45, and Q43 Express chipsets (e.g. Dell
20*4882a593SmuzhiyunOptiplex 755, HP dc7800, etc.) and mobile systems based on the GM45,
21*4882a593SmuzhiyunPM45, and GS45 Express chipsets.
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunFor more information, see http://www.intel.com/technology/security/.
24*4882a593SmuzhiyunThis site also has a link to the Intel TXT MLE Developers Manual,
25*4882a593Smuzhiyunwhich has been updated for the new released platforms.
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunIntel TXT has been presented at various events over the past few
28*4882a593Smuzhiyunyears, some of which are:
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun      - LinuxTAG 2008:
31*4882a593Smuzhiyun          http://www.linuxtag.org/2008/en/conf/events/vp-donnerstag.html
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun      - TRUST2008:
34*4882a593Smuzhiyun          http://www.trust-conference.eu/downloads/Keynote-Speakers/
35*4882a593Smuzhiyun          3_David-Grawrock_The-Front-Door-of-Trusted-Computing.pdf
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun      - IDF, Shanghai:
38*4882a593Smuzhiyun          http://www.prcidf.com.cn/index_en.html
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun      - IDFs 2006, 2007
41*4882a593Smuzhiyun	  (I'm not sure if/where they are online)
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunTrusted Boot Project Overview
44*4882a593Smuzhiyun=============================
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunTrusted Boot (tboot) is an open source, pre-kernel/VMM module that
47*4882a593Smuzhiyunuses Intel TXT to perform a measured and verified launch of an OS
48*4882a593Smuzhiyunkernel/VMM.
49*4882a593Smuzhiyun
50*4882a593SmuzhiyunIt is hosted on SourceForge at http://sourceforge.net/projects/tboot.
51*4882a593SmuzhiyunThe mercurial source repo is available at http://www.bughost.org/
52*4882a593Smuzhiyunrepos.hg/tboot.hg.
53*4882a593Smuzhiyun
54*4882a593SmuzhiyunTboot currently supports launching Xen (open source VMM/hypervisor
55*4882a593Smuzhiyunw/ TXT support since v3.2), and now Linux kernels.
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunValue Proposition for Linux or "Why should you care?"
59*4882a593Smuzhiyun=====================================================
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunWhile there are many products and technologies that attempt to
62*4882a593Smuzhiyunmeasure or protect the integrity of a running kernel, they all
63*4882a593Smuzhiyunassume the kernel is "good" to begin with.  The Integrity
64*4882a593SmuzhiyunMeasurement Architecture (IMA) and Linux Integrity Module interface
65*4882a593Smuzhiyunare examples of such solutions.
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunTo get trust in the initial kernel without using Intel TXT, a
68*4882a593Smuzhiyunstatic root of trust must be used.  This bases trust in BIOS
69*4882a593Smuzhiyunstarting at system reset and requires measurement of all code
70*4882a593Smuzhiyunexecuted between system reset through the completion of the kernel
71*4882a593Smuzhiyunboot as well as data objects used by that code.  In the case of a
72*4882a593SmuzhiyunLinux kernel, this means all of BIOS, any option ROMs, the
73*4882a593Smuzhiyunbootloader and the boot config.  In practice, this is a lot of
74*4882a593Smuzhiyuncode/data, much of which is subject to change from boot to boot
75*4882a593Smuzhiyun(e.g. changing NICs may change option ROMs).  Without reference
76*4882a593Smuzhiyunhashes, these measurement changes are difficult to assess or
77*4882a593Smuzhiyunconfirm as benign.  This process also does not provide DMA
78*4882a593Smuzhiyunprotection, memory configuration/alias checks and locks, crash
79*4882a593Smuzhiyunprotection, or policy support.
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunBy using the hardware-based root of trust that Intel TXT provides,
82*4882a593Smuzhiyunmany of these issues can be mitigated.  Specifically: many
83*4882a593Smuzhiyunpre-launch components can be removed from the trust chain, DMA
84*4882a593Smuzhiyunprotection is provided to all launched components, a large number
85*4882a593Smuzhiyunof platform configuration checks are performed and values locked,
86*4882a593Smuzhiyunprotection is provided for any data in the event of an improper
87*4882a593Smuzhiyunshutdown, and there is support for policy-based execution/verification.
88*4882a593SmuzhiyunThis provides a more stable measurement and a higher assurance of
89*4882a593Smuzhiyunsystem configuration and initial state than would be otherwise
90*4882a593Smuzhiyunpossible.  Since the tboot project is open source, source code for
91*4882a593Smuzhiyunalmost all parts of the trust chain is available (excepting SMM and
92*4882a593SmuzhiyunIntel-provided firmware).
93*4882a593Smuzhiyun
94*4882a593SmuzhiyunHow Does it Work?
95*4882a593Smuzhiyun=================
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun-  Tboot is an executable that is launched by the bootloader as
98*4882a593Smuzhiyun   the "kernel" (the binary the bootloader executes).
99*4882a593Smuzhiyun-  It performs all of the work necessary to determine if the
100*4882a593Smuzhiyun   platform supports Intel TXT and, if so, executes the GETSEC[SENTER]
101*4882a593Smuzhiyun   processor instruction that initiates the dynamic root of trust.
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun   -  If tboot determines that the system does not support Intel TXT
104*4882a593Smuzhiyun      or is not configured correctly (e.g. the SINIT AC Module was
105*4882a593Smuzhiyun      incorrect), it will directly launch the kernel with no changes
106*4882a593Smuzhiyun      to any state.
107*4882a593Smuzhiyun   -  Tboot will output various information about its progress to the
108*4882a593Smuzhiyun      terminal, serial port, and/or an in-memory log; the output
109*4882a593Smuzhiyun      locations can be configured with a command line switch.
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun-  The GETSEC[SENTER] instruction will return control to tboot and
112*4882a593Smuzhiyun   tboot then verifies certain aspects of the environment (e.g. TPM NV
113*4882a593Smuzhiyun   lock, e820 table does not have invalid entries, etc.).
114*4882a593Smuzhiyun-  It will wake the APs from the special sleep state the GETSEC[SENTER]
115*4882a593Smuzhiyun   instruction had put them in and place them into a wait-for-SIPI
116*4882a593Smuzhiyun   state.
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun   -  Because the processors will not respond to an INIT or SIPI when
119*4882a593Smuzhiyun      in the TXT environment, it is necessary to create a small VT-x
120*4882a593Smuzhiyun      guest for the APs.  When they run in this guest, they will
121*4882a593Smuzhiyun      simply wait for the INIT-SIPI-SIPI sequence, which will cause
122*4882a593Smuzhiyun      VMEXITs, and then disable VT and jump to the SIPI vector.  This
123*4882a593Smuzhiyun      approach seemed like a better choice than having to insert
124*4882a593Smuzhiyun      special code into the kernel's MP wakeup sequence.
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun-  Tboot then applies an (optional) user-defined launch policy to
127*4882a593Smuzhiyun   verify the kernel and initrd.
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun   -  This policy is rooted in TPM NV and is described in the tboot
130*4882a593Smuzhiyun      project.  The tboot project also contains code for tools to
131*4882a593Smuzhiyun      create and provision the policy.
132*4882a593Smuzhiyun   -  Policies are completely under user control and if not present
133*4882a593Smuzhiyun      then any kernel will be launched.
134*4882a593Smuzhiyun   -  Policy action is flexible and can include halting on failures
135*4882a593Smuzhiyun      or simply logging them and continuing.
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun-  Tboot adjusts the e820 table provided by the bootloader to reserve
138*4882a593Smuzhiyun   its own location in memory as well as to reserve certain other
139*4882a593Smuzhiyun   TXT-related regions.
140*4882a593Smuzhiyun-  As part of its launch, tboot DMA protects all of RAM (using the
141*4882a593Smuzhiyun   VT-d PMRs).  Thus, the kernel must be booted with 'intel_iommu=on'
142*4882a593Smuzhiyun   in order to remove this blanket protection and use VT-d's
143*4882a593Smuzhiyun   page-level protection.
144*4882a593Smuzhiyun-  Tboot will populate a shared page with some data about itself and
145*4882a593Smuzhiyun   pass this to the Linux kernel as it transfers control.
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun   -  The location of the shared page is passed via the boot_params
148*4882a593Smuzhiyun      struct as a physical address.
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun-  The kernel will look for the tboot shared page address and, if it
151*4882a593Smuzhiyun   exists, map it.
152*4882a593Smuzhiyun-  As one of the checks/protections provided by TXT, it makes a copy
153*4882a593Smuzhiyun   of the VT-d DMARs in a DMA-protected region of memory and verifies
154*4882a593Smuzhiyun   them for correctness.  The VT-d code will detect if the kernel was
155*4882a593Smuzhiyun   launched with tboot and use this copy instead of the one in the
156*4882a593Smuzhiyun   ACPI table.
157*4882a593Smuzhiyun-  At this point, tboot and TXT are out of the picture until a
158*4882a593Smuzhiyun   shutdown (S<n>)
159*4882a593Smuzhiyun-  In order to put a system into any of the sleep states after a TXT
160*4882a593Smuzhiyun   launch, TXT must first be exited.  This is to prevent attacks that
161*4882a593Smuzhiyun   attempt to crash the system to gain control on reboot and steal
162*4882a593Smuzhiyun   data left in memory.
163*4882a593Smuzhiyun
164*4882a593Smuzhiyun   -  The kernel will perform all of its sleep preparation and
165*4882a593Smuzhiyun      populate the shared page with the ACPI data needed to put the
166*4882a593Smuzhiyun      platform in the desired sleep state.
167*4882a593Smuzhiyun   -  Then the kernel jumps into tboot via the vector specified in the
168*4882a593Smuzhiyun      shared page.
169*4882a593Smuzhiyun   -  Tboot will clean up the environment and disable TXT, then use the
170*4882a593Smuzhiyun      kernel-provided ACPI information to actually place the platform
171*4882a593Smuzhiyun      into the desired sleep state.
172*4882a593Smuzhiyun   -  In the case of S3, tboot will also register itself as the resume
173*4882a593Smuzhiyun      vector.  This is necessary because it must re-establish the
174*4882a593Smuzhiyun      measured environment upon resume.  Once the TXT environment
175*4882a593Smuzhiyun      has been restored, it will restore the TPM PCRs and then
176*4882a593Smuzhiyun      transfer control back to the kernel's S3 resume vector.
177*4882a593Smuzhiyun      In order to preserve system integrity across S3, the kernel
178*4882a593Smuzhiyun      provides tboot with a set of memory ranges (RAM and RESERVED_KERN
179*4882a593Smuzhiyun      in the e820 table, but not any memory that BIOS might alter over
180*4882a593Smuzhiyun      the S3 transition) that tboot will calculate a MAC (message
181*4882a593Smuzhiyun      authentication code) over and then seal with the TPM. On resume
182*4882a593Smuzhiyun      and once the measured environment has been re-established, tboot
183*4882a593Smuzhiyun      will re-calculate the MAC and verify it against the sealed value.
184*4882a593Smuzhiyun      Tboot's policy determines what happens if the verification fails.
185*4882a593Smuzhiyun      Note that the c/s 194 of tboot which has the new MAC code supports
186*4882a593Smuzhiyun      this.
187*4882a593Smuzhiyun
188*4882a593SmuzhiyunThat's pretty much it for TXT support.
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun
191*4882a593SmuzhiyunConfiguring the System
192*4882a593Smuzhiyun======================
193*4882a593Smuzhiyun
194*4882a593SmuzhiyunThis code works with 32bit, 32bit PAE, and 64bit (x86_64) kernels.
195*4882a593Smuzhiyun
196*4882a593SmuzhiyunIn BIOS, the user must enable:  TPM, TXT, VT-x, VT-d.  Not all BIOSes
197*4882a593Smuzhiyunallow these to be individually enabled/disabled and the screens in
198*4882a593Smuzhiyunwhich to find them are BIOS-specific.
199*4882a593Smuzhiyun
200*4882a593Smuzhiyungrub.conf needs to be modified as follows::
201*4882a593Smuzhiyun
202*4882a593Smuzhiyun        title Linux 2.6.29-tip w/ tboot
203*4882a593Smuzhiyun          root (hd0,0)
204*4882a593Smuzhiyun                kernel /tboot.gz logging=serial,vga,memory
205*4882a593Smuzhiyun                module /vmlinuz-2.6.29-tip intel_iommu=on ro
206*4882a593Smuzhiyun                       root=LABEL=/ rhgb console=ttyS0,115200 3
207*4882a593Smuzhiyun                module /initrd-2.6.29-tip.img
208*4882a593Smuzhiyun                module /Q35_SINIT_17.BIN
209*4882a593Smuzhiyun
210*4882a593SmuzhiyunThe kernel option for enabling Intel TXT support is found under the
211*4882a593SmuzhiyunSecurity top-level menu and is called "Enable Intel(R) Trusted
212*4882a593SmuzhiyunExecution Technology (TXT)".  It is considered EXPERIMENTAL and
213*4882a593Smuzhiyundepends on the generic x86 support (to allow maximum flexibility in
214*4882a593Smuzhiyunkernel build options), since the tboot code will detect whether the
215*4882a593Smuzhiyunplatform actually supports Intel TXT and thus whether any of the
216*4882a593Smuzhiyunkernel code is executed.
217*4882a593Smuzhiyun
218*4882a593SmuzhiyunThe Q35_SINIT_17.BIN file is what Intel TXT refers to as an
219*4882a593SmuzhiyunAuthenticated Code Module.  It is specific to the chipset in the
220*4882a593Smuzhiyunsystem and can also be found on the Trusted Boot site.  It is an
221*4882a593Smuzhiyun(unencrypted) module signed by Intel that is used as part of the
222*4882a593SmuzhiyunDRTM process to verify and configure the system.  It is signed
223*4882a593Smuzhiyunbecause it operates at a higher privilege level in the system than
224*4882a593Smuzhiyunany other macrocode and its correct operation is critical to the
225*4882a593Smuzhiyunestablishment of the DRTM.  The process for determining the correct
226*4882a593SmuzhiyunSINIT ACM for a system is documented in the SINIT-guide.txt file
227*4882a593Smuzhiyunthat is on the tboot SourceForge site under the SINIT ACM downloads.
228