public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Fernando Luis Vázquez Cao" <fernando_b1@lab.ntt.co.jp>
To: "H. Peter Anvin" <hpa@linux.intel.com>, Yinghai Lu <yinghai@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] x86, 64bit: do not assume CPU is NX capable when setting early page tables
Date: Thu, 02 May 2013 15:40:50 +0900	[thread overview]
Message-ID: <1367476850.5660.2.camel@nexus> (raw)

The kernel sets the NX bit in the early page tables without checking whether
the CPU actually supports this feature. If it doesn't the first attempt to use
them will cause a kernel hang. Since these are temporary page tables marked as
initdata this fix takes the approach of not bothering with the NX bit at all.

Noticed when my AMD machine that happened to have the NX feature disabled by
the BIOS failed to boot after the update to 3.9.

Cc: stable@vger.kernel.org
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
---

diff -urNp linux-3.9/arch/x86/kernel/head64.c linux-3.9-fix/arch/x86/kernel/head64.c
--- linux-3.9/arch/x86/kernel/head64.c	2013-04-29 09:36:01.000000000 +0900
+++ linux-3.9-fix/arch/x86/kernel/head64.c	2013-05-02 14:38:52.589276092 +0900
@@ -99,7 +99,7 @@ again:
 			pmd_p[i] = 0;
 		*pud_p = (pudval_t)pmd_p - __START_KERNEL_map + phys_base + _KERNPG_TABLE;
 	}
-	pmd = (physaddr & PMD_MASK) + (__PAGE_KERNEL_LARGE & ~_PAGE_GLOBAL);
+	pmd = (physaddr & PMD_MASK) + (__PAGE_KERNEL_LARGE_EXEC & ~_PAGE_GLOBAL);
 	pmd_p[pmd_index(address)] = pmd;
 
 	return 0;



             reply	other threads:[~2013-05-02  6:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  6:40 Fernando Luis Vázquez Cao [this message]
2013-05-02 18:33 ` [tip:x86/urgent] x86-64, init: Do not set NX bits on non-NX capable hardware tip-bot for H. Peter Anvin
2013-05-11  5:57   ` Yuhong Bao
2013-05-11 14:55     ` H. Peter Anvin

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=1367476850.5660.2.camel@nexus \
    --to=fernando_b1@lab.ntt.co.jp \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=yinghai@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