diff options
Diffstat (limited to 'arch/um/kernel/trap_kern.c')
-rw-r--r-- | arch/um/kernel/trap_kern.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 5fca2c61eb98..c20aef120598 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "kern.h" | 23 | #include "kern.h" |
24 | #include "chan_kern.h" | 24 | #include "chan_kern.h" |
25 | #include "mconsole_kern.h" | 25 | #include "mconsole_kern.h" |
26 | #include "2_5compat.h" | ||
27 | #include "mem.h" | 26 | #include "mem.h" |
28 | #include "mem_kern.h" | 27 | #include "mem_kern.h" |
29 | 28 | ||
@@ -57,10 +56,11 @@ int handle_page_fault(unsigned long address, unsigned long ip, | |||
57 | *code_out = SEGV_ACCERR; | 56 | *code_out = SEGV_ACCERR; |
58 | if(is_write && !(vma->vm_flags & VM_WRITE)) | 57 | if(is_write && !(vma->vm_flags & VM_WRITE)) |
59 | goto out; | 58 | goto out; |
59 | |||
60 | if(!(vma->vm_flags & (VM_READ | VM_EXEC))) | ||
61 | goto out; | ||
62 | |||
60 | page = address & PAGE_MASK; | 63 | page = address & PAGE_MASK; |
61 | pgd = pgd_offset(mm, page); | ||
62 | pud = pud_offset(pgd, page); | ||
63 | pmd = pmd_offset(pud, page); | ||
64 | do { | 64 | do { |
65 | survive: | 65 | survive: |
66 | switch (handle_mm_fault(mm, vma, address, is_write)){ | 66 | switch (handle_mm_fault(mm, vma, address, is_write)){ |
@@ -106,33 +106,6 @@ out_of_memory: | |||
106 | goto out; | 106 | goto out; |
107 | } | 107 | } |
108 | 108 | ||
109 | LIST_HEAD(physmem_remappers); | ||
110 | |||
111 | void register_remapper(struct remapper *info) | ||
112 | { | ||
113 | list_add(&info->list, &physmem_remappers); | ||
114 | } | ||
115 | |||
116 | static int check_remapped_addr(unsigned long address, int is_write) | ||
117 | { | ||
118 | struct remapper *remapper; | ||
119 | struct list_head *ele; | ||
120 | __u64 offset; | ||
121 | int fd; | ||
122 | |||
123 | fd = phys_mapping(__pa(address), &offset); | ||
124 | if(fd == -1) | ||
125 | return(0); | ||
126 | |||
127 | list_for_each(ele, &physmem_remappers){ | ||
128 | remapper = list_entry(ele, struct remapper, list); | ||
129 | if((*remapper->proc)(fd, address, is_write, offset)) | ||
130 | return(1); | ||
131 | } | ||
132 | |||
133 | return(0); | ||
134 | } | ||
135 | |||
136 | /* | 109 | /* |
137 | * We give a *copy* of the faultinfo in the regs to segv. | 110 | * We give a *copy* of the faultinfo in the regs to segv. |
138 | * This must be done, since nesting SEGVs could overwrite | 111 | * This must be done, since nesting SEGVs could overwrite |
@@ -151,8 +124,6 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc) | |||
151 | flush_tlb_kernel_vm(); | 124 | flush_tlb_kernel_vm(); |
152 | return(0); | 125 | return(0); |
153 | } | 126 | } |
154 | else if(check_remapped_addr(address & PAGE_MASK, is_write)) | ||
155 | return(0); | ||
156 | else if(current->mm == NULL) | 127 | else if(current->mm == NULL) |
157 | panic("Segfault with no mm"); | 128 | panic("Segfault with no mm"); |
158 | err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); | 129 | err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); |