diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-03 11:55:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-03 11:55:50 -0400 |
commit | afe05d41e2c25ca3e047f9c7e5341bda553a932f (patch) | |
tree | e0695d27f427216d84ad384b8bfe3dfadd2868f7 /arch | |
parent | c15f5bbc94ece97831184abef664186278c93674 (diff) | |
parent | 10469350e345599dfef3fa78a7c19fb230e674c1 (diff) |
Merge branch 'for-curr' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC fix from Vineet Gupta:
"Chrisitian found/fixed issue with SA_SIGINFO based signal handler
corrupting the user space registers post after signal handling"
* 'for-curr' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
ARC: Fix signal frame management for SA_SIGINFO
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arc/kernel/signal.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index ee6ef2f60a28..7e95e1a86510 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c | |||
@@ -101,7 +101,6 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
101 | { | 101 | { |
102 | struct rt_sigframe __user *sf; | 102 | struct rt_sigframe __user *sf; |
103 | unsigned int magic; | 103 | unsigned int magic; |
104 | int err; | ||
105 | struct pt_regs *regs = current_pt_regs(); | 104 | struct pt_regs *regs = current_pt_regs(); |
106 | 105 | ||
107 | /* Always make any pending restarted system calls return -EINTR */ | 106 | /* Always make any pending restarted system calls return -EINTR */ |
@@ -119,15 +118,16 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
119 | if (!access_ok(VERIFY_READ, sf, sizeof(*sf))) | 118 | if (!access_ok(VERIFY_READ, sf, sizeof(*sf))) |
120 | goto badframe; | 119 | goto badframe; |
121 | 120 | ||
122 | err = restore_usr_regs(regs, sf); | 121 | if (__get_user(magic, &sf->sigret_magic)) |
123 | err |= __get_user(magic, &sf->sigret_magic); | ||
124 | if (err) | ||
125 | goto badframe; | 122 | goto badframe; |
126 | 123 | ||
127 | if (unlikely(is_do_ss_needed(magic))) | 124 | if (unlikely(is_do_ss_needed(magic))) |
128 | if (restore_altstack(&sf->uc.uc_stack)) | 125 | if (restore_altstack(&sf->uc.uc_stack)) |
129 | goto badframe; | 126 | goto badframe; |
130 | 127 | ||
128 | if (restore_usr_regs(regs, sf)) | ||
129 | goto badframe; | ||
130 | |||
131 | /* Don't restart from sigreturn */ | 131 | /* Don't restart from sigreturn */ |
132 | syscall_wont_restart(regs); | 132 | syscall_wont_restart(regs); |
133 | 133 | ||
@@ -191,6 +191,15 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info, | |||
191 | return 1; | 191 | return 1; |
192 | 192 | ||
193 | /* | 193 | /* |
194 | * w/o SA_SIGINFO, struct ucontext is partially populated (only | ||
195 | * uc_mcontext/uc_sigmask) for kernel's normal user state preservation | ||
196 | * during signal handler execution. This works for SA_SIGINFO as well | ||
197 | * although the semantics are now overloaded (the same reg state can be | ||
198 | * inspected by userland: but are they allowed to fiddle with it ? | ||
199 | */ | ||
200 | err |= stash_usr_regs(sf, regs, set); | ||
201 | |||
202 | /* | ||
194 | * SA_SIGINFO requires 3 args to signal handler: | 203 | * SA_SIGINFO requires 3 args to signal handler: |
195 | * #1: sig-no (common to any handler) | 204 | * #1: sig-no (common to any handler) |
196 | * #2: struct siginfo | 205 | * #2: struct siginfo |
@@ -213,14 +222,6 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info, | |||
213 | magic = MAGIC_SIGALTSTK; | 222 | magic = MAGIC_SIGALTSTK; |
214 | } | 223 | } |
215 | 224 | ||
216 | /* | ||
217 | * w/o SA_SIGINFO, struct ucontext is partially populated (only | ||
218 | * uc_mcontext/uc_sigmask) for kernel's normal user state preservation | ||
219 | * during signal handler execution. This works for SA_SIGINFO as well | ||
220 | * although the semantics are now overloaded (the same reg state can be | ||
221 | * inspected by userland: but are they allowed to fiddle with it ? | ||
222 | */ | ||
223 | err |= stash_usr_regs(sf, regs, set); | ||
224 | err |= __put_user(magic, &sf->sigret_magic); | 225 | err |= __put_user(magic, &sf->sigret_magic); |
225 | if (err) | 226 | if (err) |
226 | return err; | 227 | return err; |