diff options
Diffstat (limited to 'arch/x86/ia32/ia32_signal.c')
-rw-r--r-- | arch/x86/ia32/ia32_signal.c | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index 8d64c1bc847..4bc02b23674 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -351,31 +351,28 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
351 | savesegment(es, tmp); | 351 | savesegment(es, tmp); |
352 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); | 352 | err |= __put_user(tmp, (unsigned int __user *)&sc->es); |
353 | 353 | ||
354 | err |= __put_user((u32)regs->di, &sc->di); | 354 | err |= __put_user(regs->di, &sc->di); |
355 | err |= __put_user((u32)regs->si, &sc->si); | 355 | err |= __put_user(regs->si, &sc->si); |
356 | err |= __put_user((u32)regs->bp, &sc->bp); | 356 | err |= __put_user(regs->bp, &sc->bp); |
357 | err |= __put_user((u32)regs->sp, &sc->sp); | 357 | err |= __put_user(regs->sp, &sc->sp); |
358 | err |= __put_user((u32)regs->bx, &sc->bx); | 358 | err |= __put_user(regs->bx, &sc->bx); |
359 | err |= __put_user((u32)regs->dx, &sc->dx); | 359 | err |= __put_user(regs->dx, &sc->dx); |
360 | err |= __put_user((u32)regs->cx, &sc->cx); | 360 | err |= __put_user(regs->cx, &sc->cx); |
361 | err |= __put_user((u32)regs->ax, &sc->ax); | 361 | err |= __put_user(regs->ax, &sc->ax); |
362 | err |= __put_user((u32)regs->cs, &sc->cs); | 362 | err |= __put_user(regs->cs, &sc->cs); |
363 | err |= __put_user((u32)regs->ss, &sc->ss); | 363 | err |= __put_user(regs->ss, &sc->ss); |
364 | err |= __put_user(current->thread.trap_no, &sc->trapno); | 364 | err |= __put_user(current->thread.trap_no, &sc->trapno); |
365 | err |= __put_user(current->thread.error_code, &sc->err); | 365 | err |= __put_user(current->thread.error_code, &sc->err); |
366 | err |= __put_user((u32)regs->ip, &sc->ip); | 366 | err |= __put_user(regs->ip, &sc->ip); |
367 | err |= __put_user((u32)regs->flags, &sc->flags); | 367 | err |= __put_user(regs->flags, &sc->flags); |
368 | err |= __put_user((u32)regs->sp, &sc->sp_at_signal); | 368 | err |= __put_user(regs->sp, &sc->sp_at_signal); |
369 | 369 | ||
370 | tmp = save_i387_xstate_ia32(fpstate); | 370 | tmp = save_i387_xstate_ia32(fpstate); |
371 | if (tmp < 0) | 371 | if (tmp < 0) |
372 | err = -EFAULT; | 372 | err = -EFAULT; |
373 | else { | 373 | else |
374 | clear_used_math(); | ||
375 | stts(); | ||
376 | err |= __put_user(ptr_to_compat(tmp ? fpstate : NULL), | 374 | err |= __put_user(ptr_to_compat(tmp ? fpstate : NULL), |
377 | &sc->fpstate); | 375 | &sc->fpstate); |
378 | } | ||
379 | 376 | ||
380 | /* non-iBCS2 extensions.. */ | 377 | /* non-iBCS2 extensions.. */ |
381 | err |= __put_user(mask, &sc->oldmask); | 378 | err |= __put_user(mask, &sc->oldmask); |
@@ -444,21 +441,18 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
444 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); | 441 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
445 | 442 | ||
446 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 443 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
447 | goto give_sigsegv; | 444 | return -EFAULT; |
448 | 445 | ||
449 | err |= __put_user(sig, &frame->sig); | 446 | if (__put_user(sig, &frame->sig)) |
450 | if (err) | 447 | return -EFAULT; |
451 | goto give_sigsegv; | ||
452 | 448 | ||
453 | err |= ia32_setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0]); | 449 | if (ia32_setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0])) |
454 | if (err) | 450 | return -EFAULT; |
455 | goto give_sigsegv; | ||
456 | 451 | ||
457 | if (_COMPAT_NSIG_WORDS > 1) { | 452 | if (_COMPAT_NSIG_WORDS > 1) { |
458 | err |= __copy_to_user(frame->extramask, &set->sig[1], | 453 | if (__copy_to_user(frame->extramask, &set->sig[1], |
459 | sizeof(frame->extramask)); | 454 | sizeof(frame->extramask))) |
460 | if (err) | 455 | return -EFAULT; |
461 | goto give_sigsegv; | ||
462 | } | 456 | } |
463 | 457 | ||
464 | if (ka->sa.sa_flags & SA_RESTORER) { | 458 | if (ka->sa.sa_flags & SA_RESTORER) { |
@@ -479,7 +473,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
479 | */ | 473 | */ |
480 | err |= __copy_to_user(frame->retcode, &code, 8); | 474 | err |= __copy_to_user(frame->retcode, &code, 8); |
481 | if (err) | 475 | if (err) |
482 | goto give_sigsegv; | 476 | return -EFAULT; |
483 | 477 | ||
484 | /* Set up registers for signal handler */ | 478 | /* Set up registers for signal handler */ |
485 | regs->sp = (unsigned long) frame; | 479 | regs->sp = (unsigned long) frame; |
@@ -502,10 +496,6 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
502 | #endif | 496 | #endif |
503 | 497 | ||
504 | return 0; | 498 | return 0; |
505 | |||
506 | give_sigsegv: | ||
507 | force_sigsegv(sig, current); | ||
508 | return -EFAULT; | ||
509 | } | 499 | } |
510 | 500 | ||
511 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 501 | int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
@@ -533,14 +523,14 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
533 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); | 523 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
534 | 524 | ||
535 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 525 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
536 | goto give_sigsegv; | 526 | return -EFAULT; |
537 | 527 | ||
538 | err |= __put_user(sig, &frame->sig); | 528 | err |= __put_user(sig, &frame->sig); |
539 | err |= __put_user(ptr_to_compat(&frame->info), &frame->pinfo); | 529 | err |= __put_user(ptr_to_compat(&frame->info), &frame->pinfo); |
540 | err |= __put_user(ptr_to_compat(&frame->uc), &frame->puc); | 530 | err |= __put_user(ptr_to_compat(&frame->uc), &frame->puc); |
541 | err |= copy_siginfo_to_user32(&frame->info, info); | 531 | err |= copy_siginfo_to_user32(&frame->info, info); |
542 | if (err) | 532 | if (err) |
543 | goto give_sigsegv; | 533 | return -EFAULT; |
544 | 534 | ||
545 | /* Create the ucontext. */ | 535 | /* Create the ucontext. */ |
546 | if (cpu_has_xsave) | 536 | if (cpu_has_xsave) |
@@ -556,7 +546,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
556 | regs, set->sig[0]); | 546 | regs, set->sig[0]); |
557 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 547 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
558 | if (err) | 548 | if (err) |
559 | goto give_sigsegv; | 549 | return -EFAULT; |
560 | 550 | ||
561 | if (ka->sa.sa_flags & SA_RESTORER) | 551 | if (ka->sa.sa_flags & SA_RESTORER) |
562 | restorer = ka->sa.sa_restorer; | 552 | restorer = ka->sa.sa_restorer; |
@@ -571,7 +561,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
571 | */ | 561 | */ |
572 | err |= __copy_to_user(frame->retcode, &code, 8); | 562 | err |= __copy_to_user(frame->retcode, &code, 8); |
573 | if (err) | 563 | if (err) |
574 | goto give_sigsegv; | 564 | return -EFAULT; |
575 | 565 | ||
576 | /* Set up registers for signal handler */ | 566 | /* Set up registers for signal handler */ |
577 | regs->sp = (unsigned long) frame; | 567 | regs->sp = (unsigned long) frame; |
@@ -599,8 +589,4 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
599 | #endif | 589 | #endif |
600 | 590 | ||
601 | return 0; | 591 | return 0; |
602 | |||
603 | give_sigsegv: | ||
604 | force_sigsegv(sig, current); | ||
605 | return -EFAULT; | ||
606 | } | 592 | } |