diff options
| -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; |
