diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-23 21:11:45 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-23 21:11:45 -0400 |
| commit | f9369910a6225b8d4892c3f20ae740a711cd5ace (patch) | |
| tree | 8650ff79d7607bceb35509c028400ecf1c317de0 /arch/score | |
| parent | 05f144a0d5c2207a0349348127f996e104ad7404 (diff) | |
| parent | 415d04d08fec74b226c92c1fb54ad117c9c6bac4 (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/score')
| -rw-r--r-- | arch/score/kernel/signal.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c index aa57440e497..d4a49011c48 100644 --- a/arch/score/kernel/signal.c +++ b/arch/score/kernel/signal.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/ptrace.h> | 28 | #include <linux/ptrace.h> |
| 29 | #include <linux/unistd.h> | 29 | #include <linux/unistd.h> |
| 30 | #include <linux/uaccess.h> | 30 | #include <linux/uaccess.h> |
| 31 | #include <linux/tracehook.h> | ||
| 31 | 32 | ||
| 32 | #include <asm/cacheflush.h> | 33 | #include <asm/cacheflush.h> |
| 33 | #include <asm/syscalls.h> | 34 | #include <asm/syscalls.h> |
| @@ -152,6 +153,9 @@ score_rt_sigreturn(struct pt_regs *regs) | |||
| 152 | stack_t st; | 153 | stack_t st; |
| 153 | int sig; | 154 | int sig; |
| 154 | 155 | ||
| 156 | /* Always make any pending restarted system calls return -EINTR */ | ||
| 157 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
| 158 | |||
| 155 | frame = (struct rt_sigframe __user *) regs->regs[0]; | 159 | frame = (struct rt_sigframe __user *) regs->regs[0]; |
| 156 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 160 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
| 157 | goto badframe; | 161 | goto badframe; |
| @@ -159,10 +163,7 @@ score_rt_sigreturn(struct pt_regs *regs) | |||
| 159 | goto badframe; | 163 | goto badframe; |
| 160 | 164 | ||
| 161 | sigdelsetmask(&set, ~_BLOCKABLE); | 165 | sigdelsetmask(&set, ~_BLOCKABLE); |
| 162 | spin_lock_irq(¤t->sighand->siglock); | 166 | set_current_blocked(&set); |
| 163 | current->blocked = set; | ||
| 164 | recalc_sigpending(); | ||
| 165 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 166 | 167 | ||
| 167 | sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext); | 168 | sig = restore_sigcontext(regs, &frame->rs_uc.uc_mcontext); |
| 168 | if (sig < 0) | 169 | if (sig < 0) |
| @@ -236,9 +237,7 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | |||
| 236 | return 0; | 237 | return 0; |
| 237 | 238 | ||
| 238 | give_sigsegv: | 239 | give_sigsegv: |
| 239 | if (signr == SIGSEGV) | 240 | force_sigsegv(signr, current); |
| 240 | ka->sa.sa_handler = SIG_DFL; | ||
| 241 | force_sig(SIGSEGV, current); | ||
| 242 | return -EFAULT; | 241 | return -EFAULT; |
| 243 | } | 242 | } |
| 244 | 243 | ||
| @@ -272,12 +271,8 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
| 272 | */ | 271 | */ |
| 273 | ret = setup_rt_frame(ka, regs, sig, oldset, info); | 272 | ret = setup_rt_frame(ka, regs, sig, oldset, info); |
| 274 | 273 | ||
| 275 | spin_lock_irq(¤t->sighand->siglock); | 274 | if (ret == 0) |
| 276 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | 275 | block_sigmask(ka, sig); |
| 277 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
| 278 | sigaddset(¤t->blocked, sig); | ||
| 279 | recalc_sigpending(); | ||
| 280 | spin_unlock_irq(¤t->sighand->siglock); | ||
| 281 | 276 | ||
| 282 | return ret; | 277 | return ret; |
| 283 | } | 278 | } |
| @@ -356,6 +351,12 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused, | |||
| 356 | __u32 thread_info_flags) | 351 | __u32 thread_info_flags) |
| 357 | { | 352 | { |
| 358 | /* deal with pending signal delivery */ | 353 | /* deal with pending signal delivery */ |
| 359 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 354 | if (thread_info_flags & _TIF_SIGPENDING) |
| 360 | do_signal(regs); | 355 | do_signal(regs); |
| 356 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | ||
| 357 | clear_thread_flag(TIF_NOTIFY_RESUME); | ||
| 358 | tracehook_notify_resume(regs); | ||
| 359 | if (current->replacement_session_keyring) | ||
| 360 | key_replace_session_keyring(); | ||
| 361 | } | ||
| 361 | } | 362 | } |
