mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joerg Roedel <jroedel@suse.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Michal Hocko <mhocko@suse.com>, Andi Kleen <ak@linux.intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	x86@kernel.org, Dave Hansen <dave.hansen@intel.com>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: efi boot failures due to PTI with 32 bit builds and Intel CPUs
Date: Thu, 30 Aug 2018 20:08:49 +0200	[thread overview]
Message-ID: <20180830180849.nmh646ehnolphq4v@suse.de> (raw)
In-Reply-To: <915dca84-c98a-fc63-3210-b21dd926b3d4@roeck-us.net>

On Thu, Aug 30, 2018 at 05:20:22AM -0700, Guenter Roeck wrote:
> Excellent.
> 
> In case it matters: I can use the same 32-bit efi image to boot a 64-bit kernel
> without problems.

Okay, I tracked it down. The 32-bit EFI code switches the CPU to the
read-write version of the GDT which is not mapped in the user
page-table. This obviously faults when the kernel entry/exit code
restores the segment registers.

Without a mapped GDT the #PF and #DF handlers also can't be started, so
the machine triple-faults. Below diff fixes it for me, I'll send a
proper patch tomorrow.

diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 324b93328b37..892edb4664fb 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -87,7 +87,7 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
 {
 	struct desc_ptr gdt_descr;
 
-	gdt_descr.address = (unsigned long)get_cpu_gdt_rw(0);
+	gdt_descr.address = (unsigned long)get_cpu_gdt_ro(0);
 	gdt_descr.size = GDT_SIZE - 1;
 	load_gdt(&gdt_descr);
 

  reply	other threads:[~2018-08-30 18:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29 20:16 Guenter Roeck
2018-08-29 20:28 ` Dave Hansen
2018-08-29 21:12   ` Guenter Roeck
2018-08-30  7:19 ` Joerg Roedel
2018-08-30 10:11   ` Guenter Roeck
2018-08-30 11:30     ` Joerg Roedel
2018-08-30 12:20       ` Guenter Roeck
2018-08-30 18:08         ` Joerg Roedel [this message]
2018-08-30 18:21           ` Linus Torvalds
2018-08-30 18:46             ` Joerg Roedel
2018-08-30 19:24               ` Guenter Roeck

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=20180830180849.nmh646ehnolphq4v@suse.de \
    --to=jroedel@suse.de \
    --cc=ak@linux.intel.com \
    --cc=dave.hansen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mhocko@suse.com \
    --cc=pavel@ucw.cz \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®