aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 21:11:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 21:11:45 -0400
commitf9369910a6225b8d4892c3f20ae740a711cd5ace (patch)
tree8650ff79d7607bceb35509c028400ecf1c317de0 /arch/m68k
parent05f144a0d5c2207a0349348127f996e104ad7404 (diff)
parent415d04d08fec74b226c92c1fb54ad117c9c6bac4 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull first series of signal handling cleanups from Al Viro: "This is just the first part of the queue (about a half of it); assorted fixes all over the place in signal handling. This one ends with all sigsuspend() implementations switched to generic one (->saved_sigmask-based). With this, a bunch of assorted old buglets are fixed and most of the missing bits of NOTIFY_RESUME hookup are in place. Two more fixes sit in arm and um trees respectively, and there's a couple of broken ones that need obvious fixes - parisc and avr32 check TIF_NOTIFY_RESUME only on one of two codepaths; fixes for that will happen in the next series" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (55 commits) unicore32: if there's no handler we need to restore sigmask, syscall or no syscall xtensa: add handling of TIF_NOTIFY_RESUME microblaze: drop 'oldset' argument of do_notify_resume() microblaze: handle TIF_NOTIFY_RESUME score: add handling of NOTIFY_RESUME to do_notify_resume() m68k: add TIF_NOTIFY_RESUME and handle it. sparc: kill ancient comment in sparc_sigaction() h8300: missing checks of __get_user()/__put_user() return values frv: missing checks of __get_user()/__put_user() return values cris: missing checks of __get_user()/__put_user() return values powerpc: missing checks of __get_user()/__put_user() return values sh: missing checks of __get_user()/__put_user() return values sparc: missing checks of __get_user()/__put_user() return values avr32: struct old_sigaction is never used m32r: struct old_sigaction is never used xtensa: xtensa_sigaction doesn't exist alpha: tidy signal delivery up score: don't open-code force_sigsegv() cris: don't open-code force_sigsegv() blackfin: don't open-code force_sigsegv() ...
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/include/asm/thread_info.h1
-rw-r--r--arch/m68k/kernel/entry_mm.S6
-rw-r--r--arch/m68k/kernel/signal.c41
-rw-r--r--arch/m68k/platform/68328/entry.S2
-rw-r--r--arch/m68k/platform/68360/entry.S2
-rw-r--r--arch/m68k/platform/coldfire/entry.S2
6 files changed, 27 insertions, 27 deletions
diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h
index e8665e6f9464..126131f94a2c 100644
--- a/arch/m68k/include/asm/thread_info.h
+++ b/arch/m68k/include/asm/thread_info.h
@@ -71,6 +71,7 @@ static inline struct thread_info *current_thread_info(void)
71 * bits 0-7 are tested at every exception exit 71 * bits 0-7 are tested at every exception exit
72 * bits 8-15 are also tested at syscall exit 72 * bits 8-15 are also tested at syscall exit
73 */ 73 */
74#define TIF_NOTIFY_RESUME 5 /* callback before returning to user */
74#define TIF_SIGPENDING 6 /* signal pending */ 75#define TIF_SIGPENDING 6 /* signal pending */
75#define TIF_NEED_RESCHED 7 /* rescheduling necessary */ 76#define TIF_NEED_RESCHED 7 /* rescheduling necessary */
76#define TIF_DELAYED_TRACE 14 /* single step a syscall */ 77#define TIF_DELAYED_TRACE 14 /* single step a syscall */
diff --git a/arch/m68k/kernel/entry_mm.S b/arch/m68k/kernel/entry_mm.S
index 675a854966a6..f29e73ca9dbb 100644
--- a/arch/m68k/kernel/entry_mm.S
+++ b/arch/m68k/kernel/entry_mm.S
@@ -148,7 +148,7 @@ syscall_exit_work:
148 jcs do_trace_exit 148 jcs do_trace_exit
149 jmi do_delayed_trace 149 jmi do_delayed_trace
150 lslw #8,%d0 150 lslw #8,%d0
151 jmi do_signal_return 151 jne do_signal_return
152 pea resume_userspace 152 pea resume_userspace
153 jra schedule 153 jra schedule
154 154
@@ -172,7 +172,7 @@ exit_work:
172 | save top of frame 172 | save top of frame
173 movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) 173 movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0)
174 lslb #1,%d0 174 lslb #1,%d0
175 jmi do_signal_return 175 jne do_signal_return
176 pea resume_userspace 176 pea resume_userspace
177 jra schedule 177 jra schedule
178 178
@@ -182,7 +182,7 @@ do_signal_return:
182 subql #4,%sp | dummy return address 182 subql #4,%sp | dummy return address
183 SAVE_SWITCH_STACK 183 SAVE_SWITCH_STACK
184 pea %sp@(SWITCH_STACK_SIZE) 184 pea %sp@(SWITCH_STACK_SIZE)
185 bsrl do_signal 185 bsrl do_notify_resume
186 addql #4,%sp 186 addql #4,%sp
187 RESTORE_SWITCH_STACK 187 RESTORE_SWITCH_STACK
188 addql #4,%sp 188 addql #4,%sp
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 1747c7030a33..d9f3d1900eed 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -43,6 +43,7 @@
43#include <linux/tty.h> 43#include <linux/tty.h>
44#include <linux/binfmts.h> 44#include <linux/binfmts.h>
45#include <linux/module.h> 45#include <linux/module.h>
46#include <linux/tracehook.h>
46 47
47#include <asm/setup.h> 48#include <asm/setup.h>
48#include <asm/uaccess.h> 49#include <asm/uaccess.h>
@@ -230,18 +231,9 @@ static inline void push_cache(unsigned long vaddr)
230asmlinkage int 231asmlinkage int
231sys_sigsuspend(int unused0, int unused1, old_sigset_t mask) 232sys_sigsuspend(int unused0, int unused1, old_sigset_t mask)
232{ 233{
233 mask &= _BLOCKABLE; 234 sigset_t blocked;
234 spin_lock_irq(&current->sighand->siglock); 235 siginitset(&blocked, mask);
235 current->saved_sigmask = current->blocked; 236 return sigsuspend(&blocked);
236 siginitset(&current->blocked, mask);
237 recalc_sigpending();
238 spin_unlock_irq(&current->sighand->siglock);
239
240 current->state = TASK_INTERRUPTIBLE;
241 schedule();
242 set_restore_sigmask();
243
244 return -ERESTARTNOHAND;
245} 237}
246 238
247asmlinkage int 239asmlinkage int
@@ -804,8 +796,7 @@ asmlinkage int do_sigreturn(unsigned long __unused)
804 goto badframe; 796 goto badframe;
805 797
806 sigdelsetmask(&set, ~_BLOCKABLE); 798 sigdelsetmask(&set, ~_BLOCKABLE);
807 current->blocked = set; 799 set_current_blocked(&set);
808 recalc_sigpending();
809 800
810 if (restore_sigcontext(regs, &frame->sc, frame + 1)) 801 if (restore_sigcontext(regs, &frame->sc, frame + 1))
811 goto badframe; 802 goto badframe;
@@ -830,8 +821,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
830 goto badframe; 821 goto badframe;
831 822
832 sigdelsetmask(&set, ~_BLOCKABLE); 823 sigdelsetmask(&set, ~_BLOCKABLE);
833 current->blocked = set; 824 set_current_blocked(&set);
834 recalc_sigpending();
835 825
836 if (rt_restore_ucontext(regs, sw, &frame->uc)) 826 if (rt_restore_ucontext(regs, sw, &frame->uc))
837 goto badframe; 827 goto badframe;
@@ -1150,10 +1140,7 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
1150 if (err) 1140 if (err)
1151 return; 1141 return;
1152 1142
1153 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 1143 block_sigmask(ka, sig);
1154 if (!(ka->sa.sa_flags & SA_NODEFER))
1155 sigaddset(&current->blocked,sig);
1156 recalc_sigpending();
1157 1144
1158 if (test_thread_flag(TIF_DELAYED_TRACE)) { 1145 if (test_thread_flag(TIF_DELAYED_TRACE)) {
1159 regs->sr &= ~0x8000; 1146 regs->sr &= ~0x8000;
@@ -1168,7 +1155,7 @@ handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
1168 * want to handle. Thus you cannot kill init even with a SIGKILL even by 1155 * want to handle. Thus you cannot kill init even with a SIGKILL even by
1169 * mistake. 1156 * mistake.
1170 */ 1157 */
1171asmlinkage void do_signal(struct pt_regs *regs) 1158static void do_signal(struct pt_regs *regs)
1172{ 1159{
1173 siginfo_t info; 1160 siginfo_t info;
1174 struct k_sigaction ka; 1161 struct k_sigaction ka;
@@ -1200,3 +1187,15 @@ asmlinkage void do_signal(struct pt_regs *regs)
1200 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 1187 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
1201 } 1188 }
1202} 1189}
1190
1191void do_notify_resume(struct pt_regs *regs)
1192{
1193 if (test_thread_flag(TIF_SIGPENDING))
1194 do_signal(regs);
1195
1196 if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) {
1197 tracehook_notify_resume(regs);
1198 if (current->replacement_session_keyring)
1199 key_replace_session_keyring();
1200 }
1201}
diff --git a/arch/m68k/platform/68328/entry.S b/arch/m68k/platform/68328/entry.S
index 5c39b80ed7de..7f91c2fde509 100644
--- a/arch/m68k/platform/68328/entry.S
+++ b/arch/m68k/platform/68328/entry.S
@@ -119,7 +119,7 @@ Lsignal_return:
119 subql #4,%sp /* dummy return address*/ 119 subql #4,%sp /* dummy return address*/
120 SAVE_SWITCH_STACK 120 SAVE_SWITCH_STACK
121 pea %sp@(SWITCH_STACK_SIZE) 121 pea %sp@(SWITCH_STACK_SIZE)
122 bsrw do_signal 122 bsrw do_notify_resume
123 addql #4,%sp 123 addql #4,%sp
124 RESTORE_SWITCH_STACK 124 RESTORE_SWITCH_STACK
125 addql #4,%sp 125 addql #4,%sp
diff --git a/arch/m68k/platform/68360/entry.S b/arch/m68k/platform/68360/entry.S
index aa47d1d49929..904fd9a4af4e 100644
--- a/arch/m68k/platform/68360/entry.S
+++ b/arch/m68k/platform/68360/entry.S
@@ -115,7 +115,7 @@ Lsignal_return:
115 subql #4,%sp /* dummy return address*/ 115 subql #4,%sp /* dummy return address*/
116 SAVE_SWITCH_STACK 116 SAVE_SWITCH_STACK
117 pea %sp@(SWITCH_STACK_SIZE) 117 pea %sp@(SWITCH_STACK_SIZE)
118 bsrw do_signal 118 bsrw do_notify_resume
119 addql #4,%sp 119 addql #4,%sp
120 RESTORE_SWITCH_STACK 120 RESTORE_SWITCH_STACK
121 addql #4,%sp 121 addql #4,%sp
diff --git a/arch/m68k/platform/coldfire/entry.S b/arch/m68k/platform/coldfire/entry.S
index 281e38c2b6c7..881ab8e379d4 100644
--- a/arch/m68k/platform/coldfire/entry.S
+++ b/arch/m68k/platform/coldfire/entry.S
@@ -152,7 +152,7 @@ Lsignal_return:
152 subql #4,%sp /* dummy return address */ 152 subql #4,%sp /* dummy return address */
153 SAVE_SWITCH_STACK 153 SAVE_SWITCH_STACK
154 pea %sp@(SWITCH_STACK_SIZE) 154 pea %sp@(SWITCH_STACK_SIZE)
155 jsr do_signal 155 jsr do_notify_resume
156 addql #4,%sp 156 addql #4,%sp
157 RESTORE_SWITCH_STACK 157 RESTORE_SWITCH_STACK
158 addql #4,%sp 158 addql #4,%sp