提交 687c4825 编写于 作者: I Ingo Molnar

x86: keep the BIOS area executable

keep the BIOS area executable.
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 30551bb3
...@@ -22,6 +22,27 @@ void clflush_cache_range(void *addr, int size) ...@@ -22,6 +22,27 @@ void clflush_cache_range(void *addr, int size)
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgalloc.h> #include <asm/pgalloc.h>
/*
* We allow the BIOS range to be executable:
*/
#define BIOS_BEGIN 0x000a0000
#define BIOS_END 0x00100000
static inline pgprot_t check_exec(pgprot_t prot, unsigned long address)
{
if (__pa(address) >= BIOS_BEGIN && __pa(address) < BIOS_END)
pgprot_val(prot) &= ~_PAGE_NX;
/*
* Better fail early if someone sets the kernel text to NX.
* Does not cover __inittext
*/
BUG_ON(address >= (unsigned long)&_text &&
address < (unsigned long)&_etext &&
(pgprot_val(prot) & _PAGE_NX));
return prot;
}
pte_t *lookup_address(unsigned long address, int *level) pte_t *lookup_address(unsigned long address, int *level)
{ {
pgd_t *pgd = pgd_offset_k(address); pgd_t *pgd = pgd_offset_k(address);
...@@ -140,13 +161,7 @@ __change_page_attr(unsigned long address, struct page *page, pgprot_t prot) ...@@ -140,13 +161,7 @@ __change_page_attr(unsigned long address, struct page *page, pgprot_t prot)
BUG_ON(PageLRU(kpte_page)); BUG_ON(PageLRU(kpte_page));
BUG_ON(PageCompound(kpte_page)); BUG_ON(PageCompound(kpte_page));
/* prot = check_exec(prot, address);
* Better fail early if someone sets the kernel text to NX.
* Does not cover __inittext
*/
BUG_ON(address >= (unsigned long)&_text &&
address < (unsigned long)&_etext &&
(pgprot_val(prot) & _PAGE_NX));
if (level == PG_LEVEL_4K) { if (level == PG_LEVEL_4K) {
set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot))); set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot)));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册