From: "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: kirill.shutemov@linux.intel.com, bp@suse.de, tglx@linutronix.de,
brgerst@gmail.com, gorcunov@openvz.org, mingo@kernel.org,
luto@kernel.org, jpoimboe@redhat.com, bp@alien8.de,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
willy@infradead.org, luto@amacapital.net, peterz@infradead.org,
hpa@zytor.com, dvlasenk@redhat.com
Subject: [tip:x86/mm] x86/boot/compressed/64: Make sure we have a 32-bit code segment
Date: Mon, 12 Mar 2018 05:18:43 -0700 [thread overview]
Message-ID: <tip-7beebaccd5083d61e975acb581bd528b9326e7c4@git.kernel.org> (raw)
In-Reply-To: <20180312100246.89175-2-kirill.shutemov@linux.intel.com>
Commit-ID: 7beebaccd5083d61e975acb581bd528b9326e7c4
Gitweb: https://git.kernel.org/tip/7beebaccd5083d61e975acb581bd528b9326e7c4
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
AuthorDate: Mon, 12 Mar 2018 13:02:43 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 12 Mar 2018 11:49:24 +0100
x86/boot/compressed/64: Make sure we have a 32-bit code segment
When kernel starts in 64-bit mode we inherit the GDT from the bootloader.
It may cause a problem if the GDT doesn't have a 32-bit code segment
where we expect it to be.
Load our own GDT with known segments.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20180312100246.89175-2-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/boot/compressed/head_64.S | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index c813cb004056..f0c3a2f7e528 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -313,6 +313,11 @@ ENTRY(startup_64)
* first.
*/
+ /* Make sure we have GDT with 32-bit code segment */
+ leaq gdt(%rip), %rax
+ movq %rax, gdt64+2(%rip)
+ lgdt gdt64(%rip)
+
/*
* paging_prepare() sets up the trampoline and checks if we need to
* enable 5-level paging.
@@ -547,6 +552,11 @@ no_longmode:
#include "../../kernel/verify_cpu.S"
.data
+gdt64:
+ .word gdt_end - gdt
+ .long 0
+ .word 0
+ .quad 0
gdt:
.word gdt_end - gdt
.long gdt
next prev parent reply other threads:[~2018-03-12 12:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 10:02 [PATCH 0/4] x86/boot/compressed/64: Switch between paging modes using trampoline Kirill A. Shutemov
2018-03-12 10:02 ` [PATCH 1/4] x86/boot/compressed/64: Make sure we have 32-bit code segment Kirill A. Shutemov
2018-03-12 12:18 ` tip-bot for Kirill A. Shutemov [this message]
2018-03-12 10:02 ` [PATCH 2/4] x86/boot/compressed/64: Use stack from trampoline memory Kirill A. Shutemov
2018-03-12 12:19 ` [tip:x86/mm] " tip-bot for Kirill A. Shutemov
2018-03-12 10:02 ` [PATCH 3/4] x86/boot/compressed/64: Use page table in " Kirill A. Shutemov
2018-03-12 12:19 ` [tip:x86/mm] " tip-bot for Kirill A. Shutemov
2018-03-12 10:02 ` [PATCH 4/4] x86/boot/compressed/64: Handle 5-level paging boot if kernel is above 4G Kirill A. Shutemov
2018-03-12 12:20 ` [tip:x86/mm] " tip-bot for Kirill A. Shutemov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-7beebaccd5083d61e975acb581bd528b9326e7c4@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=gorcunov@openvz.org \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox