aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/compat.c6
-rw-r--r--fs/eventpoll.c3
-rw-r--r--fs/select.c4
-rw-r--r--include/linux/thread_info.h15
-rw-r--r--kernel/compat.c3
-rw-r--r--kernel/signal.c2
6 files changed, 22 insertions, 11 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 2ce4456aad30..9964d542ae9e 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1720,7 +1720,7 @@ sticky:
1720 if (sigmask) { 1720 if (sigmask) {
1721 memcpy(&current->saved_sigmask, &sigsaved, 1721 memcpy(&current->saved_sigmask, &sigsaved,
1722 sizeof(sigsaved)); 1722 sizeof(sigsaved));
1723 set_thread_flag(TIF_RESTORE_SIGMASK); 1723 set_restore_sigmask();
1724 } 1724 }
1725 } else if (sigmask) 1725 } else if (sigmask)
1726 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 1726 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
@@ -1791,7 +1791,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
1791 if (sigmask) { 1791 if (sigmask) {
1792 memcpy(&current->saved_sigmask, &sigsaved, 1792 memcpy(&current->saved_sigmask, &sigsaved,
1793 sizeof(sigsaved)); 1793 sizeof(sigsaved));
1794 set_thread_flag(TIF_RESTORE_SIGMASK); 1794 set_restore_sigmask();
1795 } 1795 }
1796 ret = -ERESTARTNOHAND; 1796 ret = -ERESTARTNOHAND;
1797 } else if (sigmask) 1797 } else if (sigmask)
@@ -2117,7 +2117,7 @@ asmlinkage long compat_sys_epoll_pwait(int epfd,
2117 if (err == -EINTR) { 2117 if (err == -EINTR) {
2118 memcpy(&current->saved_sigmask, &sigsaved, 2118 memcpy(&current->saved_sigmask, &sigsaved,
2119 sizeof(sigsaved)); 2119 sizeof(sigsaved));
2120 set_thread_flag(TIF_RESTORE_SIGMASK); 2120 set_restore_sigmask();
2121 } else 2121 } else
2122 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 2122 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
2123 } 2123 }
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 0d237182d721..71af2fc0041e 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1279,7 +1279,7 @@ asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
1279 if (error == -EINTR) { 1279 if (error == -EINTR) {
1280 memcpy(&current->saved_sigmask, &sigsaved, 1280 memcpy(&current->saved_sigmask, &sigsaved,
1281 sizeof(sigsaved)); 1281 sizeof(sigsaved));
1282 set_thread_flag(TIF_RESTORE_SIGMASK); 1282 set_restore_sigmask();
1283 } else 1283 } else
1284 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 1284 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
1285 } 1285 }
@@ -1309,4 +1309,3 @@ static int __init eventpoll_init(void)
1309 return 0; 1309 return 0;
1310} 1310}
1311fs_initcall(eventpoll_init); 1311fs_initcall(eventpoll_init);
1312
diff --git a/fs/select.c b/fs/select.c
index 00f58c5c7e05..32ce2b32fad1 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -498,7 +498,7 @@ sticky:
498 if (sigmask) { 498 if (sigmask) {
499 memcpy(&current->saved_sigmask, &sigsaved, 499 memcpy(&current->saved_sigmask, &sigsaved,
500 sizeof(sigsaved)); 500 sizeof(sigsaved));
501 set_thread_flag(TIF_RESTORE_SIGMASK); 501 set_restore_sigmask();
502 } 502 }
503 } else if (sigmask) 503 } else if (sigmask)
504 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 504 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
@@ -805,7 +805,7 @@ asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
805 if (sigmask) { 805 if (sigmask) {
806 memcpy(&current->saved_sigmask, &sigsaved, 806 memcpy(&current->saved_sigmask, &sigsaved,
807 sizeof(sigsaved)); 807 sizeof(sigsaved));
808 set_thread_flag(TIF_RESTORE_SIGMASK); 808 set_restore_sigmask();
809 } 809 }
810 ret = -ERESTARTNOHAND; 810 ret = -ERESTARTNOHAND;
811 } else if (sigmask) 811 } else if (sigmask)
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index accd7bad35b0..43d8162c696e 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -92,6 +92,19 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
92#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) 92#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
93#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) 93#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
94 94
95#endif 95#ifdef TIF_RESTORE_SIGMASK
96/**
97 * set_restore_sigmask() - make sure saved_sigmask processing gets done
98 *
99 * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code
100 * will run before returning to user mode, to process the flag.
101 */
102static inline void set_restore_sigmask(void)
103{
104 set_thread_flag(TIF_RESTORE_SIGMASK);
105}
106#endif /* TIF_RESTORE_SIGMASK */
107
108#endif /* __KERNEL__ */
96 109
97#endif /* _LINUX_THREAD_INFO_H */ 110#endif /* _LINUX_THREAD_INFO_H */
diff --git a/kernel/compat.c b/kernel/compat.c
index e1ef04870c2a..4a856a3643bb 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -898,7 +898,7 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat
898 898
899 current->state = TASK_INTERRUPTIBLE; 899 current->state = TASK_INTERRUPTIBLE;
900 schedule(); 900 schedule();
901 set_thread_flag(TIF_RESTORE_SIGMASK); 901 set_restore_sigmask();
902 return -ERESTARTNOHAND; 902 return -ERESTARTNOHAND;
903} 903}
904#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ 904#endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */
@@ -1080,4 +1080,3 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
1080 1080
1081 return 0; 1081 return 0;
1082} 1082}
1083
diff --git a/kernel/signal.c b/kernel/signal.c
index 9ac737e53df1..72bb4f51f963 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2541,7 +2541,7 @@ asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)
2541 2541
2542 current->state = TASK_INTERRUPTIBLE; 2542 current->state = TASK_INTERRUPTIBLE;
2543 schedule(); 2543 schedule();
2544 set_thread_flag(TIF_RESTORE_SIGMASK); 2544 set_restore_sigmask();
2545 return -ERESTARTNOHAND; 2545 return -ERESTARTNOHAND;
2546} 2546}
2547#endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */ 2547#endif /* __ARCH_WANT_SYS_RT_SIGSUSPEND */