arm64: kill ESR_LNX_EXEC
[deliverable/linux.git] / arch / arm64 / mm / fault.c
1 /*
2 * Based on arch/arm/mm/fault.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Copyright (C) 1995-2004 Russell King
6 * Copyright (C) 2012 ARM Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include <linux/module.h>
22 #include <linux/signal.h>
23 #include <linux/mm.h>
24 #include <linux/hardirq.h>
25 #include <linux/init.h>
26 #include <linux/kprobes.h>
27 #include <linux/uaccess.h>
28 #include <linux/page-flags.h>
29 #include <linux/sched.h>
30 #include <linux/highmem.h>
31 #include <linux/perf_event.h>
32
33 #include <asm/cpufeature.h>
34 #include <asm/exception.h>
35 #include <asm/debug-monitors.h>
36 #include <asm/esr.h>
37 #include <asm/sysreg.h>
38 #include <asm/system_misc.h>
39 #include <asm/pgtable.h>
40 #include <asm/tlbflush.h>
41
42 static const char *fault_name(unsigned int esr);
43
44 /*
45 * Dump out the page tables associated with 'addr' in mm 'mm'.
46 */
47 void show_pte(struct mm_struct *mm, unsigned long addr)
48 {
49 pgd_t *pgd;
50
51 if (!mm)
52 mm = &init_mm;
53
54 pr_alert("pgd = %p\n", mm->pgd);
55 pgd = pgd_offset(mm, addr);
56 pr_alert("[%08lx] *pgd=%016llx", addr, pgd_val(*pgd));
57
58 do {
59 pud_t *pud;
60 pmd_t *pmd;
61 pte_t *pte;
62
63 if (pgd_none(*pgd) || pgd_bad(*pgd))
64 break;
65
66 pud = pud_offset(pgd, addr);
67 printk(", *pud=%016llx", pud_val(*pud));
68 if (pud_none(*pud) || pud_bad(*pud))
69 break;
70
71 pmd = pmd_offset(pud, addr);
72 printk(", *pmd=%016llx", pmd_val(*pmd));
73 if (pmd_none(*pmd) || pmd_bad(*pmd))
74 break;
75
76 pte = pte_offset_map(pmd, addr);
77 printk(", *pte=%016llx", pte_val(*pte));
78 pte_unmap(pte);
79 } while(0);
80
81 printk("\n");
82 }
83
84 #ifdef CONFIG_ARM64_HW_AFDBM
85 /*
86 * This function sets the access flags (dirty, accessed), as well as write
87 * permission, and only to a more permissive setting.
88 *
89 * It needs to cope with hardware update of the accessed/dirty state by other
90 * agents in the system and can safely skip the __sync_icache_dcache() call as,
91 * like set_pte_at(), the PTE is never changed from no-exec to exec here.
92 *
93 * Returns whether or not the PTE actually changed.
94 */
95 int ptep_set_access_flags(struct vm_area_struct *vma,
96 unsigned long address, pte_t *ptep,
97 pte_t entry, int dirty)
98 {
99 pteval_t old_pteval;
100 unsigned int tmp;
101
102 if (pte_same(*ptep, entry))
103 return 0;
104
105 /* only preserve the access flags and write permission */
106 pte_val(entry) &= PTE_AF | PTE_WRITE | PTE_DIRTY;
107
108 /*
109 * PTE_RDONLY is cleared by default in the asm below, so set it in
110 * back if necessary (read-only or clean PTE).
111 */
112 if (!pte_write(entry) || !pte_sw_dirty(entry))
113 pte_val(entry) |= PTE_RDONLY;
114
115 /*
116 * Setting the flags must be done atomically to avoid racing with the
117 * hardware update of the access/dirty state.
118 */
119 asm volatile("// ptep_set_access_flags\n"
120 " prfm pstl1strm, %2\n"
121 "1: ldxr %0, %2\n"
122 " and %0, %0, %3 // clear PTE_RDONLY\n"
123 " orr %0, %0, %4 // set flags\n"
124 " stxr %w1, %0, %2\n"
125 " cbnz %w1, 1b\n"
126 : "=&r" (old_pteval), "=&r" (tmp), "+Q" (pte_val(*ptep))
127 : "L" (~PTE_RDONLY), "r" (pte_val(entry)));
128
129 flush_tlb_fix_spurious_fault(vma, address);
130 return 1;
131 }
132 #endif
133
134 /*
135 * The kernel tried to access some page that wasn't present.
136 */
137 static void __do_kernel_fault(struct mm_struct *mm, unsigned long addr,
138 unsigned int esr, struct pt_regs *regs)
139 {
140 /*
141 * Are we prepared to handle this kernel fault?
142 */
143 if (fixup_exception(regs))
144 return;
145
146 /*
147 * No handler, we'll have to terminate things with extreme prejudice.
148 */
149 bust_spinlocks(1);
150 pr_alert("Unable to handle kernel %s at virtual address %08lx\n",
151 (addr < PAGE_SIZE) ? "NULL pointer dereference" :
152 "paging request", addr);
153
154 show_pte(mm, addr);
155 die("Oops", regs, esr);
156 bust_spinlocks(0);
157 do_exit(SIGKILL);
158 }
159
160 /*
161 * Something tried to access memory that isn't in our memory map. User mode
162 * accesses just cause a SIGSEGV
163 */
164 static void __do_user_fault(struct task_struct *tsk, unsigned long addr,
165 unsigned int esr, unsigned int sig, int code,
166 struct pt_regs *regs)
167 {
168 struct siginfo si;
169
170 if (unhandled_signal(tsk, sig) && show_unhandled_signals_ratelimited()) {
171 pr_info("%s[%d]: unhandled %s (%d) at 0x%08lx, esr 0x%03x\n",
172 tsk->comm, task_pid_nr(tsk), fault_name(esr), sig,
173 addr, esr);
174 show_pte(tsk->mm, addr);
175 show_regs(regs);
176 }
177
178 tsk->thread.fault_address = addr;
179 tsk->thread.fault_code = esr;
180 si.si_signo = sig;
181 si.si_errno = 0;
182 si.si_code = code;
183 si.si_addr = (void __user *)addr;
184 force_sig_info(sig, &si, tsk);
185 }
186
187 static void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs)
188 {
189 struct task_struct *tsk = current;
190 struct mm_struct *mm = tsk->active_mm;
191
192 /*
193 * If we are in kernel mode at this point, we have no context to
194 * handle this fault with.
195 */
196 if (user_mode(regs))
197 __do_user_fault(tsk, addr, esr, SIGSEGV, SEGV_MAPERR, regs);
198 else
199 __do_kernel_fault(mm, addr, esr, regs);
200 }
201
202 #define VM_FAULT_BADMAP 0x010000
203 #define VM_FAULT_BADACCESS 0x020000
204
205 static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
206 unsigned int mm_flags, unsigned long vm_flags,
207 struct task_struct *tsk)
208 {
209 struct vm_area_struct *vma;
210 int fault;
211
212 vma = find_vma(mm, addr);
213 fault = VM_FAULT_BADMAP;
214 if (unlikely(!vma))
215 goto out;
216 if (unlikely(vma->vm_start > addr))
217 goto check_stack;
218
219 /*
220 * Ok, we have a good vm_area for this memory access, so we can handle
221 * it.
222 */
223 good_area:
224 /*
225 * Check that the permissions on the VMA allow for the fault which
226 * occurred. If we encountered a write or exec fault, we must have
227 * appropriate permissions, otherwise we allow any permission.
228 */
229 if (!(vma->vm_flags & vm_flags)) {
230 fault = VM_FAULT_BADACCESS;
231 goto out;
232 }
233
234 return handle_mm_fault(mm, vma, addr & PAGE_MASK, mm_flags);
235
236 check_stack:
237 if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
238 goto good_area;
239 out:
240 return fault;
241 }
242
243 static inline bool is_permission_fault(unsigned int esr)
244 {
245 unsigned int ec = ESR_ELx_EC(esr);
246 unsigned int fsc_type = esr & ESR_ELx_FSC_TYPE;
247
248 return (ec == ESR_ELx_EC_DABT_CUR && fsc_type == ESR_ELx_FSC_PERM);
249 }
250
251 static bool is_el0_instruction_abort(unsigned int esr)
252 {
253 return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_LOW;
254 }
255
256 static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
257 struct pt_regs *regs)
258 {
259 struct task_struct *tsk;
260 struct mm_struct *mm;
261 int fault, sig, code;
262 unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
263 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
264
265 tsk = current;
266 mm = tsk->mm;
267
268 /*
269 * If we're in an interrupt or have no user context, we must not take
270 * the fault.
271 */
272 if (faulthandler_disabled() || !mm)
273 goto no_context;
274
275 if (user_mode(regs))
276 mm_flags |= FAULT_FLAG_USER;
277
278 if (is_el0_instruction_abort(esr)) {
279 vm_flags = VM_EXEC;
280 } else if ((esr & ESR_ELx_WNR) && !(esr & ESR_ELx_CM)) {
281 vm_flags = VM_WRITE;
282 mm_flags |= FAULT_FLAG_WRITE;
283 }
284
285 if (is_permission_fault(esr) && (addr < USER_DS)) {
286 if (get_fs() == KERNEL_DS)
287 die("Accessing user space memory with fs=KERNEL_DS", regs, esr);
288
289 if (!search_exception_tables(regs->pc))
290 die("Accessing user space memory outside uaccess.h routines", regs, esr);
291 }
292
293 /*
294 * As per x86, we may deadlock here. However, since the kernel only
295 * validly references user space from well defined areas of the code,
296 * we can bug out early if this is from code which shouldn't.
297 */
298 if (!down_read_trylock(&mm->mmap_sem)) {
299 if (!user_mode(regs) && !search_exception_tables(regs->pc))
300 goto no_context;
301 retry:
302 down_read(&mm->mmap_sem);
303 } else {
304 /*
305 * The above down_read_trylock() might have succeeded in which
306 * case, we'll have missed the might_sleep() from down_read().
307 */
308 might_sleep();
309 #ifdef CONFIG_DEBUG_VM
310 if (!user_mode(regs) && !search_exception_tables(regs->pc))
311 goto no_context;
312 #endif
313 }
314
315 fault = __do_page_fault(mm, addr, mm_flags, vm_flags, tsk);
316
317 /*
318 * If we need to retry but a fatal signal is pending, handle the
319 * signal first. We do not need to release the mmap_sem because it
320 * would already be released in __lock_page_or_retry in mm/filemap.c.
321 */
322 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
323 return 0;
324
325 /*
326 * Major/minor page fault accounting is only done on the initial
327 * attempt. If we go through a retry, it is extremely likely that the
328 * page will be found in page cache at that point.
329 */
330
331 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
332 if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
333 if (fault & VM_FAULT_MAJOR) {
334 tsk->maj_flt++;
335 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs,
336 addr);
337 } else {
338 tsk->min_flt++;
339 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs,
340 addr);
341 }
342 if (fault & VM_FAULT_RETRY) {
343 /*
344 * Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk of
345 * starvation.
346 */
347 mm_flags &= ~FAULT_FLAG_ALLOW_RETRY;
348 mm_flags |= FAULT_FLAG_TRIED;
349 goto retry;
350 }
351 }
352
353 up_read(&mm->mmap_sem);
354
355 /*
356 * Handle the "normal" case first - VM_FAULT_MAJOR
357 */
358 if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP |
359 VM_FAULT_BADACCESS))))
360 return 0;
361
362 /*
363 * If we are in kernel mode at this point, we have no context to
364 * handle this fault with.
365 */
366 if (!user_mode(regs))
367 goto no_context;
368
369 if (fault & VM_FAULT_OOM) {
370 /*
371 * We ran out of memory, call the OOM killer, and return to
372 * userspace (which will retry the fault, or kill us if we got
373 * oom-killed).
374 */
375 pagefault_out_of_memory();
376 return 0;
377 }
378
379 if (fault & VM_FAULT_SIGBUS) {
380 /*
381 * We had some memory, but were unable to successfully fix up
382 * this page fault.
383 */
384 sig = SIGBUS;
385 code = BUS_ADRERR;
386 } else {
387 /*
388 * Something tried to access memory that isn't in our memory
389 * map.
390 */
391 sig = SIGSEGV;
392 code = fault == VM_FAULT_BADACCESS ?
393 SEGV_ACCERR : SEGV_MAPERR;
394 }
395
396 __do_user_fault(tsk, addr, esr, sig, code, regs);
397 return 0;
398
399 no_context:
400 __do_kernel_fault(mm, addr, esr, regs);
401 return 0;
402 }
403
404 /*
405 * First Level Translation Fault Handler
406 *
407 * We enter here because the first level page table doesn't contain a valid
408 * entry for the address.
409 *
410 * If the address is in kernel space (>= TASK_SIZE), then we are probably
411 * faulting in the vmalloc() area.
412 *
413 * If the init_task's first level page tables contains the relevant entry, we
414 * copy the it to this task. If not, we send the process a signal, fixup the
415 * exception, or oops the kernel.
416 *
417 * NOTE! We MUST NOT take any locks for this case. We may be in an interrupt
418 * or a critical region, and should only copy the information from the master
419 * page table, nothing more.
420 */
421 static int __kprobes do_translation_fault(unsigned long addr,
422 unsigned int esr,
423 struct pt_regs *regs)
424 {
425 if (addr < TASK_SIZE)
426 return do_page_fault(addr, esr, regs);
427
428 do_bad_area(addr, esr, regs);
429 return 0;
430 }
431
432 static int do_alignment_fault(unsigned long addr, unsigned int esr,
433 struct pt_regs *regs)
434 {
435 do_bad_area(addr, esr, regs);
436 return 0;
437 }
438
439 /*
440 * This abort handler always returns "fault".
441 */
442 static int do_bad(unsigned long addr, unsigned int esr, struct pt_regs *regs)
443 {
444 return 1;
445 }
446
447 static const struct fault_info {
448 int (*fn)(unsigned long addr, unsigned int esr, struct pt_regs *regs);
449 int sig;
450 int code;
451 const char *name;
452 } fault_info[] = {
453 { do_bad, SIGBUS, 0, "ttbr address size fault" },
454 { do_bad, SIGBUS, 0, "level 1 address size fault" },
455 { do_bad, SIGBUS, 0, "level 2 address size fault" },
456 { do_bad, SIGBUS, 0, "level 3 address size fault" },
457 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 0 translation fault" },
458 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 1 translation fault" },
459 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" },
460 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" },
461 { do_bad, SIGBUS, 0, "unknown 8" },
462 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" },
463 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" },
464 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" },
465 { do_bad, SIGBUS, 0, "unknown 12" },
466 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" },
467 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" },
468 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" },
469 { do_bad, SIGBUS, 0, "synchronous external abort" },
470 { do_bad, SIGBUS, 0, "unknown 17" },
471 { do_bad, SIGBUS, 0, "unknown 18" },
472 { do_bad, SIGBUS, 0, "unknown 19" },
473 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
474 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
475 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
476 { do_bad, SIGBUS, 0, "synchronous abort (translation table walk)" },
477 { do_bad, SIGBUS, 0, "synchronous parity error" },
478 { do_bad, SIGBUS, 0, "unknown 25" },
479 { do_bad, SIGBUS, 0, "unknown 26" },
480 { do_bad, SIGBUS, 0, "unknown 27" },
481 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
482 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
483 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
484 { do_bad, SIGBUS, 0, "synchronous parity error (translation table walk)" },
485 { do_bad, SIGBUS, 0, "unknown 32" },
486 { do_alignment_fault, SIGBUS, BUS_ADRALN, "alignment fault" },
487 { do_bad, SIGBUS, 0, "unknown 34" },
488 { do_bad, SIGBUS, 0, "unknown 35" },
489 { do_bad, SIGBUS, 0, "unknown 36" },
490 { do_bad, SIGBUS, 0, "unknown 37" },
491 { do_bad, SIGBUS, 0, "unknown 38" },
492 { do_bad, SIGBUS, 0, "unknown 39" },
493 { do_bad, SIGBUS, 0, "unknown 40" },
494 { do_bad, SIGBUS, 0, "unknown 41" },
495 { do_bad, SIGBUS, 0, "unknown 42" },
496 { do_bad, SIGBUS, 0, "unknown 43" },
497 { do_bad, SIGBUS, 0, "unknown 44" },
498 { do_bad, SIGBUS, 0, "unknown 45" },
499 { do_bad, SIGBUS, 0, "unknown 46" },
500 { do_bad, SIGBUS, 0, "unknown 47" },
501 { do_bad, SIGBUS, 0, "TLB conflict abort" },
502 { do_bad, SIGBUS, 0, "unknown 49" },
503 { do_bad, SIGBUS, 0, "unknown 50" },
504 { do_bad, SIGBUS, 0, "unknown 51" },
505 { do_bad, SIGBUS, 0, "implementation fault (lockdown abort)" },
506 { do_bad, SIGBUS, 0, "implementation fault (unsupported exclusive)" },
507 { do_bad, SIGBUS, 0, "unknown 54" },
508 { do_bad, SIGBUS, 0, "unknown 55" },
509 { do_bad, SIGBUS, 0, "unknown 56" },
510 { do_bad, SIGBUS, 0, "unknown 57" },
511 { do_bad, SIGBUS, 0, "unknown 58" },
512 { do_bad, SIGBUS, 0, "unknown 59" },
513 { do_bad, SIGBUS, 0, "unknown 60" },
514 { do_bad, SIGBUS, 0, "section domain fault" },
515 { do_bad, SIGBUS, 0, "page domain fault" },
516 { do_bad, SIGBUS, 0, "unknown 63" },
517 };
518
519 static const char *fault_name(unsigned int esr)
520 {
521 const struct fault_info *inf = fault_info + (esr & 63);
522 return inf->name;
523 }
524
525 /*
526 * Dispatch a data abort to the relevant handler.
527 */
528 asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr,
529 struct pt_regs *regs)
530 {
531 const struct fault_info *inf = fault_info + (esr & 63);
532 struct siginfo info;
533
534 if (!inf->fn(addr, esr, regs))
535 return;
536
537 pr_alert("Unhandled fault: %s (0x%08x) at 0x%016lx\n",
538 inf->name, esr, addr);
539
540 info.si_signo = inf->sig;
541 info.si_errno = 0;
542 info.si_code = inf->code;
543 info.si_addr = (void __user *)addr;
544 arm64_notify_die("", regs, &info, esr);
545 }
546
547 /*
548 * Handle stack alignment exceptions.
549 */
550 asmlinkage void __exception do_sp_pc_abort(unsigned long addr,
551 unsigned int esr,
552 struct pt_regs *regs)
553 {
554 struct siginfo info;
555 struct task_struct *tsk = current;
556
557 if (show_unhandled_signals && unhandled_signal(tsk, SIGBUS))
558 pr_info_ratelimited("%s[%d]: %s exception: pc=%p sp=%p\n",
559 tsk->comm, task_pid_nr(tsk),
560 esr_get_class_string(esr), (void *)regs->pc,
561 (void *)regs->sp);
562
563 info.si_signo = SIGBUS;
564 info.si_errno = 0;
565 info.si_code = BUS_ADRALN;
566 info.si_addr = (void __user *)addr;
567 arm64_notify_die("Oops - SP/PC alignment exception", regs, &info, esr);
568 }
569
570 int __init early_brk64(unsigned long addr, unsigned int esr,
571 struct pt_regs *regs);
572
573 /*
574 * __refdata because early_brk64 is __init, but the reference to it is
575 * clobbered at arch_initcall time.
576 * See traps.c and debug-monitors.c:debug_traps_init().
577 */
578 static struct fault_info __refdata debug_fault_info[] = {
579 { do_bad, SIGTRAP, TRAP_HWBKPT, "hardware breakpoint" },
580 { do_bad, SIGTRAP, TRAP_HWBKPT, "hardware single-step" },
581 { do_bad, SIGTRAP, TRAP_HWBKPT, "hardware watchpoint" },
582 { do_bad, SIGBUS, 0, "unknown 3" },
583 { do_bad, SIGTRAP, TRAP_BRKPT, "aarch32 BKPT" },
584 { do_bad, SIGTRAP, 0, "aarch32 vector catch" },
585 { early_brk64, SIGTRAP, TRAP_BRKPT, "aarch64 BRK" },
586 { do_bad, SIGBUS, 0, "unknown 7" },
587 };
588
589 void __init hook_debug_fault_code(int nr,
590 int (*fn)(unsigned long, unsigned int, struct pt_regs *),
591 int sig, int code, const char *name)
592 {
593 BUG_ON(nr < 0 || nr >= ARRAY_SIZE(debug_fault_info));
594
595 debug_fault_info[nr].fn = fn;
596 debug_fault_info[nr].sig = sig;
597 debug_fault_info[nr].code = code;
598 debug_fault_info[nr].name = name;
599 }
600
601 asmlinkage int __exception do_debug_exception(unsigned long addr,
602 unsigned int esr,
603 struct pt_regs *regs)
604 {
605 const struct fault_info *inf = debug_fault_info + DBG_ESR_EVT(esr);
606 struct siginfo info;
607 int rv;
608
609 /*
610 * Tell lockdep we disabled irqs in entry.S. Do nothing if they were
611 * already disabled to preserve the last enabled/disabled addresses.
612 */
613 if (interrupts_enabled(regs))
614 trace_hardirqs_off();
615
616 if (!inf->fn(addr, esr, regs)) {
617 rv = 1;
618 } else {
619 pr_alert("Unhandled debug exception: %s (0x%08x) at 0x%016lx\n",
620 inf->name, esr, addr);
621
622 info.si_signo = inf->sig;
623 info.si_errno = 0;
624 info.si_code = inf->code;
625 info.si_addr = (void __user *)addr;
626 arm64_notify_die("", regs, &info, 0);
627 rv = 0;
628 }
629
630 if (interrupts_enabled(regs))
631 trace_hardirqs_on();
632
633 return rv;
634 }
635
636 #ifdef CONFIG_ARM64_PAN
637 void cpu_enable_pan(void *__unused)
638 {
639 config_sctlr_el1(SCTLR_EL1_SPAN, 0);
640 }
641 #endif /* CONFIG_ARM64_PAN */
642
643 #ifdef CONFIG_ARM64_UAO
644 /*
645 * Kernel threads have fs=KERNEL_DS by default, and don't need to call
646 * set_fs(), devtmpfs in particular relies on this behaviour.
647 * We need to enable the feature at runtime (instead of adding it to
648 * PSR_MODE_EL1h) as the feature may not be implemented by the cpu.
649 */
650 void cpu_enable_uao(void *__unused)
651 {
652 asm(SET_PSTATE_UAO(1));
653 }
654 #endif /* CONFIG_ARM64_UAO */
This page took 0.061217 seconds and 5 git commands to generate.