diff options
-rw-r--r-- | arch/arm/include/asm/elf.h | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/mmu_context.h | 29 | ||||
-rw-r--r-- | arch/arm/kernel/process.c | 21 |
3 files changed, 53 insertions, 1 deletions
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index 5747a8baa413..8bb66bca2e3e 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h | |||
@@ -127,4 +127,8 @@ struct mm_struct; | |||
127 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); | 127 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); |
128 | #define arch_randomize_brk arch_randomize_brk | 128 | #define arch_randomize_brk arch_randomize_brk |
129 | 129 | ||
130 | extern int vectors_user_mapping(void); | ||
131 | #define arch_setup_additional_pages(bprm, uses_interp) vectors_user_mapping() | ||
132 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES | ||
133 | |||
130 | #endif | 134 | #endif |
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h index a0b3cac0547c..71605d9f8e42 100644 --- a/arch/arm/include/asm/mmu_context.h +++ b/arch/arm/include/asm/mmu_context.h | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/cachetype.h> | 19 | #include <asm/cachetype.h> |
20 | #include <asm/proc-fns.h> | 20 | #include <asm/proc-fns.h> |
21 | #include <asm-generic/mm_hooks.h> | ||
22 | 21 | ||
23 | void __check_kvm_seq(struct mm_struct *mm); | 22 | void __check_kvm_seq(struct mm_struct *mm); |
24 | 23 | ||
@@ -134,4 +133,32 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
134 | #define deactivate_mm(tsk,mm) do { } while (0) | 133 | #define deactivate_mm(tsk,mm) do { } while (0) |
135 | #define activate_mm(prev,next) switch_mm(prev, next, NULL) | 134 | #define activate_mm(prev,next) switch_mm(prev, next, NULL) |
136 | 135 | ||
136 | /* | ||
137 | * We are inserting a "fake" vma for the user-accessible vector page so | ||
138 | * gdb and friends can get to it through ptrace and /proc/<pid>/mem. | ||
139 | * But we also want to remove it before the generic code gets to see it | ||
140 | * during process exit or the unmapping of it would cause total havoc. | ||
141 | * (the macro is used as remove_vma() is static to mm/mmap.c) | ||
142 | */ | ||
143 | #define arch_exit_mmap(mm) \ | ||
144 | do { \ | ||
145 | struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \ | ||
146 | if (high_vma) { \ | ||
147 | BUG_ON(high_vma->vm_next); /* it should be last */ \ | ||
148 | if (high_vma->vm_prev) \ | ||
149 | high_vma->vm_prev->vm_next = NULL; \ | ||
150 | else \ | ||
151 | mm->mmap = NULL; \ | ||
152 | rb_erase(&high_vma->vm_rb, &mm->mm_rb); \ | ||
153 | mm->mmap_cache = NULL; \ | ||
154 | mm->map_count--; \ | ||
155 | remove_vma(high_vma); \ | ||
156 | } \ | ||
157 | } while (0) | ||
158 | |||
159 | static inline void arch_dup_mmap(struct mm_struct *oldmm, | ||
160 | struct mm_struct *mm) | ||
161 | { | ||
162 | } | ||
163 | |||
137 | #endif | 164 | #endif |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 401e38be1f78..66ac9c926200 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -458,3 +458,24 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) | |||
458 | unsigned long range_end = mm->brk + 0x02000000; | 458 | unsigned long range_end = mm->brk + 0x02000000; |
459 | return randomize_range(mm->brk, range_end, 0) ? : mm->brk; | 459 | return randomize_range(mm->brk, range_end, 0) ? : mm->brk; |
460 | } | 460 | } |
461 | |||
462 | /* | ||
463 | * The vectors page is always readable from user space for the | ||
464 | * atomic helpers and the signal restart code. Let's declare a mapping | ||
465 | * for it so it is visible through ptrace and /proc/<pid>/mem. | ||
466 | */ | ||
467 | |||
468 | int vectors_user_mapping(void) | ||
469 | { | ||
470 | struct mm_struct *mm = current->mm; | ||
471 | return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, | ||
472 | VM_READ | VM_EXEC | | ||
473 | VM_MAYREAD | VM_MAYEXEC | | ||
474 | VM_ALWAYSDUMP | VM_RESERVED, | ||
475 | NULL); | ||
476 | } | ||
477 | |||
478 | const char *arch_vma_name(struct vm_area_struct *vma) | ||
479 | { | ||
480 | return (vma->vm_start == 0xffff0000) ? "[vectors]" : NULL; | ||
481 | } | ||