This source file includes following definitions.
- __do_compat_cache_op
- do_compat_cache_op
- compat_arm_syscall
1
2
3
4
5
6
7
8
9
10 #include <linux/compat.h>
11 #include <linux/cpufeature.h>
12 #include <linux/personality.h>
13 #include <linux/sched.h>
14 #include <linux/sched/signal.h>
15 #include <linux/slab.h>
16 #include <linux/syscalls.h>
17 #include <linux/uaccess.h>
18
19 #include <asm/cacheflush.h>
20 #include <asm/system_misc.h>
21 #include <asm/tlbflush.h>
22 #include <asm/unistd.h>
23
24 static long
25 __do_compat_cache_op(unsigned long start, unsigned long end)
26 {
27 long ret;
28
29 do {
30 unsigned long chunk = min(PAGE_SIZE, end - start);
31
32 if (fatal_signal_pending(current))
33 return 0;
34
35 if (cpus_have_const_cap(ARM64_WORKAROUND_1542419)) {
36
37
38
39
40 __tlbi(aside1is, __TLBI_VADDR(0, 0));
41 dsb(ish);
42 }
43
44 ret = __flush_cache_user_range(start, start + chunk);
45 if (ret)
46 return ret;
47
48 cond_resched();
49 start += chunk;
50 } while (start < end);
51
52 return 0;
53 }
54
55 static inline long
56 do_compat_cache_op(unsigned long start, unsigned long end, int flags)
57 {
58 if (end < start || flags)
59 return -EINVAL;
60
61 if (!access_ok((const void __user *)start, end - start))
62 return -EFAULT;
63
64 return __do_compat_cache_op(start, end);
65 }
66
67
68
69 long compat_arm_syscall(struct pt_regs *regs, int scno)
70 {
71 void __user *addr;
72
73 switch (scno) {
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 case __ARM_NR_compat_cacheflush:
89 return do_compat_cache_op(regs->regs[0], regs->regs[1], regs->regs[2]);
90
91 case __ARM_NR_compat_set_tls:
92 current->thread.uw.tp_value = regs->regs[0];
93
94
95
96
97
98 barrier();
99 write_sysreg(regs->regs[0], tpidrro_el0);
100 return 0;
101
102 default:
103
104
105
106
107
108
109 if (scno < __ARM_NR_COMPAT_END)
110 return -ENOSYS;
111 break;
112 }
113
114 addr = (void __user *)instruction_pointer(regs) -
115 (compat_thumb_mode(regs) ? 2 : 4);
116
117 arm64_notify_die("Oops - bad compat syscall(2)", regs,
118 SIGILL, ILL_ILLTRP, addr, scno);
119 return 0;
120 }