hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/arch/arm/include/asm/futex.h
....@@ -50,7 +50,7 @@
5050 int ret;
5151 u32 val;
5252
53
- if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
53
+ if (!access_ok(uaddr, sizeof(u32)))
5454 return -EFAULT;
5555
5656 smp_mb();
....@@ -104,16 +104,17 @@
104104 int ret = 0;
105105 u32 val;
106106
107
- if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
107
+ if (!access_ok(uaddr, sizeof(u32)))
108108 return -EFAULT;
109109
110110 preempt_disable();
111111 __ua_flags = uaccess_save_and_enable();
112112 __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n"
113
+ " .syntax unified\n"
113114 "1: " TUSER(ldr) " %1, [%4]\n"
114115 " teq %1, %2\n"
115116 " it eq @ explicit IT needed for the 2b label\n"
116
- "2: " TUSER(streq) " %3, [%4]\n"
117
+ "2: " TUSERCOND(str, eq) " %3, [%4]\n"
117118 __futex_atomic_ex_table("%5")
118119 : "+r" (ret), "=&r" (val)
119120 : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT)
....@@ -133,10 +134,12 @@
133134 {
134135 int oldval = 0, ret, tmp;
135136
137
+ if (!access_ok(uaddr, sizeof(u32)))
138
+ return -EFAULT;
139
+
136140 #ifndef CONFIG_SMP
137141 preempt_disable();
138142 #endif
139
- pagefault_disable();
140143
141144 switch (op) {
142145 case FUTEX_OP_SET:
....@@ -158,7 +161,6 @@
158161 ret = -ENOSYS;
159162 }
160163
161
- pagefault_enable();
162164 #ifndef CONFIG_SMP
163165 preempt_enable();
164166 #endif