@@ -237,18 +237,22 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
237
237
#endif
238
238
239
239
usp = (regs -> gr [30 ] & ~(0x01UL ));
240
+ sigframe_size = PARISC_RT_SIGFRAME_SIZE ;
240
241
#ifdef CONFIG_64BIT
241
242
if (is_compat_task ()) {
242
243
/* The gcc alloca implementation leaves garbage in the upper 32 bits of sp */
243
244
usp = (compat_uint_t )usp ;
245
+ sigframe_size = PARISC_RT_SIGFRAME_SIZE32 ;
244
246
}
245
247
#endif
246
- /*FIXME: frame_size parameter is unused, remove it. */
247
- frame = get_sigframe (& ksig -> ka , usp , sizeof (* frame ));
248
+ frame = get_sigframe (& ksig -> ka , usp , sigframe_size );
248
249
249
250
DBG (1 ,"SETUP_RT_FRAME: START\n" );
250
251
DBG (1 ,"setup_rt_frame: frame %p info %p\n" , frame , ksig -> info );
251
252
253
+ start = (unsigned long ) frame ;
254
+ if (start >= user_addr_max () - sigframe_size )
255
+ return - EFAULT ;
252
256
253
257
#ifdef CONFIG_64BIT
254
258
@@ -343,11 +347,6 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
343
347
344
348
/* The syscall return path will create IAOQ values from r31.
345
349
*/
346
- sigframe_size = PARISC_RT_SIGFRAME_SIZE ;
347
- #ifdef CONFIG_64BIT
348
- if (is_compat_task ())
349
- sigframe_size = PARISC_RT_SIGFRAME_SIZE32 ;
350
- #endif
351
350
if (in_syscall ) {
352
351
regs -> gr [31 ] = haddr ;
353
352
#ifdef CONFIG_64BIT
@@ -518,6 +517,10 @@ insert_restart_trampoline(struct pt_regs *regs)
518
517
unsigned long end = (unsigned long ) & usp [5 ];
519
518
long err = 0 ;
520
519
520
+ /* check that we don't exceed the stack */
521
+ if (A (& usp [0 ]) >= user_addr_max () - 5 * sizeof (int ))
522
+ return ;
523
+
521
524
/* Setup a trampoline to restart the syscall
522
525
* with __NR_restart_syscall
523
526
*
0 commit comments