28
28
29
29
#define DEBUG_SIG 0
30
30
31
- #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
32
-
33
- int do_signal (struct pt_regs * , sigset_t * );
34
-
35
- asmlinkage int
36
- sys_rt_sigsuspend (sigset_t __user * unewset , size_t sigsetsize ,
37
- unsigned long r2 , unsigned long r3 , unsigned long r4 ,
38
- unsigned long r5 , unsigned long r6 , struct pt_regs * regs )
39
- {
40
- sigset_t newset ;
41
-
42
- /* XXX: Don't preclude handling different sized sigset_t's. */
43
- if (sigsetsize != sizeof (sigset_t ))
44
- return - EINVAL ;
45
-
46
- if (copy_from_user (& newset , unewset , sizeof (newset )))
47
- return - EFAULT ;
48
- sigdelsetmask (& newset , sigmask (SIGKILL )|sigmask (SIGSTOP ));
49
-
50
- spin_lock_irq (& current -> sighand -> siglock );
51
- current -> saved_sigmask = current -> blocked ;
52
- current -> blocked = newset ;
53
- recalc_sigpending ();
54
- spin_unlock_irq (& current -> sighand -> siglock );
55
-
56
- current -> state = TASK_INTERRUPTIBLE ;
57
- schedule ();
58
- set_thread_flag (TIF_RESTORE_SIGMASK );
59
- return - ERESTARTNOHAND ;
60
- }
61
-
62
31
asmlinkage int
63
32
sys_sigaltstack (const stack_t __user * uss , stack_t __user * uoss ,
64
33
unsigned long r2 , unsigned long r3 , unsigned long r4 ,
@@ -332,12 +301,13 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
332
301
* want to handle. Thus you cannot kill init even with a SIGKILL even by
333
302
* mistake.
334
303
*/
335
- int do_signal (struct pt_regs * regs , sigset_t * oldset )
304
+ static int do_signal (struct pt_regs * regs )
336
305
{
337
306
siginfo_t info ;
338
307
int signr ;
339
308
struct k_sigaction ka ;
340
309
unsigned short inst ;
310
+ sigset_t * oldset ;
341
311
342
312
/*
343
313
* We want the common case to go fast, which
@@ -351,7 +321,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
351
321
if (try_to_freeze ())
352
322
goto no_signal ;
353
323
354
- if (!oldset )
324
+ if (test_thread_flag (TIF_RESTORE_SIGMASK ))
325
+ oldset = & current -> saved_sigmask ;
326
+ else
355
327
oldset = & current -> blocked ;
356
328
357
329
signr = get_signal_to_deliver (& info , & ka , regs , NULL );
@@ -364,6 +336,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
364
336
365
337
/* Whee! Actually deliver the signal. */
366
338
handle_signal (signr , & ka , & info , oldset , regs );
339
+ clear_thread_flag (TIF_RESTORE_SIGMASK );
367
340
return 1 ;
368
341
}
369
342
@@ -391,23 +364,26 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
391
364
regs -> bpc -= 4 ;
392
365
}
393
366
}
367
+ if (test_thread_flag (TIF_RESTORE_SIGMASK )) {
368
+ clear_thread_flag (TIF_RESTORE_SIGMASK );
369
+ sigprocmask (SIG_SETMASK , & current -> saved_sigmask , NULL );
370
+ }
394
371
return 0 ;
395
372
}
396
373
397
374
/*
398
375
* notification of userspace execution resumption
399
376
* - triggered by current->work.notify_resume
400
377
*/
401
- void do_notify_resume (struct pt_regs * regs , sigset_t * oldset ,
402
- __u32 thread_info_flags )
378
+ void do_notify_resume (struct pt_regs * regs , __u32 thread_info_flags )
403
379
{
404
380
/* Pending single-step? */
405
381
if (thread_info_flags & _TIF_SINGLESTEP )
406
382
clear_thread_flag (TIF_SINGLESTEP );
407
383
408
384
/* deal with pending signal delivery */
409
385
if (thread_info_flags & _TIF_SIGPENDING )
410
- do_signal (regs , oldset );
386
+ do_signal (regs );
411
387
412
388
if (thread_info_flags & _TIF_NOTIFY_RESUME ) {
413
389
clear_thread_flag (TIF_NOTIFY_RESUME );
0 commit comments