# HG changeset patch
# User Łukasz Hawryłko <luk...@hawrylko.pl>
# Date 1639270553 -3600
#      Sun Dec 12 01:55:53 2021 +0100
# Node ID 8ab1cfa6301f1f892d7d8e82532c6609e136765c
# Parent  5a30b6b09e77844ea26e9298ac3819c33bca617b
Set GDT to map CS and DS to 4GB segments before jumping to Linux

There was an issue that TBOOT can copy Linux kernel binary to address outside
of memory mapped in GTD. If this happens, platform will reset when trying to
jump to Linux. In original implementation this limit was set to 256MB.

To prevent that situation, this commit sets GDT segments to cover whole memory
below 4GB.

Signed-off-by: Lukasz Hawrylko <luk...@hawrylko.pl>

diff -r 5a30b6b09e77 -r 8ab1cfa6301f tboot/common/linux.c
--- a/tboot/common/linux.c      Fri Dec 10 15:35:42 2021 +0100
+++ b/tboot/common/linux.c      Sun Dec 12 01:55:53 2021 +0100
@@ -471,8 +471,8 @@
     static const uint64_t gdt_table[] __attribute__ ((aligned(16))) = {
         0,
         0,
-        0x00c09b000000ffff,     /* cs */
-        0x00c093000000ffff      /* ds */
+        0x00cf9b000000ffff,     /* cs */
+        0x00cf93000000ffff      /* ds */
     };
     /* both 4G flat, CS: execute/read, DS: read/write */
 

_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to