aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/compat.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-20 16:33:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-20 16:33:21 -0400
commit3ed4c0583daa34dedb568b26ff99e5a7b58db612 (patch)
treea531d4cc94acaa58fe0600cf83da9fb8b77f6e50 /kernel/compat.c
parentad9471752ebae25daa133b4e5d9299809c35e155 (diff)
parentbd715d9a4f13f87bad5526c2cd41370949473b16 (diff)
Merge branch 'ptrace' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc
* 'ptrace' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc: (41 commits) signal: trivial, fix the "timespec declared inside parameter list" warning job control: reorganize wait_task_stopped() ptrace: fix signal->wait_chldexit usage in task_clear_group_stop_trapping() signal: sys_sigprocmask() needs retarget_shared_pending() signal: cleanup sys_sigprocmask() signal: rename signandsets() to sigandnsets() signal: do_sigtimedwait() needs retarget_shared_pending() signal: introduce do_sigtimedwait() to factor out compat/native code signal: sys_rt_sigtimedwait: simplify the timeout logic signal: cleanup sys_rt_sigprocmask() x86: signal: sys_rt_sigreturn() should use set_current_blocked() x86: signal: handle_signal() should use set_current_blocked() signal: sigprocmask() should do retarget_shared_pending() signal: sigprocmask: narrow the scope of ->siglock signal: retarget_shared_pending: optimize while_each_thread() loop signal: retarget_shared_pending: consider shared/unblocked signals only signal: introduce retarget_shared_pending() ptrace: ptrace_check_attach() should not do s/STOPPED/TRACED/ signal: Turn SIGNAL_STOP_DEQUEUED into GROUP_STOP_DEQUEUED signal: do_signal_stop: Remove the unneeded task_clear_group_stop_pending() ...
Diffstat (limited to 'kernel/compat.c')
-rw-r--r--kernel/compat.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/kernel/compat.c b/kernel/compat.c
index 38b1d2c1cbe8..9214dcd087b7 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -890,10 +890,9 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
890{ 890{
891 compat_sigset_t s32; 891 compat_sigset_t s32;
892 sigset_t s; 892 sigset_t s;
893 int sig;
894 struct timespec t; 893 struct timespec t;
895 siginfo_t info; 894 siginfo_t info;
896 long ret, timeout = 0; 895 long ret;
897 896
898 if (sigsetsize != sizeof(sigset_t)) 897 if (sigsetsize != sizeof(sigset_t))
899 return -EINVAL; 898 return -EINVAL;
@@ -901,51 +900,19 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
901 if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t))) 900 if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t)))
902 return -EFAULT; 901 return -EFAULT;
903 sigset_from_compat(&s, &s32); 902 sigset_from_compat(&s, &s32);
904 sigdelsetmask(&s,sigmask(SIGKILL)|sigmask(SIGSTOP));
905 signotset(&s);
906 903
907 if (uts) { 904 if (uts) {
908 if (get_compat_timespec (&t, uts)) 905 if (get_compat_timespec(&t, uts))
909 return -EFAULT; 906 return -EFAULT;
910 if (t.tv_nsec >= 1000000000L || t.tv_nsec < 0
911 || t.tv_sec < 0)
912 return -EINVAL;
913 } 907 }
914 908
915 spin_lock_irq(&current->sighand->siglock); 909 ret = do_sigtimedwait(&s, &info, uts ? &t : NULL);
916 sig = dequeue_signal(current, &s, &info);
917 if (!sig) {
918 timeout = MAX_SCHEDULE_TIMEOUT;
919 if (uts)
920 timeout = timespec_to_jiffies(&t)
921 +(t.tv_sec || t.tv_nsec);
922 if (timeout) {
923 current->real_blocked = current->blocked;
924 sigandsets(&current->blocked, &current->blocked, &s);
925
926 recalc_sigpending();
927 spin_unlock_irq(&current->sighand->siglock);
928
929 timeout = schedule_timeout_interruptible(timeout);
930
931 spin_lock_irq(&current->sighand->siglock);
932 sig = dequeue_signal(current, &s, &info);
933 current->blocked = current->real_blocked;
934 siginitset(&current->real_blocked, 0);
935 recalc_sigpending();
936 }
937 }
938 spin_unlock_irq(&current->sighand->siglock);
939 910
940 if (sig) { 911 if (ret > 0 && uinfo) {
941 ret = sig; 912 if (copy_siginfo_to_user32(uinfo, &info))
942 if (uinfo) { 913 ret = -EFAULT;
943 if (copy_siginfo_to_user32(uinfo, &info))
944 ret = -EFAULT;
945 }
946 }else {
947 ret = timeout?-EINTR:-EAGAIN;
948 } 914 }
915
949 return ret; 916 return ret;
950 917
951} 918}