blob: 9f75b6444bf12fa0149d22fa3ea63c4e6d233a9c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Adrian Bunk88278ca2008-05-19 16:53:02 -07002/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * fault.c: Page fault handlers for the Sparc.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be)
7 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
8 */
9
10#include <asm/head.h>
11
12#include <linux/string.h>
13#include <linux/types.h>
14#include <linux/sched.h>
15#include <linux/ptrace.h>
16#include <linux/mman.h>
17#include <linux/threads.h>
18#include <linux/kernel.h>
19#include <linux/signal.h>
20#include <linux/mm.h>
21#include <linux/smp.h>
David S. Millera084b662010-01-20 03:04:14 -080022#include <linux/perf_event.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include <linux/interrupt.h>
Christoph Hellwig1eeb66a2007-05-08 00:27:03 -070024#include <linux/kdebug.h>
David Hildenbrand70ffdb92015-05-11 17:52:11 +020025#include <linux/uaccess.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <asm/page.h>
28#include <asm/pgtable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <asm/openprom.h>
30#include <asm/oplib.h>
Sam Ravnborg9edfae32014-04-21 21:39:38 +020031#include <asm/setup.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <asm/smp.h>
33#include <asm/traps.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
Sam Ravnborge1b2f1342014-04-21 21:39:17 +020035#include "mm_32.h"
David S. Miller4b177642010-03-01 00:02:23 -080036
Sam Ravnborge1b2f1342014-04-21 21:39:17 +020037int show_unhandled_signals = 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Sam Ravnborg70168df2012-05-15 19:02:08 +020039static void __noreturn unhandled_fault(unsigned long address,
40 struct task_struct *tsk,
41 struct pt_regs *regs)
Linus Torvalds1da177e2005-04-16 15:20:36 -070042{
Sam Ravnborg70168df2012-05-15 19:02:08 +020043 if ((unsigned long) address < PAGE_SIZE) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 printk(KERN_ALERT
45 "Unable to handle kernel NULL pointer dereference\n");
46 } else {
Sam Ravnborg70168df2012-05-15 19:02:08 +020047 printk(KERN_ALERT "Unable to handle kernel paging request at virtual address %08lx\n",
48 address);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 }
50 printk(KERN_ALERT "tsk->{mm,active_mm}->context = %08lx\n",
51 (tsk->mm ? tsk->mm->context : tsk->active_mm->context));
52 printk(KERN_ALERT "tsk->{mm,active_mm}->pgd = %08lx\n",
53 (tsk->mm ? (unsigned long) tsk->mm->pgd :
Sam Ravnborg70168df2012-05-15 19:02:08 +020054 (unsigned long) tsk->active_mm->pgd));
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 die_if_kernel("Oops", regs);
56}
57
Sam Ravnborg70168df2012-05-15 19:02:08 +020058asmlinkage int lookup_fault(unsigned long pc, unsigned long ret_pc,
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 unsigned long address)
60{
61 struct pt_regs regs;
62 unsigned long g2;
63 unsigned int insn;
64 int i;
Sam Ravnborg70168df2012-05-15 19:02:08 +020065
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 i = search_extables_range(ret_pc, &g2);
67 switch (i) {
68 case 3:
69 /* load & store will be handled by fixup */
70 return 3;
71
72 case 1:
73 /* store will be handled by fixup, load will bump out */
74 /* for _to_ macros */
75 insn = *((unsigned int *) pc);
76 if ((insn >> 21) & 1)
77 return 1;
78 break;
79
80 case 2:
81 /* load will be handled by fixup, store will bump out */
82 /* for _from_ macros */
83 insn = *((unsigned int *) pc);
84 if (!((insn >> 21) & 1) || ((insn>>19)&0x3f) == 15)
Sam Ravnborg70168df2012-05-15 19:02:08 +020085 return 2;
86 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
88 default:
89 break;
Joe Perches6cb79b32011-06-03 14:45:23 +000090 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
Sam Ravnborg70168df2012-05-15 19:02:08 +020092 memset(&regs, 0, sizeof(regs));
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 regs.pc = pc;
94 regs.npc = pc + 4;
95 __asm__ __volatile__(
96 "rd %%psr, %0\n\t"
97 "nop\n\t"
98 "nop\n\t"
99 "nop\n" : "=r" (regs.psr));
100 unhandled_fault(address, current, &regs);
101
102 /* Not reached */
103 return 0;
104}
105
David S. Miller4b177642010-03-01 00:02:23 -0800106static inline void
107show_signal_msg(struct pt_regs *regs, int sig, int code,
108 unsigned long address, struct task_struct *tsk)
109{
110 if (!unhandled_signal(tsk, sig))
111 return;
112
113 if (!printk_ratelimit())
114 return;
115
Kees Cook10a7e9d2017-12-19 13:52:23 -0800116 printk("%s%s[%d]: segfault at %lx ip %px (rpc %px) sp %px error %x",
David S. Miller4b177642010-03-01 00:02:23 -0800117 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
118 tsk->comm, task_pid_nr(tsk), address,
119 (void *)regs->pc, (void *)regs->u_regs[UREG_I7],
120 (void *)regs->u_regs[UREG_FP], code);
121
122 print_vma_addr(KERN_CONT " in ", regs->pc);
123
124 printk(KERN_CONT "\n");
125}
126
127static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs,
128 unsigned long addr)
129{
David S. Miller4b177642010-03-01 00:02:23 -0800130 if (unlikely(show_unhandled_signals))
Eric W. Biedermand1f5bef2018-04-19 16:59:56 -0500131 show_signal_msg(regs, sig, code,
David S. Miller4b177642010-03-01 00:02:23 -0800132 addr, current);
133
Eric W. Biedermand1f5bef2018-04-19 16:59:56 -0500134 force_sig_fault(sig, code, (void __user *) addr, 0, current);
David S. Miller4b177642010-03-01 00:02:23 -0800135}
136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
138{
139 unsigned int insn;
140
141 if (text_fault)
142 return regs->pc;
143
Sam Ravnborg70168df2012-05-15 19:02:08 +0200144 if (regs->psr & PSR_PS)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 insn = *(unsigned int *) regs->pc;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200146 else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 __get_user(insn, (unsigned int *) regs->pc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148
149 return safe_compute_effective_address(regs, insn);
150}
151
David S. Miller4b177642010-03-01 00:02:23 -0800152static noinline void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
153 int text_fault)
154{
155 unsigned long addr = compute_si_addr(regs, text_fault);
156
157 __do_fault_siginfo(code, sig, regs, addr);
158}
159
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
161 unsigned long address)
162{
163 struct vm_area_struct *vma;
164 struct task_struct *tsk = current;
165 struct mm_struct *mm = tsk->mm;
166 unsigned int fixup;
167 unsigned long g2;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 int from_user = !(regs->psr & PSR_PS);
David S. Miller4b177642010-03-01 00:02:23 -0800169 int fault, code;
Johannes Weiner759496b2013-09-12 15:13:39 -0700170 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
Sam Ravnborg70168df2012-05-15 19:02:08 +0200172 if (text_fault)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 address = regs->pc;
174
175 /*
176 * We fault-in kernel-space virtual memory on-demand. The
177 * 'reference' page table is init_mm.pgd.
178 *
179 * NOTE! We MUST NOT take any locks for this case. We may
180 * be in an interrupt or a critical region, and should
181 * only copy the information from the master page table,
182 * nothing more.
183 */
David S. Millerc816be72011-03-09 13:00:47 -0800184 code = SEGV_MAPERR;
Sam Ravnborg582a0ba2012-05-11 11:35:08 +0000185 if (address >= TASK_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 goto vmalloc_fault;
187
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 /*
189 * If we're in an interrupt or have no user
190 * context, we must not take the fault..
191 */
David Hildenbrand70ffdb92015-05-11 17:52:11 +0200192 if (pagefault_disabled() || !mm)
Sam Ravnborg70168df2012-05-15 19:02:08 +0200193 goto no_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
Peter Zijlstraa8b0ca12011-06-27 14:41:57 +0200195 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
David S. Millera084b662010-01-20 03:04:14 -0800196
Kautuk Consulc29554f2012-03-26 06:47:54 +0000197retry:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 down_read(&mm->mmap_sem);
199
Sam Ravnborg70168df2012-05-15 19:02:08 +0200200 if (!from_user && address >= PAGE_OFFSET)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 goto bad_area;
202
203 vma = find_vma(mm, address);
Sam Ravnborg70168df2012-05-15 19:02:08 +0200204 if (!vma)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 goto bad_area;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200206 if (vma->vm_start <= address)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207 goto good_area;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200208 if (!(vma->vm_flags & VM_GROWSDOWN))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209 goto bad_area;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200210 if (expand_stack(vma, address))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211 goto bad_area;
212 /*
213 * Ok, we have a good vm_area for this memory access, so
214 * we can handle it..
215 */
216good_area:
David S. Miller4b177642010-03-01 00:02:23 -0800217 code = SEGV_ACCERR;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200218 if (write) {
219 if (!(vma->vm_flags & VM_WRITE))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 goto bad_area;
221 } else {
222 /* Allow reads even for write-only mappings */
Sam Ravnborg70168df2012-05-15 19:02:08 +0200223 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 goto bad_area;
225 }
226
Johannes Weiner759496b2013-09-12 15:13:39 -0700227 if (from_user)
228 flags |= FAULT_FLAG_USER;
229 if (write)
230 flags |= FAULT_FLAG_WRITE;
231
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 /*
233 * If for any reason at all we couldn't handle the fault,
234 * make sure we exit gracefully rather than endlessly redo
235 * the fault.
236 */
Kirill A. Shutemovdcddffd2016-07-26 15:25:18 -0700237 fault = handle_mm_fault(vma, address, flags);
Kautuk Consulc29554f2012-03-26 06:47:54 +0000238
239 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
240 return;
241
Nick Piggin83c54072007-07-19 01:47:05 -0700242 if (unlikely(fault & VM_FAULT_ERROR)) {
243 if (fault & VM_FAULT_OOM)
244 goto out_of_memory;
Linus Torvalds33692f22015-01-29 10:51:32 -0800245 else if (fault & VM_FAULT_SIGSEGV)
246 goto bad_area;
Nick Piggin83c54072007-07-19 01:47:05 -0700247 else if (fault & VM_FAULT_SIGBUS)
248 goto do_sigbus;
249 BUG();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 }
Kautuk Consulc29554f2012-03-26 06:47:54 +0000251
252 if (flags & FAULT_FLAG_ALLOW_RETRY) {
253 if (fault & VM_FAULT_MAJOR) {
254 current->maj_flt++;
255 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,
256 1, regs, address);
257 } else {
258 current->min_flt++;
259 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
260 1, regs, address);
261 }
262 if (fault & VM_FAULT_RETRY) {
263 flags &= ~FAULT_FLAG_ALLOW_RETRY;
Shaohua Li45cac652012-10-08 16:32:19 -0700264 flags |= FAULT_FLAG_TRIED;
Kautuk Consulc29554f2012-03-26 06:47:54 +0000265
266 /* No need to up_read(&mm->mmap_sem) as we would
267 * have already released it in __lock_page_or_retry
268 * in mm/filemap.c.
269 */
270
271 goto retry;
272 }
David S. Millera084b662010-01-20 03:04:14 -0800273 }
Kautuk Consulc29554f2012-03-26 06:47:54 +0000274
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 up_read(&mm->mmap_sem);
276 return;
277
278 /*
279 * Something tried to access memory that isn't in our memory map..
280 * Fix it, but check if it's kernel or user first..
281 */
282bad_area:
283 up_read(&mm->mmap_sem);
284
285bad_area_nosemaphore:
286 /* User mode accesses just cause a SIGSEGV */
David S. Miller4b177642010-03-01 00:02:23 -0800287 if (from_user) {
288 do_fault_siginfo(code, SIGSEGV, regs, text_fault);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 return;
290 }
291
292 /* Is this in ex_table? */
293no_context:
294 g2 = regs->u_regs[UREG_G2];
Sam Ravnborg01571412009-01-06 12:52:41 -0800295 if (!from_user) {
296 fixup = search_extables_range(regs->pc, &g2);
Sam Ravnborg70168df2012-05-15 19:02:08 +0200297 /* Values below 10 are reserved for other things */
298 if (fixup > 10) {
Joe Perches9ef595d2016-03-10 15:21:43 -0800299 extern const unsigned int __memset_start[];
300 extern const unsigned int __memset_end[];
301 extern const unsigned int __csum_partial_copy_start[];
302 extern const unsigned int __csum_partial_copy_end[];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303
304#ifdef DEBUG_EXCEPTIONS
Sam Ravnborg70168df2012-05-15 19:02:08 +0200305 printk("Exception: PC<%08lx> faddr<%08lx>\n",
306 regs->pc, address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 printk("EX_TABLE: insn<%08lx> fixup<%08x> g2<%08lx>\n",
308 regs->pc, fixup, g2);
309#endif
310 if ((regs->pc >= (unsigned long)__memset_start &&
311 regs->pc < (unsigned long)__memset_end) ||
312 (regs->pc >= (unsigned long)__csum_partial_copy_start &&
313 regs->pc < (unsigned long)__csum_partial_copy_end)) {
Sam Ravnborg70168df2012-05-15 19:02:08 +0200314 regs->u_regs[UREG_I4] = address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315 regs->u_regs[UREG_I5] = regs->pc;
316 }
317 regs->u_regs[UREG_G2] = g2;
318 regs->pc = fixup;
319 regs->npc = regs->pc + 4;
320 return;
321 }
322 }
Sam Ravnborg70168df2012-05-15 19:02:08 +0200323
324 unhandled_fault(address, tsk, regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700325 do_exit(SIGKILL);
326
327/*
328 * We ran out of memory, or some other thing happened to us that made
329 * us unable to handle the page fault gracefully.
330 */
331out_of_memory:
332 up_read(&mm->mmap_sem);
David S. Millera923c282009-08-02 19:17:15 -0700333 if (from_user) {
334 pagefault_out_of_memory();
335 return;
336 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 goto no_context;
338
339do_sigbus:
340 up_read(&mm->mmap_sem);
David S. Miller4b177642010-03-01 00:02:23 -0800341 do_fault_siginfo(BUS_ADRERR, SIGBUS, regs, text_fault);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342 if (!from_user)
343 goto no_context;
344
345vmalloc_fault:
346 {
347 /*
348 * Synchronize this task's top level page-table
349 * with the 'reference' page table.
350 */
351 int offset = pgd_index(address);
352 pgd_t *pgd, *pgd_k;
353 pmd_t *pmd, *pmd_k;
354
355 pgd = tsk->active_mm->pgd + offset;
356 pgd_k = init_mm.pgd + offset;
357
358 if (!pgd_present(*pgd)) {
359 if (!pgd_present(*pgd_k))
360 goto bad_area_nosemaphore;
361 pgd_val(*pgd) = pgd_val(*pgd_k);
362 return;
363 }
364
365 pmd = pmd_offset(pgd, address);
366 pmd_k = pmd_offset(pgd_k, address);
367
368 if (pmd_present(*pmd) || !pmd_present(*pmd_k))
369 goto bad_area_nosemaphore;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200370
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 *pmd = *pmd_k;
372 return;
373 }
374}
375
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376/* This always deals with user addresses. */
Adrian Bunk50215d62008-06-05 11:41:51 -0700377static void force_user_fault(unsigned long address, int write)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378{
379 struct vm_area_struct *vma;
380 struct task_struct *tsk = current;
381 struct mm_struct *mm = tsk->mm;
Johannes Weiner759496b2013-09-12 15:13:39 -0700382 unsigned int flags = FAULT_FLAG_USER;
David S. Miller4b177642010-03-01 00:02:23 -0800383 int code;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384
David S. Miller4b177642010-03-01 00:02:23 -0800385 code = SEGV_MAPERR;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 down_read(&mm->mmap_sem);
388 vma = find_vma(mm, address);
Sam Ravnborg70168df2012-05-15 19:02:08 +0200389 if (!vma)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390 goto bad_area;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200391 if (vma->vm_start <= address)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392 goto good_area;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200393 if (!(vma->vm_flags & VM_GROWSDOWN))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 goto bad_area;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200395 if (expand_stack(vma, address))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 goto bad_area;
397good_area:
David S. Miller4b177642010-03-01 00:02:23 -0800398 code = SEGV_ACCERR;
Sam Ravnborg70168df2012-05-15 19:02:08 +0200399 if (write) {
400 if (!(vma->vm_flags & VM_WRITE))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 goto bad_area;
Johannes Weiner759496b2013-09-12 15:13:39 -0700402 flags |= FAULT_FLAG_WRITE;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 } else {
Sam Ravnborg70168df2012-05-15 19:02:08 +0200404 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 goto bad_area;
406 }
Kirill A. Shutemovdcddffd2016-07-26 15:25:18 -0700407 switch (handle_mm_fault(vma, address, flags)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 case VM_FAULT_SIGBUS:
409 case VM_FAULT_OOM:
410 goto do_sigbus;
411 }
412 up_read(&mm->mmap_sem);
413 return;
414bad_area:
415 up_read(&mm->mmap_sem);
David S. Miller4b177642010-03-01 00:02:23 -0800416 __do_fault_siginfo(code, SIGSEGV, tsk->thread.kregs, address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700417 return;
418
419do_sigbus:
420 up_read(&mm->mmap_sem);
David S. Miller4b177642010-03-01 00:02:23 -0800421 __do_fault_siginfo(BUS_ADRERR, SIGBUS, tsk->thread.kregs, address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422}
423
David S. Miller90883332010-09-23 22:06:47 -0700424static void check_stack_aligned(unsigned long sp)
425{
426 if (sp & 0x7UL)
427 force_sig(SIGILL, current);
428}
429
Linus Torvalds1da177e2005-04-16 15:20:36 -0700430void window_overflow_fault(void)
431{
432 unsigned long sp;
433
434 sp = current_thread_info()->rwbuf_stkptrs[0];
Sam Ravnborg70168df2012-05-15 19:02:08 +0200435 if (((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436 force_user_fault(sp + 0x38, 1);
437 force_user_fault(sp, 1);
David S. Miller90883332010-09-23 22:06:47 -0700438
439 check_stack_aligned(sp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440}
441
442void window_underflow_fault(unsigned long sp)
443{
Sam Ravnborg70168df2012-05-15 19:02:08 +0200444 if (((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 force_user_fault(sp + 0x38, 0);
446 force_user_fault(sp, 0);
David S. Miller90883332010-09-23 22:06:47 -0700447
448 check_stack_aligned(sp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449}
450
451void window_ret_fault(struct pt_regs *regs)
452{
453 unsigned long sp;
454
455 sp = regs->u_regs[UREG_FP];
Sam Ravnborg70168df2012-05-15 19:02:08 +0200456 if (((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 force_user_fault(sp + 0x38, 0);
458 force_user_fault(sp, 0);
David S. Miller90883332010-09-23 22:06:47 -0700459
460 check_stack_aligned(sp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461}