Commit 1ca97353 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: fix broken #ifdef clause causing crashes

The previous ifdef to check whether to use the host's vsyscall page was buggy.
This bug can cause crashes.
Signed-off-by: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 580119ca
......@@ -18,3 +18,7 @@ config 3_LEVEL_PGTABLES
config ARCH_HAS_SC_SIGNALS
bool
default y
config ARCH_REUSE_HOST_VSYSCALL_AREA
bool
default y
......@@ -9,3 +9,7 @@ config 3_LEVEL_PGTABLES
config ARCH_HAS_SC_SIGNALS
bool
default n
config ARCH_REUSE_HOST_VSYSCALL_AREA
bool
default n
......@@ -152,6 +152,7 @@ void __init kmap_init(void)
static void init_highmem(void)
{
pgd_t *pgd;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
unsigned long vaddr;
......@@ -163,7 +164,8 @@ static void init_highmem(void)
fixrange_init(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP, swapper_pg_dir);
pgd = swapper_pg_dir + pgd_index(vaddr);
pmd = pmd_offset(pgd, vaddr);
pud = pud_offset(pgd, vaddr);
pmd = pmd_offset(pud, vaddr);
pte = pte_offset_kernel(pmd, vaddr);
pkmap_page_table = pte;
......@@ -173,9 +175,10 @@ static void init_highmem(void)
static void __init fixaddr_user_init( void)
{
#if FIXADDR_USER_START != 0
#if CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
long size = FIXADDR_USER_END - FIXADDR_USER_START;
pgd_t *pgd;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
unsigned long paddr, vaddr = FIXADDR_USER_START;
......@@ -187,9 +190,10 @@ static void __init fixaddr_user_init( void)
paddr = (unsigned long)alloc_bootmem_low_pages( size);
memcpy( (void *)paddr, (void *)FIXADDR_USER_START, size);
paddr = __pa(paddr);
for ( ; size > 0; size-=PAGE_SIZE, vaddr+=PAGE_SIZE, paddr+=PAGE_SIZE) {
for ( ; size > 0; size-=PAGE_SIZE, vaddr+=PAGE_SIZE, paddr+=PAGE_SIZE){
pgd = swapper_pg_dir + pgd_index(vaddr);
pmd = pmd_offset(pgd, vaddr);
pud = pud_offset(pgd, vaddr);
pmd = pmd_offset(pud, vaddr);
pte = pte_offset_kernel(pmd, vaddr);
pte_set_val( (*pte), paddr, PAGE_READONLY);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment