diff options
Diffstat (limited to 'arch/um/kernel/trap_kern.c')
-rw-r--r-- | arch/um/kernel/trap_kern.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c index 5fca2c61eb98..1de22d8a313a 100644 --- a/arch/um/kernel/trap_kern.c +++ b/arch/um/kernel/trap_kern.c | |||
@@ -57,10 +57,11 @@ int handle_page_fault(unsigned long address, unsigned long ip, | |||
57 | *code_out = SEGV_ACCERR; | 57 | *code_out = SEGV_ACCERR; |
58 | if(is_write && !(vma->vm_flags & VM_WRITE)) | 58 | if(is_write && !(vma->vm_flags & VM_WRITE)) |
59 | goto out; | 59 | goto out; |
60 | |||
61 | if(!(vma->vm_flags & (VM_READ | VM_EXEC))) | ||
62 | goto out; | ||
63 | |||
60 | page = address & PAGE_MASK; | 64 | page = address & PAGE_MASK; |
61 | pgd = pgd_offset(mm, page); | ||
62 | pud = pud_offset(pgd, page); | ||
63 | pmd = pmd_offset(pud, page); | ||
64 | do { | 65 | do { |
65 | survive: | 66 | survive: |
66 | switch (handle_mm_fault(mm, vma, address, is_write)){ | 67 | switch (handle_mm_fault(mm, vma, address, is_write)){ |
@@ -106,33 +107,6 @@ out_of_memory: | |||
106 | goto out; | 107 | goto out; |
107 | } | 108 | } |
108 | 109 | ||
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 | /* | 110 | /* |
137 | * We give a *copy* of the faultinfo in the regs to segv. | 111 | * We give a *copy* of the faultinfo in the regs to segv. |
138 | * This must be done, since nesting SEGVs could overwrite | 112 | * This must be done, since nesting SEGVs could overwrite |
@@ -151,8 +125,6 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc) | |||
151 | flush_tlb_kernel_vm(); | 125 | flush_tlb_kernel_vm(); |
152 | return(0); | 126 | return(0); |
153 | } | 127 | } |
154 | else if(check_remapped_addr(address & PAGE_MASK, is_write)) | ||
155 | return(0); | ||
156 | else if(current->mm == NULL) | 128 | else if(current->mm == NULL) |
157 | panic("Segfault with no mm"); | 129 | panic("Segfault with no mm"); |
158 | err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); | 130 | err = handle_page_fault(address, ip, is_write, is_user, &si.si_code); |