diff options
| author | Ralf Baechle <ralf@linux-mips.org> | 2007-02-12 19:05:11 -0500 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2007-02-13 17:40:51 -0500 |
| commit | 431dc8040354db65e4f8d4d4e21ae4fab41f5bc3 (patch) | |
| tree | 54381eb2e9b738fd3d87fd129da85086983296c5 /arch/mips/kernel/linux32.c | |
| parent | 366d6aef281a670b32a51d289fc07bf0e5e72d9a (diff) | |
[MIPS] Fix sigset_t endianess swapping issues in 32-bit compat code.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/linux32.c')
| -rw-r--r-- | arch/mips/kernel/linux32.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index ca7ad78f4de..fc4dd6c9dd8 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <net/sock.h> | 39 | #include <net/sock.h> |
| 40 | #include <net/scm.h> | 40 | #include <net/scm.h> |
| 41 | 41 | ||
| 42 | #include <asm/compat-signal.h> | ||
| 42 | #include <asm/ipc.h> | 43 | #include <asm/ipc.h> |
| 43 | #include <asm/sim.h> | 44 | #include <asm/sim.h> |
| 44 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
| @@ -736,3 +737,49 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs) | |||
| 736 | return do_fork(clone_flags, newsp, ®s, 0, | 737 | return do_fork(clone_flags, newsp, ®s, 0, |
| 737 | parent_tidptr, child_tidptr); | 738 | parent_tidptr, child_tidptr); |
| 738 | } | 739 | } |
| 740 | |||
| 741 | /* | ||
| 742 | * Implement the event wait interface for the eventpoll file. It is the kernel | ||
| 743 | * part of the user space epoll_pwait(2). | ||
| 744 | */ | ||
| 745 | asmlinkage long compat_sys_epoll_pwait(int epfd, | ||
| 746 | struct epoll_event __user *events, int maxevents, int timeout, | ||
| 747 | const compat_sigset_t __user *sigmask, size_t sigsetsize) | ||
| 748 | { | ||
| 749 | int error; | ||
| 750 | sigset_t ksigmask, sigsaved; | ||
| 751 | |||
| 752 | /* | ||
| 753 | * If the caller wants a certain signal mask to be set during the wait, | ||
| 754 | * we apply it here. | ||
| 755 | */ | ||
| 756 | if (sigmask) { | ||
| 757 | if (sigsetsize != sizeof(sigset_t)) | ||
| 758 | return -EINVAL; | ||
| 759 | if (!access_ok(VERIFY_READ, sigmask, sizeof(ksigmask))) | ||
| 760 | return -EFAULT; | ||
| 761 | if (__copy_conv_sigset_from_user(&ksigmask, sigmask)) | ||
| 762 | return -EFAULT; | ||
| 763 | sigdelsetmask(&ksigmask, sigmask(SIGKILL) | sigmask(SIGSTOP)); | ||
| 764 | sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); | ||
| 765 | } | ||
| 766 | |||
| 767 | error = sys_epoll_wait(epfd, events, maxevents, timeout); | ||
| 768 | |||
| 769 | /* | ||
| 770 | * If we changed the signal mask, we need to restore the original one. | ||
| 771 | * In case we've got a signal while waiting, we do not restore the | ||
| 772 | * signal mask yet, and we allow do_signal() to deliver the signal on | ||
| 773 | * the way back to userspace, before the signal mask is restored. | ||
| 774 | */ | ||
| 775 | if (sigmask) { | ||
| 776 | if (error == -EINTR) { | ||
| 777 | memcpy(¤t->saved_sigmask, &sigsaved, | ||
| 778 | sizeof(sigsaved)); | ||
| 779 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
| 780 | } else | ||
| 781 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | ||
| 782 | } | ||
| 783 | |||
| 784 | return error; | ||
| 785 | } | ||
