[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240424155309.1719454-16-ardb+git@google.com>
Date: Wed, 24 Apr 2024 17:53:15 +0200
From: Ard Biesheuvel <ardb+git@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: x86@...nel.org, Ard Biesheuvel <ardb@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Eric Biederman <ebiederm@...ssion.com>, kexec@...ts.infradead.org,
Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>,
Kees Cook <keescook@...omium.org>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, Masahiro Yamada <masahiroy@...nel.org>
Subject: [RFC PATCH 5/9] x86/purgatory: Simplify GDT and drop data segment
From: Ard Biesheuvel <ardb@...nel.org>
Data segment selectors are ignored in long mode so there is no point in
programming them. So clear them instead. This only leaves the code
segment entry in the GDT, which can be moved up a slot now that the
second slot is no longer used as the GDT descriptor.
Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
---
arch/x86/purgatory/entry64.S | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/x86/purgatory/entry64.S b/arch/x86/purgatory/entry64.S
index 888661d9db9c..3d09781d4f9a 100644
--- a/arch/x86/purgatory/entry64.S
+++ b/arch/x86/purgatory/entry64.S
@@ -23,14 +23,14 @@ SYM_CODE_START(entry64)
addq $10, %rsp
/* load the data segments */
- movl $0x18, %eax /* data segment */
+ xorl %eax, %eax /* data segment */
movl %eax, %ds
movl %eax, %es
movl %eax, %ss
movl %eax, %fs
movl %eax, %gs
- pushq $0x10 /* CS */
+ pushq $0x8 /* CS */
leaq new_cs_exit(%rip), %rax
pushq %rax
lretq
@@ -84,16 +84,9 @@ SYM_DATA_END(entry64_regs)
SYM_DATA_START_LOCAL(gdt)
/*
* 0x00 unusable segment
- * 0x08 unused
- * so use them as gdt ptr
*/
- .word 0
.quad 0
- .word 0, 0, 0
- /* 0x10 4GB flat code segment */
+ /* 0x8 4GB flat code segment */
.word 0xFFFF, 0x0000, 0x9A00, 0x00AF
-
- /* 0x18 4GB flat data segment */
- .word 0xFFFF, 0x0000, 0x9200, 0x00CF
SYM_DATA_END_LABEL(gdt, SYM_L_LOCAL, gdt_end)
--
2.44.0.769.g3c40516874-goog
Powered by blists - more mailing lists