aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-07-31 16:58:56 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-08-01 09:31:58 -0400
commita5463cd3435475386cbbe7b06e01292ac169d36f (patch)
tree71a32103b6df2be4fac877c60cdda2d9fe46e3a5
parent48be69a026b2c17350a5ef18a1959a919f60be7d (diff)
ARM: make vectors page inaccessible from userspace
If kuser helpers are not provided by the kernel, disable user access to the vectors page. With the kuser helpers gone, there is no reason for this page to be visible to userspace. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/include/asm/page.h2
-rw-r--r--arch/arm/kernel/process.c7
-rw-r--r--arch/arm/mm/mmu.c4
3 files changed, 12 insertions, 1 deletions
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index 6363f3d1d505..4355f0ec44d6 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -142,7 +142,9 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
142#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 142#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
143extern void copy_page(void *to, const void *from); 143extern void copy_page(void *to, const void *from);
144 144
145#ifdef CONFIG_KUSER_HELPERS
145#define __HAVE_ARCH_GATE_AREA 1 146#define __HAVE_ARCH_GATE_AREA 1
147#endif
146 148
147#ifdef CONFIG_ARM_LPAE 149#ifdef CONFIG_ARM_LPAE
148#include <asm/pgtable-3level-types.h> 150#include <asm/pgtable-3level-types.h>
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 566d0d71a1e7..1e6c33d01c05 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -426,6 +426,7 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
426} 426}
427 427
428#ifdef CONFIG_MMU 428#ifdef CONFIG_MMU
429#ifdef CONFIG_KUSER_HELPERS
429/* 430/*
430 * The vectors page is always readable from user space for the 431 * The vectors page is always readable from user space for the
431 * atomic helpers. Insert it into the gate_vma so that it is visible 432 * atomic helpers. Insert it into the gate_vma so that it is visible
@@ -458,10 +459,14 @@ int in_gate_area_no_mm(unsigned long addr)
458{ 459{
459 return in_gate_area(NULL, addr); 460 return in_gate_area(NULL, addr);
460} 461}
462#define is_gate_vma(vma) ((vma) = &gate_vma)
463#else
464#define is_gate_vma(vma) 0
465#endif
461 466
462const char *arch_vma_name(struct vm_area_struct *vma) 467const char *arch_vma_name(struct vm_area_struct *vma)
463{ 468{
464 return (vma == &gate_vma) ? "[vectors]" : 469 return is_gate_vma(vma) ? "[vectors]" :
465 (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ? 470 (vma->vm_mm && vma->vm_start == vma->vm_mm->context.sigpage) ?
466 "[sigpage]" : NULL; 471 "[sigpage]" : NULL;
467} 472}
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 9ea274d1af69..ca46f413d867 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1205,7 +1205,11 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
1205 map.pfn = __phys_to_pfn(virt_to_phys(vectors)); 1205 map.pfn = __phys_to_pfn(virt_to_phys(vectors));
1206 map.virtual = 0xffff0000; 1206 map.virtual = 0xffff0000;
1207 map.length = PAGE_SIZE; 1207 map.length = PAGE_SIZE;
1208#ifdef CONFIG_KUSER_HELPERS
1208 map.type = MT_HIGH_VECTORS; 1209 map.type = MT_HIGH_VECTORS;
1210#else
1211 map.type = MT_LOW_VECTORS;
1212#endif
1209 create_mapping(&map); 1213 create_mapping(&map);
1210 1214
1211 if (!vectors_high()) { 1215 if (!vectors_high()) {