diff options
Diffstat (limited to 'arch/arm/kernel/process.c')
-rw-r--r-- | arch/arm/kernel/process.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 008e7ce766a..1531480aab4 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -531,22 +531,40 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) | |||
531 | #ifdef CONFIG_MMU | 531 | #ifdef CONFIG_MMU |
532 | /* | 532 | /* |
533 | * The vectors page is always readable from user space for the | 533 | * The vectors page is always readable from user space for the |
534 | * atomic helpers and the signal restart code. Let's declare a mapping | 534 | * atomic helpers and the signal restart code. Insert it into the |
535 | * for it so it is visible through ptrace and /proc/<pid>/mem. | 535 | * gate_vma so that it is visible through ptrace and /proc/<pid>/mem. |
536 | */ | 536 | */ |
537 | static struct vm_area_struct gate_vma; | ||
537 | 538 | ||
538 | int vectors_user_mapping(void) | 539 | static int __init gate_vma_init(void) |
539 | { | 540 | { |
540 | struct mm_struct *mm = current->mm; | 541 | gate_vma.vm_start = 0xffff0000; |
541 | return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, | 542 | gate_vma.vm_end = 0xffff0000 + PAGE_SIZE; |
542 | VM_READ | VM_EXEC | | 543 | gate_vma.vm_page_prot = PAGE_READONLY_EXEC; |
543 | VM_MAYREAD | VM_MAYEXEC | | 544 | gate_vma.vm_flags = VM_READ | VM_EXEC | |
544 | VM_ALWAYSDUMP | VM_RESERVED, | 545 | VM_MAYREAD | VM_MAYEXEC | |
545 | NULL); | 546 | VM_ALWAYSDUMP; |
547 | return 0; | ||
548 | } | ||
549 | arch_initcall(gate_vma_init); | ||
550 | |||
551 | struct vm_area_struct *get_gate_vma(struct mm_struct *mm) | ||
552 | { | ||
553 | return &gate_vma; | ||
554 | } | ||
555 | |||
556 | int in_gate_area(struct mm_struct *mm, unsigned long addr) | ||
557 | { | ||
558 | return (addr >= gate_vma.vm_start) && (addr < gate_vma.vm_end); | ||
559 | } | ||
560 | |||
561 | int in_gate_area_no_mm(unsigned long addr) | ||
562 | { | ||
563 | return in_gate_area(NULL, addr); | ||
546 | } | 564 | } |
547 | 565 | ||
548 | const char *arch_vma_name(struct vm_area_struct *vma) | 566 | const char *arch_vma_name(struct vm_area_struct *vma) |
549 | { | 567 | { |
550 | return (vma->vm_start == 0xffff0000) ? "[vectors]" : NULL; | 568 | return (vma == &gate_vma) ? "[vectors]" : NULL; |
551 | } | 569 | } |
552 | #endif | 570 | #endif |