mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot for H. Peter Anvin" <hpa@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	tglx@linutronix.de
Subject: [tip:x86/reboot] x86-64, reboot: Be more paranoid in 64-bit reboot =bios
Date: Thu, 21 Jun 2012 10:37:45 -0700	[thread overview]
Message-ID: <tip-9751d7627582fc1cc64625d63bde9528c14f1544@git.kernel.org> (raw)
In-Reply-To: <tip-jopx7y6g6dbcx4tpal8q0jlr@git.kernel.org>

Commit-ID:  9751d7627582fc1cc64625d63bde9528c14f1544
Gitweb:     http://git.kernel.org/tip/9751d7627582fc1cc64625d63bde9528c14f1544
Author:     H. Peter Anvin <hpa@zytor.com>
AuthorDate: Thu, 21 Jun 2012 10:25:03 -0700
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Thu, 21 Jun 2012 10:25:03 -0700

x86-64, reboot: Be more paranoid in 64-bit reboot=bios

Be a bit more paranoid in the transition back to 16-bit mode.  In
particular, in case the kernel is residing above the 4 GiB mark,
switch to the trampoline GDT, and make the jump after turning off
paging a far jump.  In theory, none of this should matter, but it is
exactly the kind of things that broken SMM or virtualization software
could trip up on.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/r/tip-jopx7y6g6dbcx4tpal8q0jlr@git.kernel.org
---
 arch/x86/realmode/rm/reboot.S |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/realmode/rm/reboot.S b/arch/x86/realmode/rm/reboot.S
index 6bf8fea..f932ea6 100644
--- a/arch/x86/realmode/rm/reboot.S
+++ b/arch/x86/realmode/rm/reboot.S
@@ -22,14 +22,18 @@
 ENTRY(machine_real_restart_asm)
 
 #ifdef CONFIG_X86_64
+	/* Switch to trampoline GDT as it is guaranteed < 4 GiB */
+	movl	$__KERNEL_DS, %eax
+	movl	%eax, %ds
+	lgdtl	pa_tr_gdt
 
 	/* Disable paging to drop us out of long mode */
 	movl	%cr0, %eax
 	andl	$~X86_CR0_PG, %eax
 	movl	%eax, %cr0
-	jmp	1f	/* "A branch" may be needed here, assume near is OK */
+	ljmpl	$__KERNEL32_CS, $pa_machine_real_restart_paging_off
 
-1:
+GLOBAL(machine_real_restart_paging_off)
 	xorl	%eax, %eax
 	xorl	%edx, %edx
 	movl	$MSR_EFER, %ecx

      reply	other threads:[~2012-06-21 17:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-17 18:05 [tip:x86/reboot] x86-64, reboot: Allow reboot= bios and reboot-cpu override on x86-64 tip-bot for H. Peter Anvin
2012-06-21 17:37 ` tip-bot for H. Peter Anvin [this message]

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-9751d7627582fc1cc64625d63bde9528c14f1544@git.kernel.org \
    --to=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome