diff options
-rw-r--r-- | arch/alpha/kernel/signal.c | 11 | ||||
-rw-r--r-- | arch/arm/kernel/signal.c | 11 | ||||
-rw-r--r-- | arch/cris/arch-v10/kernel/signal.c | 16 | ||||
-rw-r--r-- | arch/cris/arch-v32/kernel/signal.c | 16 | ||||
-rw-r--r-- | arch/frv/kernel/signal.c | 14 | ||||
-rw-r--r-- | arch/m68k/kernel/signal.c | 15 | ||||
-rw-r--r-- | arch/mips/kernel/signal.c | 20 | ||||
-rw-r--r-- | arch/mips/kernel/signal32.c | 20 | ||||
-rw-r--r-- | arch/mips/kernel/signal_n32.c | 10 | ||||
-rw-r--r-- | arch/mn10300/kernel/signal.c | 14 | ||||
-rw-r--r-- | arch/powerpc/kernel/signal_32.c | 11 | ||||
-rw-r--r-- | arch/s390/kernel/signal.c | 9 | ||||
-rw-r--r-- | arch/sh/kernel/signal_32.c | 12 | ||||
-rw-r--r-- | arch/sparc/kernel/signal_32.c | 12 | ||||
-rw-r--r-- | arch/sparc/kernel/signal_64.c | 13 | ||||
-rw-r--r-- | arch/um/kernel/signal.c | 9 | ||||
-rw-r--r-- | arch/x86/ia32/ia32_signal.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/signal.c | 12 | ||||
-rw-r--r-- | include/linux/signal.h | 1 | ||||
-rw-r--r-- | kernel/compat.c | 10 | ||||
-rw-r--r-- | kernel/signal.c | 25 |
21 files changed, 50 insertions, 223 deletions
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index 35f2ef44de12..74b05e6ed441 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c | |||
@@ -121,17 +121,8 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act, | |||
121 | SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) | 121 | SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) |
122 | { | 122 | { |
123 | sigset_t blocked; | 123 | sigset_t blocked; |
124 | |||
125 | current->saved_sigmask = current->blocked; | ||
126 | |||
127 | mask &= _BLOCKABLE; | ||
128 | siginitset(&blocked, mask); | 124 | siginitset(&blocked, mask); |
129 | set_current_blocked(&blocked); | 125 | return sigsuspend(&blocked); |
130 | |||
131 | current->state = TASK_INTERRUPTIBLE; | ||
132 | schedule(); | ||
133 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
134 | return -ERESTARTNOHAND; | ||
135 | } | 126 | } |
136 | 127 | ||
137 | asmlinkage int | 128 | asmlinkage int |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 73d9a420850d..4e5fdd9bd9e3 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -67,17 +67,8 @@ const unsigned long syscall_restart_code[2] = { | |||
67 | asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) | 67 | asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) |
68 | { | 68 | { |
69 | sigset_t blocked; | 69 | sigset_t blocked; |
70 | |||
71 | current->saved_sigmask = current->blocked; | ||
72 | |||
73 | mask &= _BLOCKABLE; | ||
74 | siginitset(&blocked, mask); | 70 | siginitset(&blocked, mask); |
75 | set_current_blocked(&blocked); | 71 | return sigsuspend(&blocked); |
76 | |||
77 | current->state = TASK_INTERRUPTIBLE; | ||
78 | schedule(); | ||
79 | set_restore_sigmask(); | ||
80 | return -ERESTARTNOHAND; | ||
81 | } | 72 | } |
82 | 73 | ||
83 | asmlinkage int | 74 | asmlinkage int |
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c index 289c584ba499..170f4970d590 100644 --- a/arch/cris/arch-v10/kernel/signal.c +++ b/arch/cris/arch-v10/kernel/signal.c | |||
@@ -48,19 +48,11 @@ void do_signal(int canrestart, struct pt_regs *regs); | |||
48 | * dummy arguments to be able to reach the regs argument. (Note that this | 48 | * dummy arguments to be able to reach the regs argument. (Note that this |
49 | * arrangement relies on old_sigset_t occupying one register.) | 49 | * arrangement relies on old_sigset_t occupying one register.) |
50 | */ | 50 | */ |
51 | int sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof, | 51 | int sys_sigsuspend(old_sigset_t mask) |
52 | long srp, struct pt_regs *regs) | ||
53 | { | 52 | { |
54 | mask &= _BLOCKABLE; | 53 | sigset_t blocked; |
55 | spin_lock_irq(¤t->sighand->siglock); | 54 | siginitset(&blocked, mask); |
56 | current->saved_sigmask = current->blocked; | 55 | return sigsuspend(&blocked); |
57 | siginitset(¤t->blocked, mask); | ||
58 | recalc_sigpending(); | ||
59 | spin_unlock_irq(¤t->sighand->siglock); | ||
60 | current->state = TASK_INTERRUPTIBLE; | ||
61 | schedule(); | ||
62 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
63 | return -ERESTARTNOHAND; | ||
64 | } | 56 | } |
65 | 57 | ||
66 | int sys_sigaction(int sig, const struct old_sigaction __user *act, | 58 | int sys_sigaction(int sig, const struct old_sigaction __user *act, |
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c index ce4ab1a5552c..e09083208cb6 100644 --- a/arch/cris/arch-v32/kernel/signal.c +++ b/arch/cris/arch-v32/kernel/signal.c | |||
@@ -59,19 +59,11 @@ void keep_debug_flags(unsigned long oldccs, unsigned long oldspc, | |||
59 | * dummy arguments to be able to reach the regs argument. | 59 | * dummy arguments to be able to reach the regs argument. |
60 | */ | 60 | */ |
61 | int | 61 | int |
62 | sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof, | 62 | sys_sigsuspend(old_sigset_t mask) |
63 | long srp, struct pt_regs *regs) | ||
64 | { | 63 | { |
65 | mask &= _BLOCKABLE; | 64 | sigset_t blocked; |
66 | spin_lock_irq(¤t->sighand->siglock); | 65 | siginitset(&blocked, mask); |
67 | current->saved_sigmask = current->blocked; | 66 | return sigsuspend(&blocked); |
68 | siginitset(¤t->blocked, mask); | ||
69 | recalc_sigpending(); | ||
70 | spin_unlock_irq(¤t->sighand->siglock); | ||
71 | current->state = TASK_INTERRUPTIBLE; | ||
72 | schedule(); | ||
73 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
74 | return -ERESTARTNOHAND; | ||
75 | } | 67 | } |
76 | 68 | ||
77 | int | 69 | int |
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index bab01298b58e..df957c7ba387 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c | |||
@@ -40,17 +40,9 @@ struct fdpic_func_descriptor { | |||
40 | */ | 40 | */ |
41 | asmlinkage int sys_sigsuspend(int history0, int history1, old_sigset_t mask) | 41 | asmlinkage int sys_sigsuspend(int history0, int history1, old_sigset_t mask) |
42 | { | 42 | { |
43 | mask &= _BLOCKABLE; | 43 | sigset_t blocked; |
44 | spin_lock_irq(¤t->sighand->siglock); | 44 | siginitset(&blocked, mask); |
45 | current->saved_sigmask = current->blocked; | 45 | return sigsuspend(&blocked); |
46 | siginitset(¤t->blocked, mask); | ||
47 | recalc_sigpending(); | ||
48 | spin_unlock_irq(¤t->sighand->siglock); | ||
49 | |||
50 | current->state = TASK_INTERRUPTIBLE; | ||
51 | schedule(); | ||
52 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
53 | return -ERESTARTNOHAND; | ||
54 | } | 46 | } |
55 | 47 | ||
56 | asmlinkage int sys_sigaction(int sig, | 48 | asmlinkage int sys_sigaction(int sig, |
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c index 1747c7030a33..8186982fb320 100644 --- a/arch/m68k/kernel/signal.c +++ b/arch/m68k/kernel/signal.c | |||
@@ -230,18 +230,9 @@ static inline void push_cache(unsigned long vaddr) | |||
230 | asmlinkage int | 230 | asmlinkage int |
231 | sys_sigsuspend(int unused0, int unused1, old_sigset_t mask) | 231 | sys_sigsuspend(int unused0, int unused1, old_sigset_t mask) |
232 | { | 232 | { |
233 | mask &= _BLOCKABLE; | 233 | sigset_t blocked; |
234 | spin_lock_irq(¤t->sighand->siglock); | 234 | siginitset(&blocked, mask); |
235 | current->saved_sigmask = current->blocked; | 235 | return sigsuspend(&blocked); |
236 | siginitset(¤t->blocked, mask); | ||
237 | recalc_sigpending(); | ||
238 | spin_unlock_irq(¤t->sighand->siglock); | ||
239 | |||
240 | current->state = TASK_INTERRUPTIBLE; | ||
241 | schedule(); | ||
242 | set_restore_sigmask(); | ||
243 | |||
244 | return -ERESTARTNOHAND; | ||
245 | } | 236 | } |
246 | 237 | ||
247 | asmlinkage int | 238 | asmlinkage int |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index d5a338a1739c..17f6ee30ad0d 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -255,15 +255,7 @@ asmlinkage int sys_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
255 | uset = (sigset_t __user *) regs.regs[4]; | 255 | uset = (sigset_t __user *) regs.regs[4]; |
256 | if (copy_from_user(&newset, uset, sizeof(sigset_t))) | 256 | if (copy_from_user(&newset, uset, sizeof(sigset_t))) |
257 | return -EFAULT; | 257 | return -EFAULT; |
258 | sigdelsetmask(&newset, ~_BLOCKABLE); | 258 | return sigsuspend(&newset); |
259 | |||
260 | current->saved_sigmask = current->blocked; | ||
261 | set_current_blocked(&newset); | ||
262 | |||
263 | current->state = TASK_INTERRUPTIBLE; | ||
264 | schedule(); | ||
265 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
266 | return -ERESTARTNOHAND; | ||
267 | } | 259 | } |
268 | #endif | 260 | #endif |
269 | 261 | ||
@@ -281,15 +273,7 @@ asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
281 | unewset = (sigset_t __user *) regs.regs[4]; | 273 | unewset = (sigset_t __user *) regs.regs[4]; |
282 | if (copy_from_user(&newset, unewset, sizeof(newset))) | 274 | if (copy_from_user(&newset, unewset, sizeof(newset))) |
283 | return -EFAULT; | 275 | return -EFAULT; |
284 | sigdelsetmask(&newset, ~_BLOCKABLE); | 276 | return sigsuspend(&newset); |
285 | |||
286 | current->saved_sigmask = current->blocked; | ||
287 | set_current_blocked(&newset); | ||
288 | |||
289 | current->state = TASK_INTERRUPTIBLE; | ||
290 | schedule(); | ||
291 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
292 | return -ERESTARTNOHAND; | ||
293 | } | 277 | } |
294 | 278 | ||
295 | #ifdef CONFIG_TRAD_SIGNALS | 279 | #ifdef CONFIG_TRAD_SIGNALS |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index ac3b8d89aae5..b4fe2eacbd5d 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -288,15 +288,7 @@ asmlinkage int sys32_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
288 | uset = (compat_sigset_t __user *) regs.regs[4]; | 288 | uset = (compat_sigset_t __user *) regs.regs[4]; |
289 | if (get_sigset(&newset, uset)) | 289 | if (get_sigset(&newset, uset)) |
290 | return -EFAULT; | 290 | return -EFAULT; |
291 | sigdelsetmask(&newset, ~_BLOCKABLE); | 291 | return sigsuspend(&newset); |
292 | |||
293 | current->saved_sigmask = current->blocked; | ||
294 | set_current_blocked(&newset); | ||
295 | |||
296 | current->state = TASK_INTERRUPTIBLE; | ||
297 | schedule(); | ||
298 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
299 | return -ERESTARTNOHAND; | ||
300 | } | 292 | } |
301 | 293 | ||
302 | asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | 294 | asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) |
@@ -313,15 +305,7 @@ asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
313 | uset = (compat_sigset_t __user *) regs.regs[4]; | 305 | uset = (compat_sigset_t __user *) regs.regs[4]; |
314 | if (get_sigset(&newset, uset)) | 306 | if (get_sigset(&newset, uset)) |
315 | return -EFAULT; | 307 | return -EFAULT; |
316 | sigdelsetmask(&newset, ~_BLOCKABLE); | 308 | return sigsuspend(&newset); |
317 | |||
318 | current->saved_sigmask = current->blocked; | ||
319 | set_current_blocked(&newset); | ||
320 | |||
321 | current->state = TASK_INTERRUPTIBLE; | ||
322 | schedule(); | ||
323 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
324 | return -ERESTARTNOHAND; | ||
325 | } | 309 | } |
326 | 310 | ||
327 | SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act, | 311 | SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act, |
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c index 86eb4b04631c..63ffac9af7c5 100644 --- a/arch/mips/kernel/signal_n32.c +++ b/arch/mips/kernel/signal_n32.c | |||
@@ -91,15 +91,7 @@ asmlinkage int sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs) | |||
91 | if (copy_from_user(&uset, unewset, sizeof(uset))) | 91 | if (copy_from_user(&uset, unewset, sizeof(uset))) |
92 | return -EFAULT; | 92 | return -EFAULT; |
93 | sigset_from_compat(&newset, &uset); | 93 | sigset_from_compat(&newset, &uset); |
94 | sigdelsetmask(&newset, ~_BLOCKABLE); | 94 | return sigsuspend(&newset); |
95 | |||
96 | current->saved_sigmask = current->blocked; | ||
97 | set_current_blocked(&newset); | ||
98 | |||
99 | current->state = TASK_INTERRUPTIBLE; | ||
100 | schedule(); | ||
101 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
102 | return -ERESTARTNOHAND; | ||
103 | } | 95 | } |
104 | 96 | ||
105 | asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) | 97 | asmlinkage void sysn32_rt_sigreturn(nabi_no_regargs struct pt_regs regs) |
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index 690f4e9507d7..50eb94a05826 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -38,17 +38,9 @@ | |||
38 | */ | 38 | */ |
39 | asmlinkage long sys_sigsuspend(int history0, int history1, old_sigset_t mask) | 39 | asmlinkage long sys_sigsuspend(int history0, int history1, old_sigset_t mask) |
40 | { | 40 | { |
41 | mask &= _BLOCKABLE; | 41 | sigset_t blocked; |
42 | spin_lock_irq(¤t->sighand->siglock); | 42 | siginitset(&blocked, mask); |
43 | current->saved_sigmask = current->blocked; | 43 | return sigsuspend(&blocked); |
44 | siginitset(¤t->blocked, mask); | ||
45 | recalc_sigpending(); | ||
46 | spin_unlock_irq(¤t->sighand->siglock); | ||
47 | |||
48 | current->state = TASK_INTERRUPTIBLE; | ||
49 | schedule(); | ||
50 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
51 | return -ERESTARTNOHAND; | ||
52 | } | 44 | } |
53 | 45 | ||
54 | /* | 46 | /* |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 45eb998557f8..ac1f96027bf5 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -244,17 +244,8 @@ static inline int restore_general_regs(struct pt_regs *regs, | |||
244 | long sys_sigsuspend(old_sigset_t mask) | 244 | long sys_sigsuspend(old_sigset_t mask) |
245 | { | 245 | { |
246 | sigset_t blocked; | 246 | sigset_t blocked; |
247 | |||
248 | current->saved_sigmask = current->blocked; | ||
249 | |||
250 | mask &= _BLOCKABLE; | ||
251 | siginitset(&blocked, mask); | 247 | siginitset(&blocked, mask); |
252 | set_current_blocked(&blocked); | 248 | return sigsuspend(&blocked); |
253 | |||
254 | current->state = TASK_INTERRUPTIBLE; | ||
255 | schedule(); | ||
256 | set_restore_sigmask(); | ||
257 | return -ERESTARTNOHAND; | ||
258 | } | 249 | } |
259 | 250 | ||
260 | long sys_sigaction(int sig, struct old_sigaction __user *act, | 251 | long sys_sigaction(int sig, struct old_sigaction __user *act, |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 8a4e2b760d56..f626232e216c 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -59,15 +59,8 @@ typedef struct | |||
59 | SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) | 59 | SYSCALL_DEFINE3(sigsuspend, int, history0, int, history1, old_sigset_t, mask) |
60 | { | 60 | { |
61 | sigset_t blocked; | 61 | sigset_t blocked; |
62 | |||
63 | current->saved_sigmask = current->blocked; | ||
64 | mask &= _BLOCKABLE; | ||
65 | siginitset(&blocked, mask); | 62 | siginitset(&blocked, mask); |
66 | set_current_blocked(&blocked); | 63 | return sigsuspend(&blocked); |
67 | set_current_state(TASK_INTERRUPTIBLE); | ||
68 | schedule(); | ||
69 | set_restore_sigmask(); | ||
70 | return -ERESTARTNOHAND; | ||
71 | } | 64 | } |
72 | 65 | ||
73 | SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act, | 66 | SYSCALL_DEFINE3(sigaction, int, sig, const struct old_sigaction __user *, act, |
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c index 5901fba3176e..46c9f9b00b14 100644 --- a/arch/sh/kernel/signal_32.c +++ b/arch/sh/kernel/signal_32.c | |||
@@ -58,18 +58,8 @@ sys_sigsuspend(old_sigset_t mask, | |||
58 | struct pt_regs __regs) | 58 | struct pt_regs __regs) |
59 | { | 59 | { |
60 | sigset_t blocked; | 60 | sigset_t blocked; |
61 | |||
62 | current->saved_sigmask = current->blocked; | ||
63 | |||
64 | mask &= _BLOCKABLE; | ||
65 | siginitset(&blocked, mask); | 61 | siginitset(&blocked, mask); |
66 | set_current_blocked(&blocked); | 62 | return sigsuspend(&blocked); |
67 | |||
68 | current->state = TASK_INTERRUPTIBLE; | ||
69 | schedule(); | ||
70 | set_restore_sigmask(); | ||
71 | |||
72 | return -ERESTARTNOHAND; | ||
73 | } | 63 | } |
74 | 64 | ||
75 | asmlinkage int | 65 | asmlinkage int |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index ac8e66b50f07..2b7e849f7c65 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -64,18 +64,8 @@ struct rt_signal_frame { | |||
64 | static int _sigpause_common(old_sigset_t set) | 64 | static int _sigpause_common(old_sigset_t set) |
65 | { | 65 | { |
66 | sigset_t blocked; | 66 | sigset_t blocked; |
67 | |||
68 | current->saved_sigmask = current->blocked; | ||
69 | |||
70 | set &= _BLOCKABLE; | ||
71 | siginitset(&blocked, set); | 67 | siginitset(&blocked, set); |
72 | set_current_blocked(&blocked); | 68 | return sigsuspend(&blocked); |
73 | |||
74 | current->state = TASK_INTERRUPTIBLE; | ||
75 | schedule(); | ||
76 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
77 | |||
78 | return -ERESTARTNOHAND; | ||
79 | } | 69 | } |
80 | 70 | ||
81 | asmlinkage int sys_sigsuspend(old_sigset_t set) | 71 | asmlinkage int sys_sigsuspend(old_sigset_t set) |
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index 48b0f57b65f7..eafaab486b2d 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -242,19 +242,8 @@ struct rt_signal_frame { | |||
242 | static long _sigpause_common(old_sigset_t set) | 242 | static long _sigpause_common(old_sigset_t set) |
243 | { | 243 | { |
244 | sigset_t blocked; | 244 | sigset_t blocked; |
245 | |||
246 | current->saved_sigmask = current->blocked; | ||
247 | |||
248 | set &= _BLOCKABLE; | ||
249 | siginitset(&blocked, set); | 245 | siginitset(&blocked, set); |
250 | set_current_blocked(&blocked); | 246 | return sigsuspend(&blocked); |
251 | |||
252 | current->state = TASK_INTERRUPTIBLE; | ||
253 | schedule(); | ||
254 | |||
255 | set_restore_sigmask(); | ||
256 | |||
257 | return -ERESTARTNOHAND; | ||
258 | } | 247 | } |
259 | 248 | ||
260 | asmlinkage long sys_sigpause(unsigned int set) | 249 | asmlinkage long sys_sigpause(unsigned int set) |
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c index fb12f4c5e649..b9b75b3bd5c9 100644 --- a/arch/um/kernel/signal.c +++ b/arch/um/kernel/signal.c | |||
@@ -152,15 +152,8 @@ int do_signal(void) | |||
152 | long sys_sigsuspend(int history0, int history1, old_sigset_t mask) | 152 | long sys_sigsuspend(int history0, int history1, old_sigset_t mask) |
153 | { | 153 | { |
154 | sigset_t blocked; | 154 | sigset_t blocked; |
155 | |||
156 | mask &= _BLOCKABLE; | ||
157 | siginitset(&blocked, mask); | 155 | siginitset(&blocked, mask); |
158 | set_current_blocked(&blocked); | 156 | return sigsuspend(&blocked); |
159 | |||
160 | current->state = TASK_INTERRUPTIBLE; | ||
161 | schedule(); | ||
162 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
163 | return -ERESTARTNOHAND; | ||
164 | } | 157 | } |
165 | 158 | ||
166 | long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) | 159 | long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) |
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index a69245ba27e3..fa54410c6666 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -127,18 +127,8 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | |||
127 | asmlinkage long sys32_sigsuspend(int history0, int history1, old_sigset_t mask) | 127 | asmlinkage long sys32_sigsuspend(int history0, int history1, old_sigset_t mask) |
128 | { | 128 | { |
129 | sigset_t blocked; | 129 | sigset_t blocked; |
130 | |||
131 | current->saved_sigmask = current->blocked; | ||
132 | |||
133 | mask &= _BLOCKABLE; | ||
134 | siginitset(&blocked, mask); | 130 | siginitset(&blocked, mask); |
135 | set_current_blocked(&blocked); | 131 | return sigsuspend(&blocked); |
136 | |||
137 | current->state = TASK_INTERRUPTIBLE; | ||
138 | schedule(); | ||
139 | |||
140 | set_restore_sigmask(); | ||
141 | return -ERESTARTNOHAND; | ||
142 | } | 132 | } |
143 | 133 | ||
144 | asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, | 134 | asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr, |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 115eac431483..b68ccadd2ff4 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -478,18 +478,8 @@ asmlinkage int | |||
478 | sys_sigsuspend(int history0, int history1, old_sigset_t mask) | 478 | sys_sigsuspend(int history0, int history1, old_sigset_t mask) |
479 | { | 479 | { |
480 | sigset_t blocked; | 480 | sigset_t blocked; |
481 | |||
482 | current->saved_sigmask = current->blocked; | ||
483 | |||
484 | mask &= _BLOCKABLE; | ||
485 | siginitset(&blocked, mask); | 481 | siginitset(&blocked, mask); |
486 | set_current_blocked(&blocked); | 482 | return sigsuspend(&blocked); |
487 | |||
488 | current->state = TASK_INTERRUPTIBLE; | ||
489 | schedule(); | ||
490 | |||
491 | set_restore_sigmask(); | ||
492 | return -ERESTARTNOHAND; | ||
493 | } | 483 | } |
494 | 484 | ||
495 | asmlinkage int | 485 | asmlinkage int |
diff --git a/include/linux/signal.h b/include/linux/signal.h index 7987ce74874b..17046cc484bc 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -252,6 +252,7 @@ extern int do_sigtimedwait(const sigset_t *, siginfo_t *, | |||
252 | extern int sigprocmask(int, sigset_t *, sigset_t *); | 252 | extern int sigprocmask(int, sigset_t *, sigset_t *); |
253 | extern void set_current_blocked(const sigset_t *); | 253 | extern void set_current_blocked(const sigset_t *); |
254 | extern int show_unhandled_signals; | 254 | extern int show_unhandled_signals; |
255 | extern int sigsuspend(sigset_t *); | ||
255 | 256 | ||
256 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); | 257 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); |
257 | extern void block_sigmask(struct k_sigaction *ka, int signr); | 258 | extern void block_sigmask(struct k_sigaction *ka, int signr); |
diff --git a/kernel/compat.c b/kernel/compat.c index d2c67aa49ae6..c28a306ae05c 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -1073,15 +1073,7 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat | |||
1073 | if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t))) | 1073 | if (copy_from_user(&newset32, unewset, sizeof(compat_sigset_t))) |
1074 | return -EFAULT; | 1074 | return -EFAULT; |
1075 | sigset_from_compat(&newset, &newset32); | 1075 | sigset_from_compat(&newset, &newset32); |
1076 | sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP)); | 1076 | return sigsuspend(&newset); |
1077 | |||
1078 | current->saved_sigmask = current->blocked; | ||
1079 | set_current_blocked(&newset); | ||
1080 | |||
1081 | current->state = TASK_INTERRUPTIBLE; | ||
1082 | schedule(); | ||
1083 | set_restore_sigmask(); | ||
1084 | return -ERESTARTNOHAND; | ||
1085 | } | 1077 | } |
1086 | #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ | 1078 | #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ |
1087 | 1079 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 17afcaf582d0..3ad220a81619 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -3236,6 +3236,21 @@ SYSCALL_DEFINE0(pause) | |||
3236 | 3236 | ||
3237 | #endif | 3237 | #endif |
3238 | 3238 | ||
3239 | #ifdef HAVE_SET_RESTORE_SIGMASK | ||
3240 | int sigsuspend(sigset_t *set) | ||
3241 | { | ||
3242 | sigdelsetmask(set, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
3243 | |||
3244 | current->saved_sigmask = current->blocked; | ||
3245 | set_current_blocked(set); | ||
3246 | |||
3247 | current->state = TASK_INTERRUPTIBLE; | ||
3248 | schedule(); | ||
3249 | set_restore_sigmask(); | ||
3250 | return -ERESTARTNOHAND; | ||
3251 | } | ||
3252 | #endif | ||
3253 | |||
3239 | #ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND | 3254 | #ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND |
3240 | /** | 3255 | /** |
3241 | * sys_rt_sigsuspend - replace the signal mask for a value with the | 3256 | * sys_rt_sigsuspend - replace the signal mask for a value with the |
@@ -3253,15 +3268,7 @@ SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize) | |||
3253 | 3268 | ||
3254 | if (copy_from_user(&newset, unewset, sizeof(newset))) | 3269 | if (copy_from_user(&newset, unewset, sizeof(newset))) |
3255 | return -EFAULT; | 3270 | return -EFAULT; |
3256 | sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP)); | 3271 | return sigsuspend(&newset); |
3257 | |||
3258 | current->saved_sigmask = current->blocked; | ||
3259 | set_current_blocked(&newset); | ||
3260 | |||
3261 | current->state = TASK_INTERRUPTIBLE; | ||
3262 | schedule(); | ||
3263 | set_restore_sigmask(); | ||
3264 | return -ERESTARTNOHAND; | ||
3265 | } | 3272 | } |
3266 | #endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */ | 3273 | #endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */ |
3267 | 3274 | ||