fault.c (9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e) fault.c (a050ba1e7422f2cc60ff8bfde3f96d34d00cb585)
1// TODO VM_EXEC flag work-around, cache aliasing
2/*
3 * arch/xtensa/mm/fault.c
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *

--- 116 unchanged lines hidden (view full) ---

125 is_write ? "w" : "", is_exec ? "x" : "");
126
127 if (user_mode(regs))
128 flags |= FAULT_FLAG_USER;
129
130 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
131
132retry:
1// TODO VM_EXEC flag work-around, cache aliasing
2/*
3 * arch/xtensa/mm/fault.c
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *

--- 116 unchanged lines hidden (view full) ---

125 is_write ? "w" : "", is_exec ? "x" : "");
126
127 if (user_mode(regs))
128 flags |= FAULT_FLAG_USER;
129
130 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
131
132retry:
133 mmap_read_lock(mm);
134 vma = find_vma(mm, address);
135
133 vma = lock_mm_and_find_vma(mm, address, regs);
136 if (!vma)
134 if (!vma)
137 goto bad_area;
138 if (vma->vm_start <= address)
139 goto good_area;
140 if (!(vma->vm_flags & VM_GROWSDOWN))
141 goto bad_area;
142 if (expand_stack(vma, address))
143 goto bad_area;
135 goto bad_area_nosemaphore;
144
145 /* Ok, we have a good vm_area for this memory access, so
146 * we can handle it..
147 */
148
136
137 /* Ok, we have a good vm_area for this memory access, so
138 * we can handle it..
139 */
140
149good_area:
150 code = SEGV_ACCERR;
151
152 if (is_write) {
153 if (!(vma->vm_flags & VM_WRITE))
154 goto bad_area;
155 flags |= FAULT_FLAG_WRITE;
156 } else if (is_exec) {
157 if (!(vma->vm_flags & VM_EXEC))

--- 42 unchanged lines hidden (view full) ---

200 mmap_read_unlock(mm);
201 return;
202
203 /* Something tried to access memory that isn't in our memory map..
204 * Fix it, but check if it's kernel or user first..
205 */
206bad_area:
207 mmap_read_unlock(mm);
141 code = SEGV_ACCERR;
142
143 if (is_write) {
144 if (!(vma->vm_flags & VM_WRITE))
145 goto bad_area;
146 flags |= FAULT_FLAG_WRITE;
147 } else if (is_exec) {
148 if (!(vma->vm_flags & VM_EXEC))

--- 42 unchanged lines hidden (view full) ---

191 mmap_read_unlock(mm);
192 return;
193
194 /* Something tried to access memory that isn't in our memory map..
195 * Fix it, but check if it's kernel or user first..
196 */
197bad_area:
198 mmap_read_unlock(mm);
199bad_area_nosemaphore:
208 if (user_mode(regs)) {
209 force_sig_fault(SIGSEGV, code, (void *) address);
210 return;
211 }
212 bad_page_fault(regs, address, SIGSEGV);
213 return;
214
215

--- 48 unchanged lines hidden ---
200 if (user_mode(regs)) {
201 force_sig_fault(SIGSEGV, code, (void *) address);
202 return;
203 }
204 bad_page_fault(regs, address, SIGSEGV);
205 return;
206
207

--- 48 unchanged lines hidden ---