public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: wangyanqing <udknight@gmail.com>
To: torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	castet.matthieu@free.fr, x86@kernel.org
Subject: Re: [PATCH -V1] x86: make executable for video bios area
Date: Wed, 16 Nov 2011 11:00:09 +0800	[thread overview]
Message-ID: <20111116030009.GA7850@udknight.homenetwork> (raw)
In-Reply-To: <20111115064237.GA3990@udknight.homenetwork>

On Tue, Nov 15, 2011 at 02:42:37PM +0800, wangyanqing wrote:
> 5bd5a452662bc37c54fb6828db1a3faf87e6511c make area
> between BIOS_BEGIN and BIOS_END have NX protection
> when boot machine with acpi enable(acpi will disable pcibios).
> 
> This commit make my machine can't boot, system hang with black screen
> very early when I enable CONFIG_FB_UVESA, CONFIG_X86_PAE, CONFIG_ACPI.
> 
> below is the maps when boot normal without acpi:
> 00000000-00001000 rw-s 00000000 00:01 822        /dev/mem
> 00009000-0000a000 r-xp 00001000 00:01 912        /sbin/v86d
> 00010000-00050000 rwxp 00000000 00:01 818        /dev/zero
> 000a0000-000c0000 rw-s 000a0000 00:01 822        /dev/mem
> 000c0000-00100000 r-xs 000c0000 00:01 822        /dev/mem <== must executable
> 08048000-0804c000 r-xp 00001000 00:01 912        /sbin/v86d
> 0804c000-0804d000 rw-p 00004000 00:01 912        /sbin/v86d
> b7875000-b7876000 r-xp 00000000 00:00 0          [vdso]
> bfe9d000-bfebe000 rw-p 00000000 00:00 0          [stack]
> 
> So I prepare this patch.It works with me.
> Any comment is welcome.
> 
> Thanks.
> 
> Signed-off-by: Wang YanQing <Udknight@gmail.com>
> ---
>  arch/x86/include/asm/e820.h |    2 ++
>  arch/x86/mm/pageattr.c      |    3 ++-
>  2 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
> index 908b969..a6fa897 100644
> --- a/arch/x86/include/asm/e820.h
> +++ b/arch/x86/include/asm/e820.h
> @@ -72,6 +72,8 @@ struct e820map {
>  #define BIOS_BEGIN		0x000a0000
>  #define BIOS_END		0x00100000
>  
> +#define BIOS_VIDEO		0x000c0000
> +
>  #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..12acac0 100644
> --- a/arch/x86/mm/pageattr.c
> +++ b/arch/x86/mm/pageattr.c
> @@ -260,7 +260,8 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
>  	 * PCI BIOS based config access (CONFIG_PCI_GOBIOS) support.
>  	 */
>  #ifdef CONFIG_PCI_BIOS
> -	if (pcibios_enabled && within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
> +	if ((pcibios_enabled || within(pfn, BIOS_VIDEO >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT)) &&
> +	     within(pfn, BIOS_BEGIN >> PAGE_SHIFT, BIOS_END >> PAGE_SHIFT))
>  		pgprot_val(forbidden) |= _PAGE_NX;
>  #endif
>  
> -- 
> 1.7.3.4
> 

This issue also imply another question.
mmap on /dev/mem haven't check whether the target area can mmap with the request privilege.
Any comments? Linus

  reply	other threads:[~2011-11-16  3:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15  6:42 [PATCH -V1] x86: make executable for video bios area wangyanqing
2011-11-16  3:00 ` wangyanqing [this message]
2011-11-16  9:32 ` wangyanqing

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=20111116030009.GA7850@udknight.homenetwork \
    --to=udknight@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=castet.matthieu@free.fr \
    --cc=linux-kernel@vger.kernel.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