diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-05-01 09:37:46 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2009-05-21 09:56:05 -0400 |
commit | 353b431bafc42ed8782c7aec7fb819ca4e385ab1 (patch) | |
tree | 0e454e08d6b8170616a0d869e231110200b65765 | |
parent | 5af7fa68103e7b2efb0fd9d901b1c25bad96fd21 (diff) |
microblaze: fix __user annotations
The microblaze signal handling code gets some __user
pointers wrong, as shown by sparse.
This adds the annotations where appropriate and
change sys_rt_sigreturn to correctly pass a user
stack down to do_sigaltstack instead of a kernel
structure.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michal Simek <monstr@monstr.eu>
-rw-r--r-- | arch/microblaze/kernel/signal.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index 40d36931e363..804a074a94a8 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c | |||
@@ -152,8 +152,8 @@ struct rt_sigframe { | |||
152 | unsigned long tramp[2]; /* signal trampoline */ | 152 | unsigned long tramp[2]; /* signal trampoline */ |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static int | 155 | static int restore_sigcontext(struct pt_regs *regs, |
156 | restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, int *rval_p) | 156 | struct sigcontext __user *sc, int *rval_p) |
157 | { | 157 | { |
158 | unsigned int err = 0; | 158 | unsigned int err = 0; |
159 | 159 | ||
@@ -211,11 +211,10 @@ badframe: | |||
211 | 211 | ||
212 | asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) | 212 | asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) |
213 | { | 213 | { |
214 | struct rt_sigframe *frame = | 214 | struct rt_sigframe __user *frame = |
215 | (struct rt_sigframe *)(regs->r1 + STATE_SAVE_ARG_SPACE); | 215 | (struct rt_sigframe __user *)(regs->r1 + STATE_SAVE_ARG_SPACE); |
216 | 216 | ||
217 | sigset_t set; | 217 | sigset_t set; |
218 | stack_t st; | ||
219 | int rval; | 218 | int rval; |
220 | 219 | ||
221 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | 220 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) |
@@ -233,11 +232,10 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) | |||
233 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval)) | 232 | if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval)) |
234 | goto badframe; | 233 | goto badframe; |
235 | 234 | ||
236 | if (__copy_from_user((void *)&st, &frame->uc.uc_stack, sizeof(st))) | ||
237 | goto badframe; | ||
238 | /* It is more difficult to avoid calling this function than to | 235 | /* It is more difficult to avoid calling this function than to |
239 | call it and ignore errors. */ | 236 | call it and ignore errors. */ |
240 | do_sigaltstack(&st, NULL, regs->r1); | 237 | if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->r1)) |
238 | goto badframe; | ||
241 | 239 | ||
242 | return rval; | 240 | return rval; |
243 | 241 | ||
@@ -251,7 +249,7 @@ badframe: | |||
251 | */ | 249 | */ |
252 | 250 | ||
253 | static int | 251 | static int |
254 | setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, | 252 | setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, |
255 | unsigned long mask) | 253 | unsigned long mask) |
256 | { | 254 | { |
257 | int err = 0; | 255 | int err = 0; |
@@ -278,7 +276,7 @@ setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, | |||
278 | /* | 276 | /* |
279 | * Determine which stack to use.. | 277 | * Determine which stack to use.. |
280 | */ | 278 | */ |
281 | static inline void * | 279 | static inline void __user * |
282 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | 280 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) |
283 | { | 281 | { |
284 | /* Default to using normal stack */ | 282 | /* Default to using normal stack */ |
@@ -287,7 +285,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | |||
287 | if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && !on_sig_stack(sp)) | 285 | if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && !on_sig_stack(sp)) |
288 | sp = current->sas_ss_sp + current->sas_ss_size; | 286 | sp = current->sas_ss_sp + current->sas_ss_size; |
289 | 287 | ||
290 | return (void *)((sp - frame_size) & -8UL); | 288 | return (void __user *)((sp - frame_size) & -8UL); |
291 | } | 289 | } |
292 | 290 | ||
293 | static void setup_frame(int sig, struct k_sigaction *ka, | 291 | static void setup_frame(int sig, struct k_sigaction *ka, |
@@ -367,7 +365,7 @@ give_sigsegv: | |||
367 | static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 365 | static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
368 | sigset_t *set, struct pt_regs *regs) | 366 | sigset_t *set, struct pt_regs *regs) |
369 | { | 367 | { |
370 | struct rt_sigframe *frame; | 368 | struct rt_sigframe __user *frame; |
371 | int err = 0; | 369 | int err = 0; |
372 | int signal; | 370 | int signal; |
373 | 371 | ||