aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/ia32/ia32_signal.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-11-09 23:51:47 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-14 09:21:17 -0500
commit235b80226b986dabcbba844968f7807866bd0bfe (patch)
tree834a02573bcb1986c0b5e73af8fc8bd7d16dbffb /arch/x86/ia32/ia32_signal.c
parent08f739570de697dc06b949ba3be33acdda21498c (diff)
x86: convert to ksignal
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86/ia32/ia32_signal.c')
-rw-r--r--arch/x86/ia32/ia32_signal.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index b0460cd7de5a..cf1a471a18a2 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -309,7 +309,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
309/* 309/*
310 * Determine which stack to use.. 310 * Determine which stack to use..
311 */ 311 */
312static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, 312static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
313 size_t frame_size, 313 size_t frame_size,
314 void __user **fpstate) 314 void __user **fpstate)
315{ 315{
@@ -319,16 +319,13 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
319 sp = regs->sp; 319 sp = regs->sp;
320 320
321 /* This is the X/Open sanctioned signal stack switching. */ 321 /* This is the X/Open sanctioned signal stack switching. */
322 if (ka->sa.sa_flags & SA_ONSTACK) { 322 if (ksig->ka.sa.sa_flags & SA_ONSTACK)
323 if (sas_ss_flags(sp) == 0) 323 sp = sigsp(sp, ksig);
324 sp = current->sas_ss_sp + current->sas_ss_size;
325 }
326
327 /* This is the legacy signal stack switching. */ 324 /* This is the legacy signal stack switching. */
328 else if ((regs->ss & 0xffff) != __USER32_DS && 325 else if ((regs->ss & 0xffff) != __USER32_DS &&
329 !(ka->sa.sa_flags & SA_RESTORER) && 326 !(ksig->ka.sa.sa_flags & SA_RESTORER) &&
330 ka->sa.sa_restorer) 327 ksig->ka.sa.sa_restorer)
331 sp = (unsigned long) ka->sa.sa_restorer; 328 sp = (unsigned long) ksig->ka.sa.sa_restorer;
332 329
333 if (used_math()) { 330 if (used_math()) {
334 unsigned long fx_aligned, math_size; 331 unsigned long fx_aligned, math_size;
@@ -347,7 +344,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
347 return (void __user *) sp; 344 return (void __user *) sp;
348} 345}
349 346
350int ia32_setup_frame(int sig, struct k_sigaction *ka, 347int ia32_setup_frame(int sig, struct ksignal *ksig,
351 compat_sigset_t *set, struct pt_regs *regs) 348 compat_sigset_t *set, struct pt_regs *regs)
352{ 349{
353 struct sigframe_ia32 __user *frame; 350 struct sigframe_ia32 __user *frame;
@@ -366,7 +363,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
366 0x80cd, /* int $0x80 */ 363 0x80cd, /* int $0x80 */
367 }; 364 };
368 365
369 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 366 frame = get_sigframe(ksig, regs, sizeof(*frame), &fpstate);
370 367
371 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 368 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
372 return -EFAULT; 369 return -EFAULT;
@@ -383,8 +380,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
383 return -EFAULT; 380 return -EFAULT;
384 } 381 }
385 382
386 if (ka->sa.sa_flags & SA_RESTORER) { 383 if (ksig->ka.sa.sa_flags & SA_RESTORER) {
387 restorer = ka->sa.sa_restorer; 384 restorer = ksig->ka.sa.sa_restorer;
388 } else { 385 } else {
389 /* Return stub is in 32bit vsyscall page */ 386 /* Return stub is in 32bit vsyscall page */
390 if (current->mm->context.vdso) 387 if (current->mm->context.vdso)
@@ -409,7 +406,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
409 406
410 /* Set up registers for signal handler */ 407 /* Set up registers for signal handler */
411 regs->sp = (unsigned long) frame; 408 regs->sp = (unsigned long) frame;
412 regs->ip = (unsigned long) ka->sa.sa_handler; 409 regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
413 410
414 /* Make -mregparm=3 work */ 411 /* Make -mregparm=3 work */
415 regs->ax = sig; 412 regs->ax = sig;
@@ -425,7 +422,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
425 return 0; 422 return 0;
426} 423}
427 424
428int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 425int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
429 compat_sigset_t *set, struct pt_regs *regs) 426 compat_sigset_t *set, struct pt_regs *regs)
430{ 427{
431 struct rt_sigframe_ia32 __user *frame; 428 struct rt_sigframe_ia32 __user *frame;
@@ -446,7 +443,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
446 0, 443 0,
447 }; 444 };
448 445
449 frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); 446 frame = get_sigframe(ksig, regs, sizeof(*frame), &fpstate);
450 447
451 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 448 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
452 return -EFAULT; 449 return -EFAULT;
@@ -464,8 +461,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
464 put_user_ex(0, &frame->uc.uc_link); 461 put_user_ex(0, &frame->uc.uc_link);
465 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp); 462 err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp);
466 463
467 if (ka->sa.sa_flags & SA_RESTORER) 464 if (ksig->ka.sa.sa_flags & SA_RESTORER)
468 restorer = ka->sa.sa_restorer; 465 restorer = ksig->ka.sa.sa_restorer;
469 else 466 else
470 restorer = VDSO32_SYMBOL(current->mm->context.vdso, 467 restorer = VDSO32_SYMBOL(current->mm->context.vdso,
471 rt_sigreturn); 468 rt_sigreturn);
@@ -478,7 +475,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
478 put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode); 475 put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode);
479 } put_user_catch(err); 476 } put_user_catch(err);
480 477
481 err |= copy_siginfo_to_user32(&frame->info, info); 478 err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
482 err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, 479 err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
483 regs, set->sig[0]); 480 regs, set->sig[0]);
484 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 481 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
@@ -488,7 +485,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
488 485
489 /* Set up registers for signal handler */ 486 /* Set up registers for signal handler */
490 regs->sp = (unsigned long) frame; 487 regs->sp = (unsigned long) frame;
491 regs->ip = (unsigned long) ka->sa.sa_handler; 488 regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
492 489
493 /* Make -mregparm=3 work */ 490 /* Make -mregparm=3 work */
494 regs->ax = sig; 491 regs->ax = sig;