Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set

Only 3 out of 63 do not. Renamed the current variant to __set_current_blocked(),
added set_current_blocked() that will exclude unblockable signals, switched
open-coded instances to it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 77097ae5 edd63a27

+17 -141
-2
arch/alpha/kernel/signal.c
··· 226 226 if (__get_user(set.sig[0], &sc->sc_mask)) 227 227 goto give_sigsegv; 228 228 229 - sigdelsetmask(&set, ~_BLOCKABLE); 230 229 set_current_blocked(&set); 231 230 232 231 if (restore_sigcontext(sc, regs, sw)) ··· 260 261 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 261 262 goto give_sigsegv; 262 263 263 - sigdelsetmask(&set, ~_BLOCKABLE); 264 264 set_current_blocked(&set); 265 265 266 266 if (restore_sigcontext(&frame->uc.uc_mcontext, regs, sw))
+1 -5
arch/arm/kernel/signal.c
··· 22 22 23 23 #include "signal.h" 24 24 25 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 26 - 27 25 /* 28 26 * For ARM syscalls, we encode the syscall number into the instruction. 29 27 */ ··· 208 210 int err; 209 211 210 212 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); 211 - if (err == 0) { 212 - sigdelsetmask(&set, ~_BLOCKABLE); 213 + if (err == 0) 213 214 set_current_blocked(&set); 214 - } 215 215 216 216 __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); 217 217 __get_user_error(regs->ARM_r1, &sf->uc.uc_mcontext.arm_r1, err);
-3
arch/avr32/kernel/signal.c
··· 22 22 #include <asm/ucontext.h> 23 23 #include <asm/syscalls.h> 24 24 25 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 26 - 27 25 asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 28 26 struct pt_regs *regs) 29 27 { ··· 87 89 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 88 90 goto badframe; 89 91 90 - sigdelsetmask(&set, ~_BLOCKABLE); 91 92 set_current_blocked(&set); 92 93 93 94 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-3
arch/blackfin/kernel/signal.c
··· 19 19 #include <asm/fixed_code.h> 20 20 #include <asm/syscall.h> 21 21 22 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 23 - 24 22 /* Location of the trace bit in SYSCFG. */ 25 23 #define TRACE_BITS 0x0001 26 24 ··· 96 98 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 97 99 goto badframe; 98 100 99 - sigdelsetmask(&set, ~_BLOCKABLE); 100 101 set_current_blocked(&set); 101 102 102 103 if (rt_restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
-3
arch/c6x/kernel/signal.c
··· 20 20 #include <asm/cacheflush.h> 21 21 22 22 23 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 24 - 25 23 /* 26 24 * Do a signal return, undo the signal stack. 27 25 */ ··· 85 87 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 86 88 goto badframe; 87 89 88 - sigdelsetmask(&set, ~_BLOCKABLE); 89 90 set_current_blocked(&set); 90 91 91 92 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-4
arch/cris/arch-v10/kernel/signal.c
··· 31 31 32 32 #define DEBUG_SIG 0 33 33 34 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 35 - 36 34 /* a syscall in Linux/CRIS is a break 13 instruction which is 2 bytes */ 37 35 /* manipulate regs so that upon return, it will be re-executed */ 38 36 ··· 174 176 sizeof(frame->extramask)))) 175 177 goto badframe; 176 178 177 - sigdelsetmask(&set, ~_BLOCKABLE); 178 179 set_current_blocked(&set); 179 180 180 181 if (restore_sigcontext(regs, &frame->sc)) ··· 209 212 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 210 213 goto badframe; 211 214 212 - sigdelsetmask(&set, ~_BLOCKABLE); 213 215 set_current_blocked(&set); 214 216 215 217 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-5
arch/cris/arch-v32/kernel/signal.c
··· 24 24 25 25 extern unsigned long cris_signal_return_page; 26 26 27 - /* Flag to check if a signal is blockable. */ 28 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 29 - 30 27 /* 31 28 * A syscall in CRIS is really a "break 13" instruction, which is 2 32 29 * bytes. The registers is manipulated so upon return the instruction ··· 164 167 sizeof(frame->extramask)))) 165 168 goto badframe; 166 169 167 - sigdelsetmask(&set, ~_BLOCKABLE); 168 170 set_current_blocked(&set); 169 171 170 172 if (restore_sigcontext(regs, &frame->sc)) ··· 204 208 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 205 209 goto badframe; 206 210 207 - sigdelsetmask(&set, ~_BLOCKABLE); 208 211 set_current_blocked(&set); 209 212 210 213 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-4
arch/frv/kernel/signal.c
··· 28 28 29 29 #define DEBUG_SIG 0 30 30 31 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 32 - 33 31 struct fdpic_func_descriptor { 34 32 unsigned long text; 35 33 unsigned long GOT; ··· 147 149 __copy_from_user(&set.sig[1], &frame->extramask, sizeof(frame->extramask))) 148 150 goto badframe; 149 151 150 - sigdelsetmask(&set, ~_BLOCKABLE); 151 152 set_current_blocked(&set); 152 153 153 154 if (restore_sigcontext(&frame->sc, &gr8)) ··· 169 172 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 170 173 goto badframe; 171 174 172 - sigdelsetmask(&set, ~_BLOCKABLE); 173 175 set_current_blocked(&set); 174 176 175 177 if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8))
-4
arch/h8300/kernel/signal.c
··· 47 47 #include <asm/traps.h> 48 48 #include <asm/ucontext.h> 49 49 50 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 51 - 52 50 /* 53 51 * Atomically swap in the new signal mask, and wait for a signal. 54 52 */ ··· 184 186 sizeof(frame->extramask)))) 185 187 goto badframe; 186 188 187 - sigdelsetmask(&set, ~_BLOCKABLE); 188 189 set_current_blocked(&set); 189 190 190 191 if (restore_sigcontext(regs, &frame->sc, &er0)) ··· 208 211 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 209 212 goto badframe; 210 213 211 - sigdelsetmask(&set, ~_BLOCKABLE); 212 214 set_current_blocked(&set); 213 215 214 216 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &er0))
-3
arch/hexagon/kernel/signal.c
··· 31 31 #include <asm/signal.h> 32 32 #include <asm/vdso.h> 33 33 34 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 35 - 36 34 struct rt_sigframe { 37 35 unsigned long tramp[2]; 38 36 struct siginfo info; ··· 271 273 if (__copy_from_user(&blocked, &frame->uc.uc_sigmask, sizeof(blocked))) 272 274 goto badframe; 273 275 274 - sigdelsetmask(&blocked, ~_BLOCKABLE); 275 276 set_current_blocked(&blocked); 276 277 277 278 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-2
arch/ia64/kernel/signal.c
··· 30 30 31 31 #define DEBUG_SIG 0 32 32 #define STACK_ALIGN 16 /* minimal alignment for stack pointer */ 33 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 34 33 35 34 #if _NSIG_WORDS > 1 36 35 # define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) ··· 199 200 if (GET_SIGSET(&set, &sc->sc_mask)) 200 201 goto give_sigsegv; 201 202 202 - sigdelsetmask(&set, ~_BLOCKABLE); 203 203 set_current_blocked(&set); 204 204 205 205 if (restore_sigcontext(sc, scr))
-3
arch/m32r/kernel/signal.c
··· 28 28 29 29 #define DEBUG_SIG 0 30 30 31 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 32 - 33 31 asmlinkage int 34 32 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 35 33 unsigned long r2, unsigned long r3, unsigned long r4, ··· 109 111 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 110 112 goto badframe; 111 113 112 - sigdelsetmask(&set, ~_BLOCKABLE); 113 114 set_current_blocked(&set); 114 115 115 116 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result))
-4
arch/m68k/kernel/signal.c
··· 51 51 #include <asm/traps.h> 52 52 #include <asm/ucontext.h> 53 53 54 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 55 - 56 54 #ifdef CONFIG_MMU 57 55 58 56 /* ··· 793 795 sizeof(frame->extramask)))) 794 796 goto badframe; 795 797 796 - sigdelsetmask(&set, ~_BLOCKABLE); 797 798 set_current_blocked(&set); 798 799 799 800 if (restore_sigcontext(regs, &frame->sc, frame + 1)) ··· 817 820 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 818 821 goto badframe; 819 822 820 - sigdelsetmask(&set, ~_BLOCKABLE); 821 823 set_current_blocked(&set); 822 824 823 825 if (rt_restore_ucontext(regs, sw, &frame->uc))
-3
arch/microblaze/kernel/signal.c
··· 41 41 #include <asm/cacheflush.h> 42 42 #include <asm/syscalls.h> 43 43 44 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 45 - 46 44 asmlinkage long 47 45 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 48 46 struct pt_regs *regs) ··· 104 106 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 105 107 goto badframe; 106 108 107 - sigdelsetmask(&set, ~_BLOCKABLE); 108 109 set_current_blocked(&set); 109 110 110 111 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval))
-2
arch/mips/kernel/signal-common.h
··· 19 19 # define DEBUGP(fmt, args...) 20 20 #endif 21 21 22 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 23 - 24 22 /* 25 23 * Determine which stack to use.. 26 24 */
-2
arch/mips/kernel/signal.c
··· 339 339 if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked))) 340 340 goto badframe; 341 341 342 - sigdelsetmask(&blocked, ~_BLOCKABLE); 343 342 set_current_blocked(&blocked); 344 343 345 344 sig = restore_sigcontext(&regs, &frame->sf_sc); ··· 374 375 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 375 376 goto badframe; 376 377 377 - sigdelsetmask(&set, ~_BLOCKABLE); 378 378 set_current_blocked(&set); 379 379 380 380 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
-2
arch/mips/kernel/signal32.c
··· 465 465 if (__copy_conv_sigset_from_user(&blocked, &frame->sf_mask)) 466 466 goto badframe; 467 467 468 - sigdelsetmask(&blocked, ~_BLOCKABLE); 469 468 set_current_blocked(&blocked); 470 469 471 470 sig = restore_sigcontext32(&regs, &frame->sf_sc); ··· 502 503 if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) 503 504 goto badframe; 504 505 505 - sigdelsetmask(&set, ~_BLOCKABLE); 506 506 set_current_blocked(&set); 507 507 508 508 sig = restore_sigcontext32(&regs, &frame->rs_uc.uc_mcontext);
-1
arch/mips/kernel/signal_n32.c
··· 109 109 if (__copy_conv_sigset_from_user(&set, &frame->rs_uc.uc_sigmask)) 110 110 goto badframe; 111 111 112 - sigdelsetmask(&set, ~_BLOCKABLE); 113 112 set_current_blocked(&set); 114 113 115 114 sig = restore_sigcontext(&regs, &frame->rs_uc.uc_mcontext);
-4
arch/mn10300/kernel/signal.c
··· 31 31 32 32 #define DEBUG_SIG 0 33 33 34 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 35 - 36 34 /* 37 35 * atomically swap in the new signal mask, and wait for a signal. 38 36 */ ··· 161 163 sizeof(frame->extramask))) 162 164 goto badframe; 163 165 164 - sigdelsetmask(&set, ~_BLOCKABLE); 165 166 set_current_blocked(&set); 166 167 167 168 if (restore_sigcontext(current_frame(), &frame->sc, &d0)) ··· 188 191 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 189 192 goto badframe; 190 193 191 - sigdelsetmask(&set, ~_BLOCKABLE); 192 194 set_current_blocked(&set); 193 195 194 196 if (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0))
-3
arch/openrisc/kernel/signal.c
··· 33 33 34 34 #define DEBUG_SIG 0 35 35 36 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 37 - 38 36 asmlinkage long 39 37 _sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) 40 38 { ··· 99 101 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 100 102 goto badframe; 101 103 102 - sigdelsetmask(&set, ~_BLOCKABLE); 103 104 set_current_blocked(&set); 104 105 105 106 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-4
arch/parisc/kernel/signal.c
··· 48 48 #define DBG(LEVEL, ...) 49 49 #endif 50 50 51 - 52 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 53 - 54 51 /* gcc will complain if a pointer is cast to an integer of different 55 52 * size. If you really need to do this (and we do for an ELF32 user 56 53 * application in an ELF64 kernel) then you have to do a cast to an ··· 128 131 goto give_sigsegv; 129 132 } 130 133 131 - sigdelsetmask(&set, ~_BLOCKABLE); 132 134 set_current_blocked(&set); 133 135 134 136 /* Good thing we saved the old gr[30], eh? */
-2
arch/parisc/kernel/signal32.c
··· 47 47 #define DBG(LEVEL, ...) 48 48 #endif 49 49 50 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 51 - 52 50 inline void 53 51 sigset_32to64(sigset_t *s64, compat_sigset_t *s32) 54 52 {
-1
arch/powerpc/kernel/signal.c
··· 57 57 */ 58 58 void restore_sigmask(sigset_t *set) 59 59 { 60 - sigdelsetmask(set, ~_BLOCKABLE); 61 60 set_current_blocked(set); 62 61 } 63 62
-2
arch/powerpc/kernel/signal.h
··· 10 10 #ifndef _POWERPC_ARCH_SIGNAL_H 11 11 #define _POWERPC_ARCH_SIGNAL_H 12 12 13 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 14 - 15 13 extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags); 16 14 17 15 extern void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
-4
arch/s390/kernel/compat_signal.c
··· 32 32 #include "compat_ptrace.h" 33 33 #include "entry.h" 34 34 35 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 36 - 37 35 typedef struct 38 36 { 39 37 __u8 callee_used_stack[__SIGNAL_FRAMESIZE32]; ··· 362 364 goto badframe; 363 365 if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32)) 364 366 goto badframe; 365 - sigdelsetmask(&set, ~_BLOCKABLE); 366 367 set_current_blocked(&set); 367 368 if (restore_sigregs32(regs, &frame->sregs)) 368 369 goto badframe; ··· 387 390 goto badframe; 388 391 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 389 392 goto badframe; 390 - sigdelsetmask(&set, ~_BLOCKABLE); 391 393 set_current_blocked(&set); 392 394 if (restore_sigregs32(regs, &frame->uc.uc_mcontext)) 393 395 goto badframe;
-5
arch/s390/kernel/signal.c
··· 33 33 #include <asm/switch_to.h> 34 34 #include "entry.h" 35 35 36 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 37 - 38 - 39 36 typedef struct 40 37 { 41 38 __u8 callee_used_stack[__SIGNAL_FRAMESIZE]; ··· 166 169 goto badframe; 167 170 if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE)) 168 171 goto badframe; 169 - sigdelsetmask(&set, ~_BLOCKABLE); 170 172 set_current_blocked(&set); 171 173 if (restore_sigregs(regs, &frame->sregs)) 172 174 goto badframe; ··· 185 189 goto badframe; 186 190 if (__copy_from_user(&set.sig, &frame->uc.uc_sigmask, sizeof(set))) 187 191 goto badframe; 188 - sigdelsetmask(&set, ~_BLOCKABLE); 189 192 set_current_blocked(&set); 190 193 if (restore_sigregs(regs, &frame->uc.uc_mcontext)) 191 194 goto badframe;
-3
arch/score/kernel/signal.c
··· 34 34 #include <asm/syscalls.h> 35 35 #include <asm/ucontext.h> 36 36 37 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 38 - 39 37 struct rt_sigframe { 40 38 u32 rs_ass[4]; /* argument save space */ 41 39 u32 rs_code[2]; /* signal trampoline */ ··· 160 162 if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set))) 161 163 goto badframe; 162 164 163 - sigdelsetmask(&set, ~_BLOCKABLE); 164 165 set_current_blocked(&set); 165 166 166 167 sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext);
-4
arch/sh/kernel/signal_32.c
··· 32 32 #include <asm/syscalls.h> 33 33 #include <asm/fpu.h> 34 34 35 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 36 - 37 35 struct fdpic_func_descriptor { 38 36 unsigned long text; 39 37 unsigned long GOT; ··· 224 226 sizeof(frame->extramask)))) 225 227 goto badframe; 226 228 227 - sigdelsetmask(&set, ~_BLOCKABLE); 228 229 set_current_blocked(&set); 229 230 230 231 if (restore_sigcontext(regs, &frame->sc, &r0)) ··· 253 256 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 254 257 goto badframe; 255 258 256 - sigdelsetmask(&set, ~_BLOCKABLE); 257 259 set_current_blocked(&set); 258 260 259 261 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &r0))
-4
arch/sh/kernel/signal_64.c
··· 41 41 42 42 #define DEBUG_SIG 0 43 43 44 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 45 - 46 44 static void 47 45 handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 48 46 struct pt_regs * regs); ··· 328 330 sizeof(frame->extramask)))) 329 331 goto badframe; 330 332 331 - sigdelsetmask(&set, ~_BLOCKABLE); 332 333 set_current_blocked(&set); 333 334 334 335 if (restore_sigcontext(regs, &frame->sc, &ret)) ··· 360 363 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 361 364 goto badframe; 362 365 363 - sigdelsetmask(&set, ~_BLOCKABLE); 364 366 set_current_blocked(&set); 365 367 366 368 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ret))
-4
arch/sparc/kernel/signal32.c
··· 32 32 33 33 #include "sigutil.h" 34 34 35 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 36 - 37 35 /* This magic should be in g_upper[0] for all upper parts 38 36 * to be valid. 39 37 */ ··· 272 274 case 2: set.sig[1] = seta[2] + (((long)seta[3]) << 32); 273 275 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32); 274 276 } 275 - sigdelsetmask(&set, ~_BLOCKABLE); 276 277 set_current_blocked(&set); 277 278 return; 278 279 ··· 373 376 case 2: set.sig[1] = seta.sig[2] + (((long)seta.sig[3]) << 32); 374 377 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); 375 378 } 376 - sigdelsetmask(&set, ~_BLOCKABLE); 377 379 set_current_blocked(&set); 378 380 return; 379 381 segv:
-4
arch/sparc/kernel/signal_32.c
··· 29 29 30 30 #include "sigutil.h" 31 31 32 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 33 - 34 32 extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 35 33 void *fpqueue, unsigned long *fpqdepth); 36 34 extern void fpload(unsigned long *fpregs, unsigned long *fsr); ··· 128 130 if (err) 129 131 goto segv_and_exit; 130 132 131 - sigdelsetmask(&set, ~_BLOCKABLE); 132 133 set_current_blocked(&set); 133 134 return; 134 135 ··· 194 197 goto segv; 195 198 } 196 199 197 - sigdelsetmask(&set, ~_BLOCKABLE); 198 200 set_current_blocked(&set); 199 201 return; 200 202 segv:
-4
arch/sparc/kernel/signal_64.c
··· 38 38 #include "systbls.h" 39 39 #include "sigutil.h" 40 40 41 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 42 - 43 41 /* {set, get}context() needed for 64-bit SparcLinux userland. */ 44 42 asmlinkage void sparc64_set_context(struct pt_regs *regs) 45 43 { ··· 69 71 if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(sigset_t))) 70 72 goto do_sigsegv; 71 73 } 72 - sigdelsetmask(&set, ~_BLOCKABLE); 73 74 set_current_blocked(&set); 74 75 } 75 76 if (test_thread_flag(TIF_32BIT)) { ··· 312 315 /* Prevent syscall restart. */ 313 316 pt_regs_clear_syscall(regs); 314 317 315 - sigdelsetmask(&set, ~_BLOCKABLE); 316 318 set_current_blocked(&set); 317 319 return; 318 320 segv:
-3
arch/tile/kernel/compat_signal.c
··· 118 118 struct compat_ucontext uc; 119 119 }; 120 120 121 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 122 - 123 121 long compat_sys_rt_sigaction(int sig, struct compat_sigaction __user *act, 124 122 struct compat_sigaction __user *oact, 125 123 size_t sigsetsize) ··· 300 302 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 301 303 goto badframe; 302 304 303 - sigdelsetmask(&set, ~_BLOCKABLE); 304 305 set_current_blocked(&set); 305 306 306 307 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-3
arch/tile/kernel/signal.c
··· 37 37 38 38 #define DEBUG_SIG 0 39 39 40 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 41 - 42 40 SYSCALL_DEFINE3(sigaltstack, const stack_t __user *, uss, 43 41 stack_t __user *, uoss, struct pt_regs *, regs) 44 42 { ··· 94 96 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 95 97 goto badframe; 96 98 97 - sigdelsetmask(&set, ~_BLOCKABLE); 98 99 set_current_blocked(&set); 99 100 100 101 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-3
arch/um/include/shared/frame_kern.h
··· 6 6 #ifndef __FRAME_KERN_H_ 7 7 #define __FRAME_KERN_H_ 8 8 9 - #define _S(nr) (1<<((nr)-1)) 10 - #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) 11 - 12 9 extern int setup_signal_stack_sc(unsigned long stack_top, int sig, 13 10 struct k_sigaction *ka, 14 11 struct pt_regs *regs,
-4
arch/um/kernel/signal.c
··· 15 15 EXPORT_SYMBOL(block_signals); 16 16 EXPORT_SYMBOL(unblock_signals); 17 17 18 - #define _S(nr) (1<<((nr)-1)) 19 - 20 - #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP))) 21 - 22 18 /* 23 19 * OK, we're invoking a handler 24 20 */
+1 -5
arch/unicore32/kernel/signal.c
··· 21 21 #include <asm/cacheflush.h> 22 22 #include <asm/ucontext.h> 23 23 24 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 25 - 26 24 /* 27 25 * For UniCore syscalls, we encode the syscall number into the instruction. 28 26 */ ··· 59 61 int err; 60 62 61 63 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); 62 - if (err == 0) { 63 - sigdelsetmask(&set, ~_BLOCKABLE); 64 + if (err == 0) 64 65 set_current_blocked(&set); 65 - } 66 66 67 67 err |= __get_user(regs->UCreg_00, &sf->uc.uc_mcontext.regs.UCreg_00); 68 68 err |= __get_user(regs->UCreg_01, &sf->uc.uc_mcontext.regs.UCreg_01);
-2
arch/x86/ia32/ia32_signal.c
··· 273 273 sizeof(frame->extramask)))) 274 274 goto badframe; 275 275 276 - sigdelsetmask(&set, ~_BLOCKABLE); 277 276 set_current_blocked(&set); 278 277 279 278 if (ia32_restore_sigcontext(regs, &frame->sc, &ax)) ··· 298 299 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 299 300 goto badframe; 300 301 301 - sigdelsetmask(&set, ~_BLOCKABLE); 302 302 set_current_blocked(&set); 303 303 304 304 if (ia32_restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
-2
arch/x86/include/asm/sighandling.h
··· 7 7 8 8 #include <asm/processor-flags.h> 9 9 10 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 11 - 12 10 #define __FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \ 13 11 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \ 14 12 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
-3
arch/x86/kernel/signal.c
··· 555 555 sizeof(frame->extramask)))) 556 556 goto badframe; 557 557 558 - sigdelsetmask(&set, ~_BLOCKABLE); 559 558 set_current_blocked(&set); 560 559 561 560 if (restore_sigcontext(regs, &frame->sc, &ax)) ··· 580 581 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 581 582 goto badframe; 582 583 583 - sigdelsetmask(&set, ~_BLOCKABLE); 584 584 set_current_blocked(&set); 585 585 586 586 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) ··· 913 915 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 914 916 goto badframe; 915 917 916 - sigdelsetmask(&set, ~_BLOCKABLE); 917 918 set_current_blocked(&set); 918 919 919 920 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
-2
arch/x86/um/signal.c
··· 486 486 copy_from_user(&set.sig[1], extramask, sig_size)) 487 487 goto segfault; 488 488 489 - sigdelsetmask(&set, ~_BLOCKABLE); 490 489 set_current_blocked(&set); 491 490 492 491 if (copy_sc_from_user(&current->thread.regs, sc)) ··· 599 600 if (copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) 600 601 goto segfault; 601 602 602 - sigdelsetmask(&set, ~_BLOCKABLE); 603 603 set_current_blocked(&set); 604 604 605 605 if (copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext))
-3
arch/xtensa/kernel/signal.c
··· 30 30 31 31 #define DEBUG_SIG 0 32 32 33 - #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 34 - 35 33 extern struct task_struct *coproc_owners[]; 36 34 37 35 struct rt_sigframe ··· 259 261 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 260 262 goto badframe; 261 263 262 - sigdelsetmask(&set, ~_BLOCKABLE); 263 264 set_current_blocked(&set); 264 265 265 266 if (restore_sigcontext(regs, frame))
+1 -1
include/linux/sched.h
··· 2210 2210 static inline void restore_saved_sigmask(void) 2211 2211 { 2212 2212 if (test_and_clear_restore_sigmask()) 2213 - set_current_blocked(&current->saved_sigmask); 2213 + __set_current_blocked(&current->saved_sigmask); 2214 2214 } 2215 2215 2216 2216 static inline sigset_t *sigmask_to_save(void)
+2 -1
include/linux/signal.h
··· 250 250 extern int do_sigtimedwait(const sigset_t *, siginfo_t *, 251 251 const struct timespec *); 252 252 extern int sigprocmask(int, sigset_t *, sigset_t *); 253 - extern void set_current_blocked(const sigset_t *); 253 + extern void set_current_blocked(sigset_t *); 254 + extern void __set_current_blocked(const sigset_t *); 254 255 extern int show_unhandled_signals; 255 256 extern int sigsuspend(sigset_t *); 256 257
+12 -6
kernel/signal.c
··· 2524 2524 * It is wrong to change ->blocked directly, this helper should be used 2525 2525 * to ensure the process can't miss a shared signal we are going to block. 2526 2526 */ 2527 - void set_current_blocked(const sigset_t *newset) 2527 + void set_current_blocked(sigset_t *newset) 2528 + { 2529 + struct task_struct *tsk = current; 2530 + sigdelsetmask(newset, sigmask(SIGKILL) | sigmask(SIGSTOP)); 2531 + spin_lock_irq(&tsk->sighand->siglock); 2532 + __set_task_blocked(tsk, newset); 2533 + spin_unlock_irq(&tsk->sighand->siglock); 2534 + } 2535 + 2536 + void __set_current_blocked(const sigset_t *newset) 2528 2537 { 2529 2538 struct task_struct *tsk = current; 2530 2539 ··· 2573 2564 return -EINVAL; 2574 2565 } 2575 2566 2576 - set_current_blocked(&newset); 2567 + __set_current_blocked(&newset); 2577 2568 return 0; 2578 2569 } 2579 2570 ··· 3147 3138 return -EINVAL; 3148 3139 } 3149 3140 3150 - set_current_blocked(&new_blocked); 3141 + __set_current_blocked(&new_blocked); 3151 3142 } 3152 3143 3153 3144 if (oset) { ··· 3211 3202 int old = current->blocked.sig[0]; 3212 3203 sigset_t newset; 3213 3204 3214 - siginitset(&newset, newmask & ~(sigmask(SIGKILL) | sigmask(SIGSTOP))); 3215 3205 set_current_blocked(&newset); 3216 3206 3217 3207 return old; ··· 3251 3243 3252 3244 int sigsuspend(sigset_t *set) 3253 3245 { 3254 - sigdelsetmask(set, sigmask(SIGKILL)|sigmask(SIGSTOP)); 3255 - 3256 3246 current->saved_sigmask = current->blocked; 3257 3247 set_current_blocked(set); 3258 3248