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/frv | |
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/frv')
-rw-r--r-- | arch/frv/kernel/signal.c | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index bab01298b58e..8cf5dca01758 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, |
@@ -64,10 +56,10 @@ asmlinkage int sys_sigaction(int sig, | |||
64 | old_sigset_t mask; | 56 | old_sigset_t mask; |
65 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | 57 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || |
66 | __get_user(new_ka.sa.sa_handler, &act->sa_handler) || | 58 | __get_user(new_ka.sa.sa_handler, &act->sa_handler) || |
67 | __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) | 59 | __get_user(new_ka.sa.sa_restorer, &act->sa_restorer) || |
60 | __get_user(new_ka.sa.sa_flags, &act->sa_flags) || | ||
61 | __get_user(mask, &act->sa_mask)) | ||
68 | return -EFAULT; | 62 | return -EFAULT; |
69 | __get_user(new_ka.sa.sa_flags, &act->sa_flags); | ||
70 | __get_user(mask, &act->sa_mask); | ||
71 | siginitset(&new_ka.sa.sa_mask, mask); | 63 | siginitset(&new_ka.sa.sa_mask, mask); |
72 | } | 64 | } |
73 | 65 | ||
@@ -76,10 +68,10 @@ asmlinkage int sys_sigaction(int sig, | |||
76 | if (!ret && oact) { | 68 | if (!ret && oact) { |
77 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | 69 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || |
78 | __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || | 70 | __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || |
79 | __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) | 71 | __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer) || |
72 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags) || | ||
73 | __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask)) | ||
80 | return -EFAULT; | 74 | return -EFAULT; |
81 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags); | ||
82 | __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); | ||
83 | } | 75 | } |
84 | 76 | ||
85 | return ret; | 77 | return ret; |
@@ -158,10 +150,7 @@ asmlinkage int sys_sigreturn(void) | |||
158 | goto badframe; | 150 | goto badframe; |
159 | 151 | ||
160 | sigdelsetmask(&set, ~_BLOCKABLE); | 152 | sigdelsetmask(&set, ~_BLOCKABLE); |
161 | spin_lock_irq(¤t->sighand->siglock); | 153 | set_current_blocked(&set); |
162 | current->blocked = set; | ||
163 | recalc_sigpending(); | ||
164 | spin_unlock_irq(¤t->sighand->siglock); | ||
165 | 154 | ||
166 | if (restore_sigcontext(&frame->sc, &gr8)) | 155 | if (restore_sigcontext(&frame->sc, &gr8)) |
167 | goto badframe; | 156 | goto badframe; |
@@ -184,10 +173,7 @@ asmlinkage int sys_rt_sigreturn(void) | |||
184 | goto badframe; | 173 | goto badframe; |
185 | 174 | ||
186 | sigdelsetmask(&set, ~_BLOCKABLE); | 175 | sigdelsetmask(&set, ~_BLOCKABLE); |
187 | spin_lock_irq(¤t->sighand->siglock); | 176 | set_current_blocked(&set); |
188 | current->blocked = set; | ||
189 | recalc_sigpending(); | ||
190 | spin_unlock_irq(¤t->sighand->siglock); | ||
191 | 177 | ||
192 | if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8)) | 178 | if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8)) |
193 | goto badframe; | 179 | goto badframe; |
@@ -474,15 +460,8 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
474 | else | 460 | else |
475 | ret = setup_frame(sig, ka, oldset); | 461 | ret = setup_frame(sig, ka, oldset); |
476 | 462 | ||
477 | if (ret == 0) { | 463 | if (ret == 0) |
478 | spin_lock_irq(¤t->sighand->siglock); | 464 | block_sigmask(ka, sig); |
479 | sigorsets(¤t->blocked, ¤t->blocked, | ||
480 | &ka->sa.sa_mask); | ||
481 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
482 | sigaddset(¤t->blocked, sig); | ||
483 | recalc_sigpending(); | ||
484 | spin_unlock_irq(¤t->sighand->siglock); | ||
485 | } | ||
486 | 465 | ||
487 | return ret; | 466 | return ret; |
488 | 467 | ||