From: Kirill A. Shutemov Date: Tue, 6 Jun 2017 11:31:23 +0000 (+0300) Subject: x86/boot/efi: Fix __KERNEL_CS definition of GDT entry on 64-bit configurations X-Git-Tag: Ubuntu-5.2.0-15.16~6591^2~17 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=4c94117c7fa1bea36a15157022dbe5efee474340;p=mirror_ubuntu-eoan-kernel.git x86/boot/efi: Fix __KERNEL_CS definition of GDT entry on 64-bit configurations Define __KERNEL_CS GDT entry as long mode (.L=1, .D=0) on 64-bit configurations. Signed-off-by: Kirill A. Shutemov Reviewed-by: Matt Fleming Cc: Andrew Morton Cc: Andy Lutomirski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-arch@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20170606113133.22974-5-kirill.shutemov@linux.intel.com Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 1d5093d1f319..b75c20f779ea 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -1059,8 +1059,13 @@ struct boot_params *efi_main(struct efi_config *c, desc->p = 1; desc->limit = 0xf; desc->avl = 0; - desc->l = 0; - desc->d = SEG_OP_SIZE_32BIT; + if (IS_ENABLED(CONFIG_X86_64)) { + desc->l = 1; + desc->d = 0; + } else { + desc->l = 0; + desc->d = SEG_OP_SIZE_32BIT; + } desc->g = SEG_GRANULARITY_4KB; desc->base2 = 0x00; desc++;