header cleaning: don't include smp_lock.h when not used
[GitHub/MotorolaMobilityLLC/kernel-slsi.git] / arch / xtensa / kernel / signal.c
1 // TODO coprocessor stuff
2 /*
3 * linux/arch/xtensa/kernel/signal.c
4 *
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson
7 *
8 * Joe Taylor <joe@tensilica.com>
9 * Chris Zankel <chris@zankel.net>
10 *
11 *
12 *
13 */
14
15 #include <asm/variant/core.h>
16 #include <asm/coprocessor.h>
17 #include <linux/sched.h>
18 #include <linux/mm.h>
19 #include <linux/smp.h>
20 #include <linux/kernel.h>
21 #include <linux/signal.h>
22 #include <linux/errno.h>
23 #include <linux/wait.h>
24 #include <linux/ptrace.h>
25 #include <linux/unistd.h>
26 #include <linux/stddef.h>
27 #include <linux/personality.h>
28 #include <asm/ucontext.h>
29 #include <asm/uaccess.h>
30 #include <asm/pgtable.h>
31 #include <asm/cacheflush.h>
32
33 #define DEBUG_SIG 0
34
35 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
36
37 asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options,
38 struct rusage * ru);
39 asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
40
41 extern struct task_struct *coproc_owners[];
42
43
44 /*
45 * Atomically swap in the new signal mask, and wait for a signal.
46 */
47
48 int xtensa_sigsuspend(struct pt_regs *regs)
49 {
50 old_sigset_t mask = (old_sigset_t) regs->areg[3];
51 sigset_t saveset;
52
53 mask &= _BLOCKABLE;
54 spin_lock_irq(&current->sighand->siglock);
55 saveset = current->blocked;
56 siginitset(&current->blocked, mask);
57 recalc_sigpending();
58 spin_unlock_irq(&current->sighand->siglock);
59
60 regs->areg[2] = -EINTR;
61 while (1) {
62 current->state = TASK_INTERRUPTIBLE;
63 schedule();
64 if (do_signal(regs, &saveset))
65 return -EINTR;
66 }
67 }
68
69 asmlinkage int
70 xtensa_rt_sigsuspend(struct pt_regs *regs)
71 {
72 sigset_t *unewset = (sigset_t *) regs->areg[4];
73 size_t sigsetsize = (size_t) regs->areg[3];
74 sigset_t saveset, newset;
75 /* XXX: Don't preclude handling different sized sigset_t's. */
76 if (sigsetsize != sizeof(sigset_t))
77 return -EINVAL;
78
79 if (copy_from_user(&newset, unewset, sizeof(newset)))
80 return -EFAULT;
81 sigdelsetmask(&newset, ~_BLOCKABLE);
82 spin_lock_irq(&current->sighand->siglock);
83 saveset = current->blocked;
84 current->blocked = newset;
85 recalc_sigpending();
86 spin_unlock_irq(&current->sighand->siglock);
87
88 regs->areg[2] = -EINTR;
89 while (1) {
90 current->state = TASK_INTERRUPTIBLE;
91 schedule();
92 if (do_signal(regs, &saveset))
93 return -EINTR;
94 }
95 }
96
97 asmlinkage int
98 xtensa_sigaction(int sig, const struct old_sigaction *act,
99 struct old_sigaction *oact)
100 {
101 struct k_sigaction new_ka, old_ka;
102 int ret;
103
104 if (act) {
105 old_sigset_t mask;
106 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
107 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
108 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
109 return -EFAULT;
110 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
111 __get_user(mask, &act->sa_mask);
112 siginitset(&new_ka.sa.sa_mask, mask);
113 }
114
115 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
116
117 if (!ret && oact) {
118 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
119 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
120 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
121 return -EFAULT;
122 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
123 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
124 }
125
126 return ret;
127 }
128
129 asmlinkage int
130 xtensa_sigaltstack(struct pt_regs *regs)
131 {
132 const stack_t *uss = (stack_t *) regs->areg[4];
133 stack_t *uoss = (stack_t *) regs->areg[3];
134
135 if (regs->depc > 64)
136 panic ("Double exception sys_sigreturn\n");
137
138
139 return do_sigaltstack(uss, uoss, regs->areg[1]);
140 }
141
142
143 /*
144 * Do a signal return; undo the signal stack.
145 */
146
147 struct sigframe
148 {
149 struct sigcontext sc;
150 struct _cpstate cpstate;
151 unsigned long extramask[_NSIG_WORDS-1];
152 unsigned char retcode[6];
153 unsigned int reserved[4]; /* Reserved area for chaining */
154 unsigned int window[4]; /* Window of 4 registers for initial context */
155 };
156
157 struct rt_sigframe
158 {
159 struct siginfo info;
160 struct ucontext uc;
161 struct _cpstate cpstate;
162 unsigned char retcode[6];
163 unsigned int reserved[4]; /* Reserved area for chaining */
164 unsigned int window[4]; /* Window of 4 registers for initial context */
165 };
166
167 extern void release_all_cp (struct task_struct *);
168
169
170 // FIXME restore_cpextra
171 static inline int
172 restore_cpextra (struct _cpstate *buf)
173 {
174 #if 0
175 /* The signal handler may have used coprocessors in which
176 * case they are still enabled. We disable them to force a
177 * reloading of the original task's CP state by the lazy
178 * context-switching mechanisms of CP exception handling.
179 * Also, we essentially discard any coprocessor state that the
180 * signal handler created. */
181
182 struct task_struct *tsk = current;
183 release_all_cp(tsk);
184 return __copy_from_user(tsk->thread.cpextra, buf, XTENSA_CP_EXTRA_SIZE);
185 #endif
186 return 0;
187 }
188
189 /* Note: We don't copy double exception 'tregs', we have to finish double exc. first before we return to signal handler! This dbl.exc.handler might cause another double exception, but I think we are fine as the situation is the same as if we had returned to the signal handerl and got an interrupt immediately...
190 */
191
192
193 static int
194 restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
195 {
196 struct thread_struct *thread;
197 unsigned int err = 0;
198 unsigned long ps;
199 struct _cpstate *buf;
200
201 #define COPY(x) err |= __get_user(regs->x, &sc->sc_##x)
202 COPY(pc);
203 COPY(depc);
204 COPY(wmask);
205 COPY(lbeg);
206 COPY(lend);
207 COPY(lcount);
208 COPY(sar);
209 COPY(windowbase);
210 COPY(windowstart);
211 #undef COPY
212
213 /* For PS, restore only PS.CALLINC.
214 * Assume that all other bits are either the same as for the signal
215 * handler, or the user mode value doesn't matter (e.g. PS.OWB).
216 */
217 err |= __get_user(ps, &sc->sc_ps);
218 regs->ps = (regs->ps & ~PS_CALLINC_MASK)
219 | (ps & PS_CALLINC_MASK);
220
221 /* Additional corruption checks */
222
223 if ((regs->windowbase >= (XCHAL_NUM_AREGS/4))
224 || ((regs->windowstart & ~((1<<(XCHAL_NUM_AREGS/4)) - 1)) != 0) )
225 err = 1;
226 if ((regs->lcount > 0)
227 && ((regs->lbeg > TASK_SIZE) || (regs->lend > TASK_SIZE)) )
228 err = 1;
229
230 /* Restore extended register state.
231 * See struct thread_struct in processor.h.
232 */
233 thread = &current->thread;
234
235 err |= __copy_from_user (regs->areg, sc->sc_areg, XCHAL_NUM_AREGS*4);
236 err |= __get_user(buf, &sc->sc_cpstate);
237 if (buf) {
238 if (!access_ok(VERIFY_READ, buf, sizeof(*buf)))
239 goto badframe;
240 err |= restore_cpextra(buf);
241 }
242
243 regs->syscall = -1; /* disable syscall checks */
244 return err;
245
246 badframe:
247 return 1;
248 }
249
250 static inline void
251 flush_my_cpstate(struct task_struct *tsk)
252 {
253 unsigned long flags;
254 local_irq_save(flags);
255
256 #if 0 // FIXME
257 for (i = 0; i < XCHAL_CP_NUM; i++) {
258 if (tsk == coproc_owners[i]) {
259 xthal_validate_cp(i);
260 xthal_save_cpregs(tsk->thread.cpregs_ptr[i], i);
261
262 /* Invalidate and "disown" the cp to allow
263 * callers the chance to reset cp state in the
264 * task_struct. */
265
266 xthal_invalidate_cp(i);
267 coproc_owners[i] = 0;
268 }
269 }
270 #endif
271 local_irq_restore(flags);
272 }
273
274 /* Return codes:
275 0: nothing saved
276 1: stuff to save, successful
277 -1: stuff to save, error happened
278 */
279 static int
280 save_cpextra (struct _cpstate *buf)
281 {
282 #if XCHAL_CP_NUM == 0
283 return 0;
284 #else
285
286 /* FIXME: If a task has never used a coprocessor, there is
287 * no need to save and restore anything. Tracking this
288 * information would allow us to optimize this section.
289 * Perhaps we can use current->used_math or (current->flags &
290 * PF_USEDFPU) or define a new field in the thread
291 * structure. */
292
293 /* We flush any live, task-owned cp state to the task_struct,
294 * then copy it all to the sigframe. Then we clear all
295 * cp/extra state in the task_struct, effectively
296 * clearing/resetting all cp/extra state for the signal
297 * handler (cp-exception handling will load these new values
298 * into the cp/extra registers.) This step is important for
299 * things like a floating-point cp, where the OS must reset
300 * the FCR to the default rounding mode. */
301
302 int err = 0;
303 struct task_struct *tsk = current;
304
305 flush_my_cpstate(tsk);
306 /* Note that we just copy everything: 'extra' and 'cp' state together.*/
307 err |= __copy_to_user(buf, tsk->thread.cp_save, XTENSA_CP_EXTRA_SIZE);
308 memset(tsk->thread.cp_save, 0, XTENSA_CP_EXTRA_SIZE);
309
310 #if (XTENSA_CP_EXTRA_SIZE == 0)
311 #error Sanity check on memset above, cpextra_size should not be zero.
312 #endif
313
314 return err ? -1 : 1;
315 #endif
316 }
317
318 static int
319 setup_sigcontext(struct sigcontext *sc, struct _cpstate *cpstate,
320 struct pt_regs *regs, unsigned long mask)
321 {
322 struct thread_struct *thread;
323 int err = 0;
324
325 //printk("setup_sigcontext\n");
326 #define COPY(x) err |= __put_user(regs->x, &sc->sc_##x)
327 COPY(pc);
328 COPY(ps);
329 COPY(depc);
330 COPY(wmask);
331 COPY(lbeg);
332 COPY(lend);
333 COPY(lcount);
334 COPY(sar);
335 COPY(windowbase);
336 COPY(windowstart);
337 #undef COPY
338
339 /* Save extended register state.
340 * See struct thread_struct in processor.h.
341 */
342 thread = &current->thread;
343 err |= __copy_to_user (sc->sc_areg, regs->areg, XCHAL_NUM_AREGS * 4);
344 err |= save_cpextra(cpstate);
345 err |= __put_user(err ? NULL : cpstate, &sc->sc_cpstate);
346 /* non-iBCS2 extensions.. */
347 err |= __put_user(mask, &sc->oldmask);
348
349 return err;
350 }
351
352 asmlinkage int xtensa_sigreturn(struct pt_regs *regs)
353 {
354 struct sigframe *frame = (struct sigframe *)regs->areg[1];
355 sigset_t set;
356 if (regs->depc > 64)
357 panic ("Double exception sys_sigreturn\n");
358
359 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
360 goto badframe;
361
362 if (__get_user(set.sig[0], &frame->sc.oldmask)
363 || (_NSIG_WORDS > 1
364 && __copy_from_user(&set.sig[1], &frame->extramask,
365 sizeof(frame->extramask))))
366 goto badframe;
367
368 sigdelsetmask(&set, ~_BLOCKABLE);
369
370 spin_lock_irq(&current->sighand->siglock);
371 current->blocked = set;
372 recalc_sigpending();
373 spin_unlock_irq(&current->sighand->siglock);
374
375 if (restore_sigcontext(regs, &frame->sc))
376 goto badframe;
377 return regs->areg[2];
378
379 badframe:
380 force_sig(SIGSEGV, current);
381 return 0;
382 }
383
384 asmlinkage int xtensa_rt_sigreturn(struct pt_regs *regs)
385 {
386 struct rt_sigframe *frame = (struct rt_sigframe *)regs->areg[1];
387 sigset_t set;
388 stack_t st;
389 int ret;
390 if (regs->depc > 64)
391 {
392 printk("!!!!!!! DEPC !!!!!!!\n");
393 return 0;
394 }
395
396 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
397 goto badframe;
398
399 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
400 goto badframe;
401
402 sigdelsetmask(&set, ~_BLOCKABLE);
403 spin_lock_irq(&current->sighand->siglock);
404 current->blocked = set;
405 recalc_sigpending();
406 spin_unlock_irq(&current->sighand->siglock);
407
408 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
409 goto badframe;
410 ret = regs->areg[2];
411
412 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
413 goto badframe;
414 /* It is more difficult to avoid calling this function than to
415 call it and ignore errors. */
416 do_sigaltstack(&st, NULL, regs->areg[1]);
417
418 return ret;
419
420 badframe:
421 force_sig(SIGSEGV, current);
422 return 0;
423 }
424
425 /*
426 * Set up a signal frame.
427 */
428
429 /*
430 * Determine which stack to use..
431 */
432 static inline void *
433 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
434 {
435 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
436 sp = current->sas_ss_sp + current->sas_ss_size;
437
438 return (void *)((sp - frame_size) & -16ul);
439 }
440
441 #define USE_SIGRETURN 0
442 #define USE_RT_SIGRETURN 1
443
444 static int
445 gen_return_code(unsigned char *codemem, unsigned int use_rt_sigreturn)
446 {
447 unsigned int retcall;
448 int err = 0;
449
450 #if 0
451 /* Ignoring SA_RESTORER for now; it's supposed to be obsolete,
452 * and the xtensa glibc doesn't use it.
453 */
454 if (ka->sa.sa_flags & SA_RESTORER) {
455 regs->pr = (unsigned long) ka->sa.sa_restorer;
456 } else
457 #endif /* 0 */
458 {
459
460 #if (__NR_sigreturn > 255) || (__NR_rt_sigreturn > 255)
461
462 /* The 12-bit immediate is really split up within the 24-bit MOVI
463 * instruction. As long as the above system call numbers fit within
464 * 8-bits, the following code works fine. See the Xtensa ISA for
465 * details.
466 */
467
468 #error Generating the MOVI instruction below breaks!
469 #endif
470
471 retcall = use_rt_sigreturn ? __NR_rt_sigreturn : __NR_sigreturn;
472
473 #ifdef __XTENSA_EB__ /* Big Endian version */
474 /* Generate instruction: MOVI a2, retcall */
475 err |= __put_user(0x22, &codemem[0]);
476 err |= __put_user(0x0a, &codemem[1]);
477 err |= __put_user(retcall, &codemem[2]);
478 /* Generate instruction: SYSCALL */
479 err |= __put_user(0x00, &codemem[3]);
480 err |= __put_user(0x05, &codemem[4]);
481 err |= __put_user(0x00, &codemem[5]);
482
483 #elif defined __XTENSA_EL__ /* Little Endian version */
484 /* Generate instruction: MOVI a2, retcall */
485 err |= __put_user(0x22, &codemem[0]);
486 err |= __put_user(0xa0, &codemem[1]);
487 err |= __put_user(retcall, &codemem[2]);
488 /* Generate instruction: SYSCALL */
489 err |= __put_user(0x00, &codemem[3]);
490 err |= __put_user(0x50, &codemem[4]);
491 err |= __put_user(0x00, &codemem[5]);
492 #else
493 #error Must use compiler for Xtensa processors.
494 #endif
495 }
496
497 /* Flush generated code out of the data cache */
498
499 if (err == 0) {
500 __invalidate_icache_range((unsigned long)codemem, 6UL);
501 __flush_invalidate_dcache_range((unsigned long)codemem, 6UL);
502 }
503
504 return err;
505 }
506
507 static void
508 set_thread_state(struct pt_regs *regs, void *stack, unsigned char *retaddr,
509 void *handler, unsigned long arg1, void *arg2, void *arg3)
510 {
511 /* Set up registers for signal handler */
512 start_thread(regs, (unsigned long) handler, (unsigned long) stack);
513
514 /* Set up a stack frame for a call4
515 * Note: PS.CALLINC is set to one by start_thread
516 */
517 regs->areg[4] = (((unsigned long) retaddr) & 0x3fffffff) | 0x40000000;
518 regs->areg[6] = arg1;
519 regs->areg[7] = (unsigned long) arg2;
520 regs->areg[8] = (unsigned long) arg3;
521 }
522
523 static void setup_frame(int sig, struct k_sigaction *ka,
524 sigset_t *set, struct pt_regs *regs)
525 {
526 struct sigframe *frame;
527 int err = 0;
528 int signal;
529
530 frame = get_sigframe(ka, regs->areg[1], sizeof(*frame));
531 if (regs->depc > 64)
532 {
533 printk("!!!!!!! DEPC !!!!!!!\n");
534 return;
535 }
536
537
538 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
539 goto give_sigsegv;
540
541 signal = current_thread_info()->exec_domain
542 && current_thread_info()->exec_domain->signal_invmap
543 && sig < 32
544 ? current_thread_info()->exec_domain->signal_invmap[sig]
545 : sig;
546
547 err |= setup_sigcontext(&frame->sc, &frame->cpstate, regs, set->sig[0]);
548
549 if (_NSIG_WORDS > 1) {
550 err |= __copy_to_user(frame->extramask, &set->sig[1],
551 sizeof(frame->extramask));
552 }
553
554 /* Create sys_sigreturn syscall in stack frame */
555 err |= gen_return_code(frame->retcode, USE_SIGRETURN);
556
557 if (err)
558 goto give_sigsegv;
559
560 /* Create signal handler execution context.
561 * Return context not modified until this point.
562 */
563 set_thread_state(regs, frame, frame->retcode,
564 ka->sa.sa_handler, signal, &frame->sc, NULL);
565
566 /* Set access mode to USER_DS. Nomenclature is outdated, but
567 * functionality is used in uaccess.h
568 */
569 set_fs(USER_DS);
570
571
572 #if DEBUG_SIG
573 printk("SIG deliver (%s:%d): signal=%d sp=%p pc=%08x\n",
574 current->comm, current->pid, signal, frame, regs->pc);
575 #endif
576
577 return;
578
579 give_sigsegv:
580 if (sig == SIGSEGV)
581 ka->sa.sa_handler = SIG_DFL;
582 force_sig(SIGSEGV, current);
583 }
584
585 static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
586 sigset_t *set, struct pt_regs *regs)
587 {
588 struct rt_sigframe *frame;
589 int err = 0;
590 int signal;
591
592 frame = get_sigframe(ka, regs->areg[1], sizeof(*frame));
593 if (regs->depc > 64)
594 panic ("Double exception sys_sigreturn\n");
595
596 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
597 goto give_sigsegv;
598
599 signal = current_thread_info()->exec_domain
600 && current_thread_info()->exec_domain->signal_invmap
601 && sig < 32
602 ? current_thread_info()->exec_domain->signal_invmap[sig]
603 : sig;
604
605 err |= copy_siginfo_to_user(&frame->info, info);
606
607 /* Create the ucontext. */
608 err |= __put_user(0, &frame->uc.uc_flags);
609 err |= __put_user(0, &frame->uc.uc_link);
610 err |= __put_user((void *)current->sas_ss_sp,
611 &frame->uc.uc_stack.ss_sp);
612 err |= __put_user(sas_ss_flags(regs->areg[1]),
613 &frame->uc.uc_stack.ss_flags);
614 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
615 err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->cpstate,
616 regs, set->sig[0]);
617 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
618
619 /* Create sys_rt_sigreturn syscall in stack frame */
620 err |= gen_return_code(frame->retcode, USE_RT_SIGRETURN);
621
622 if (err)
623 goto give_sigsegv;
624
625 /* Create signal handler execution context.
626 * Return context not modified until this point.
627 */
628 set_thread_state(regs, frame, frame->retcode,
629 ka->sa.sa_handler, signal, &frame->info, &frame->uc);
630
631 /* Set access mode to USER_DS. Nomenclature is outdated, but
632 * functionality is used in uaccess.h
633 */
634 set_fs(USER_DS);
635
636 #if DEBUG_SIG
637 printk("SIG rt deliver (%s:%d): signal=%d sp=%p pc=%08x\n",
638 current->comm, current->pid, signal, frame, regs->pc);
639 #endif
640
641 return;
642
643 give_sigsegv:
644 if (sig == SIGSEGV)
645 ka->sa.sa_handler = SIG_DFL;
646 force_sig(SIGSEGV, current);
647 }
648
649
650
651 /*
652 * Note that 'init' is a special process: it doesn't get signals it doesn't
653 * want to handle. Thus you cannot kill init even with a SIGKILL even by
654 * mistake.
655 *
656 * Note that we go through the signals twice: once to check the signals that
657 * the kernel can handle, and then we build all the user-level signal handling
658 * stack-frames in one go after that.
659 */
660 int do_signal(struct pt_regs *regs, sigset_t *oldset)
661 {
662 siginfo_t info;
663 int signr;
664 struct k_sigaction ka;
665
666 if (!oldset)
667 oldset = &current->blocked;
668
669 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
670
671 /* Are we from a system call? */
672 if (regs->syscall >= 0) {
673 /* If so, check system call restarting.. */
674 switch (regs->areg[2]) {
675 case ERESTARTNOHAND:
676 case ERESTART_RESTARTBLOCK:
677 regs->areg[2] = -EINTR;
678 break;
679
680 case ERESTARTSYS:
681 if (!(ka.sa.sa_flags & SA_RESTART)) {
682 regs->areg[2] = -EINTR;
683 break;
684 }
685 /* fallthrough */
686 case ERESTARTNOINTR:
687 regs->areg[2] = regs->syscall;
688 regs->pc -= 3;
689 }
690 }
691
692 if (signr == 0)
693 return 0; /* no signals delivered */
694
695 /* Whee! Actually deliver the signal. */
696
697 /* Set up the stack frame */
698 if (ka.sa.sa_flags & SA_SIGINFO)
699 setup_rt_frame(signr, &ka, &info, oldset, regs);
700 else
701 setup_frame(signr, &ka, oldset, regs);
702
703 if (ka.sa.sa_flags & SA_ONESHOT)
704 ka.sa.sa_handler = SIG_DFL;
705
706 spin_lock_irq(&current->sighand->siglock);
707 sigorsets(&current->blocked, &current->blocked, &ka.sa.sa_mask);
708 if (!(ka.sa.sa_flags & SA_NODEFER))
709 sigaddset(&current->blocked, signr);
710 recalc_sigpending();
711 spin_unlock_irq(&current->sighand->siglock);
712 return 1;
713 }