public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: wangyanqing <udknight@gmail.com>
To: torvalds@linux-foundation.org
Cc: castet.matthieu@free.fr, akpm@linux-foundation.org,
	hpa@zytor.com, x86@kernel.org, spock@gentoo.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2] x86: remove NX from video bios area
Date: Thu, 17 Nov 2011 16:26:24 +0800	[thread overview]
Message-ID: <20111117082624.GA4136@udknight.homenetwork> (raw)

5bd5a452662bc37c54fb6828db1a3faf87e6511c make area
between BIOS_BEGIN and BIOS_END NX when boot machine
with ACPI enable.

It make my machine can't boot, system hang with black
screen very early.

The more detail, please see:
https://lkml.org/lkml/2011/11/16/84

This patch try to resolve it. Any comment is welcome.
Signed-off-by: Wang YanQing <Udknight@gmail.com>
---
 arch/x86/include/asm/e820.h |    4 ++++
 arch/x86/mm/pageattr.c      |    6 ++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 908b969..1adc26e 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -72,6 +72,10 @@ struct e820map {
 #define BIOS_BEGIN		0x000a0000
 #define BIOS_END		0x00100000
 
+/*we hope this the right video bios range*/
+#define VIDEO_BIOS_BEGIN	0x000c0000
+#define VIDEO_BIOS_END		0x000c7fff
+
 #define BIOS_ROM_BASE		0xffe00000
 #define BIOS_ROM_END		0xffffffff
 
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index f9e5267..c4e5100 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -263,6 +263,12 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
 	if (pcibios_enabled && within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
 		pgprot_val(forbidden) |= _PAGE_NX;
 #endif
+	/*The video bios area needs to be executable for
+	 *some programs(like v86d for uvesafb) to execute
+	 *video bios functions
+	 */
+	if (!pcibios_enable && within(pfn, VIDEO_BIOS_BEGIN >> PAGE_SHIFT, VIDEO_BIOS_END >> PAGE_SHIFT))
+		pgprot_val(forbidden) |= _PAGE_NX;
 
 	/*
 	 * The kernel text needs to be executable for obvious reasons
-- 
1.7.3.4


             reply	other threads:[~2011-11-17  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-17  8:26 wangyanqing [this message]
2011-11-17 14:56 ` [PATCH v2] x86: remove NX from video bios area H. Peter Anvin
2011-11-18  4:45   ` wangyanqing
2011-11-18  5:02     ` 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=20111117082624.GA4136@udknight.homenetwork \
    --to=udknight@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=castet.matthieu@free.fr \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spock@gentoo.org \
    --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