@@ -161,18 +161,6 @@ static int read_user_stack_64(unsigned long __user *ptr, unsigned long *ret)
161
161
return read_user_stack_slow (ptr , ret , 8 );
162
162
}
163
163
164
- static int read_user_stack_32 (unsigned int __user * ptr , unsigned int * ret )
165
- {
166
- if ((unsigned long )ptr > TASK_SIZE - sizeof (unsigned int ) ||
167
- ((unsigned long )ptr & 3 ))
168
- return - EFAULT ;
169
-
170
- if (!probe_user_read (ret , ptr , sizeof (* ret )))
171
- return 0 ;
172
-
173
- return read_user_stack_slow (ptr , ret , 4 );
174
- }
175
-
176
164
static inline int valid_user_sp (unsigned long sp , int is_64 )
177
165
{
178
166
if (!sp || (sp & 7 ) || sp > (is_64 ? TASK_SIZE : 0x100000000UL ) - 32 )
@@ -277,19 +265,9 @@ static void perf_callchain_user_64(struct perf_callchain_entry_ctx *entry,
277
265
}
278
266
279
267
#else /* CONFIG_PPC64 */
280
- /*
281
- * On 32-bit we just access the address and let hash_page create a
282
- * HPTE if necessary, so there is no need to fall back to reading
283
- * the page tables. Since this is called at interrupt level,
284
- * do_page_fault() won't treat a DSI as a page fault.
285
- */
286
- static int read_user_stack_32 (unsigned int __user * ptr , unsigned int * ret )
268
+ static int read_user_stack_slow (void __user * ptr , void * buf , int nb )
287
269
{
288
- if ((unsigned long )ptr > TASK_SIZE - sizeof (unsigned int ) ||
289
- ((unsigned long )ptr & 3 ))
290
- return - EFAULT ;
291
-
292
- return probe_user_read (ret , ptr , sizeof (* ret ));
270
+ return 0 ;
293
271
}
294
272
295
273
static inline void perf_callchain_user_64 (struct perf_callchain_entry_ctx * entry ,
@@ -312,6 +290,28 @@ static inline int valid_user_sp(unsigned long sp, int is_64)
312
290
313
291
#endif /* CONFIG_PPC64 */
314
292
293
+ /*
294
+ * On 32-bit we just access the address and let hash_page create a
295
+ * HPTE if necessary, so there is no need to fall back to reading
296
+ * the page tables. Since this is called at interrupt level,
297
+ * do_page_fault() won't treat a DSI as a page fault.
298
+ */
299
+ static int read_user_stack_32 (unsigned int __user * ptr , unsigned int * ret )
300
+ {
301
+ int rc ;
302
+
303
+ if ((unsigned long )ptr > TASK_SIZE - sizeof (unsigned int ) ||
304
+ ((unsigned long )ptr & 3 ))
305
+ return - EFAULT ;
306
+
307
+ rc = probe_user_read (ret , ptr , sizeof (* ret ));
308
+
309
+ if (IS_ENABLED (CONFIG_PPC64 ) && rc )
310
+ return read_user_stack_slow (ptr , ret , 4 );
311
+
312
+ return rc ;
313
+ }
314
+
315
315
/*
316
316
* Layout for non-RT signal frames
317
317
*/
0 commit comments