diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 14:53:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-06-01 14:53:44 -0400 |
commit | 86c47b70f62a7072d441ba212aab33c2f82627c2 (patch) | |
tree | d03988bd2226966352bb7f3c2e82ff545353d2c4 /include | |
parent | 1193755ac6328ad240ba987e6ec41d5e8baf0680 (diff) | |
parent | 44fbbb3dc687c9709a6f2236197316e5c79ab1eb (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull third pile of signal handling patches from Al Viro:
"This time it's mostly helpers and conversions to them; there's a lot
of stuff remaining in the tree, but that'll either go in -rc2
(isolated bug fixes, ideally via arch maintainers' trees) or will sit
there until the next cycle."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
x86: get rid of calling do_notify_resume() when returning to kernel mode
blackfin: check __get_user() return value
whack-a-mole with TIF_FREEZE
FRV: Optimise the system call exit path in entry.S [ver #2]
FRV: Shrink TIF_WORK_MASK [ver #2]
FRV: Prevent syscall exit tracing and notify_resume at end of kernel exceptions
new helper: signal_delivered()
powerpc: get rid of restore_sigmask()
most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set
set_restore_sigmask() is never called without SIGPENDING (and never should be)
TIF_RESTORE_SIGMASK can be set only when TIF_SIGPENDING is set
don't call try_to_freeze() from do_signal()
pull clearing RESTORE_SIGMASK into block_sigmask()
sh64: failure to build sigframe != signal without handler
openrisc: tracehook_signal_handler() is supposed to be called on success
new helper: sigmask_to_save()
new helper: restore_saved_sigmask()
new helpers: {clear,test,test_and_clear}_restore_sigmask()
HAVE_RESTORE_SIGMASK is defined on all architectures now
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sched.h | 14 | ||||
-rw-r--r-- | include/linux/signal.h | 5 | ||||
-rw-r--r-- | include/linux/thread_info.h | 19 |
3 files changed, 35 insertions, 3 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 660c8ae93471..f34437e835a7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2207,6 +2207,20 @@ extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); | |||
2207 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); | 2207 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); |
2208 | extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); | 2208 | extern int do_sigaltstack(const stack_t __user *, stack_t __user *, unsigned long); |
2209 | 2209 | ||
2210 | static inline void restore_saved_sigmask(void) | ||
2211 | { | ||
2212 | if (test_and_clear_restore_sigmask()) | ||
2213 | __set_current_blocked(¤t->saved_sigmask); | ||
2214 | } | ||
2215 | |||
2216 | static inline sigset_t *sigmask_to_save(void) | ||
2217 | { | ||
2218 | sigset_t *res = ¤t->blocked; | ||
2219 | if (unlikely(test_restore_sigmask())) | ||
2220 | res = ¤t->saved_sigmask; | ||
2221 | return res; | ||
2222 | } | ||
2223 | |||
2210 | static inline int kill_cad_pid(int sig, int priv) | 2224 | static inline int kill_cad_pid(int sig, int priv) |
2211 | { | 2225 | { |
2212 | return kill_pid(cad_pid, sig, priv); | 2226 | return kill_pid(cad_pid, sig, priv); |
diff --git a/include/linux/signal.h b/include/linux/signal.h index 17046cc484bc..26b424adc842 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h | |||
@@ -250,12 +250,13 @@ extern long do_sigpending(void __user *, unsigned long); | |||
250 | extern int do_sigtimedwait(const sigset_t *, siginfo_t *, | 250 | extern int do_sigtimedwait(const sigset_t *, siginfo_t *, |
251 | const struct timespec *); | 251 | const struct timespec *); |
252 | extern int sigprocmask(int, sigset_t *, sigset_t *); | 252 | extern int sigprocmask(int, sigset_t *, sigset_t *); |
253 | extern void set_current_blocked(const sigset_t *); | 253 | extern void set_current_blocked(sigset_t *); |
254 | extern void __set_current_blocked(const sigset_t *); | ||
254 | extern int show_unhandled_signals; | 255 | extern int show_unhandled_signals; |
255 | extern int sigsuspend(sigset_t *); | 256 | extern int sigsuspend(sigset_t *); |
256 | 257 | ||
257 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); | 258 | extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); |
258 | extern void block_sigmask(struct k_sigaction *ka, int signr); | 259 | extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); |
259 | extern void exit_signals(struct task_struct *tsk); | 260 | extern void exit_signals(struct task_struct *tsk); |
260 | 261 | ||
261 | extern struct kmem_cache *sighand_cachep; | 262 | extern struct kmem_cache *sighand_cachep; |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index db78775eff3b..ccc1899bd62e 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #define _LINUX_THREAD_INFO_H | 8 | #define _LINUX_THREAD_INFO_H |
9 | 9 | ||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/bug.h> | ||
11 | 12 | ||
12 | struct timespec; | 13 | struct timespec; |
13 | struct compat_timespec; | 14 | struct compat_timespec; |
@@ -125,10 +126,26 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) | |||
125 | static inline void set_restore_sigmask(void) | 126 | static inline void set_restore_sigmask(void) |
126 | { | 127 | { |
127 | set_thread_flag(TIF_RESTORE_SIGMASK); | 128 | set_thread_flag(TIF_RESTORE_SIGMASK); |
128 | set_thread_flag(TIF_SIGPENDING); | 129 | WARN_ON(!test_thread_flag(TIF_SIGPENDING)); |
130 | } | ||
131 | static inline void clear_restore_sigmask(void) | ||
132 | { | ||
133 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
134 | } | ||
135 | static inline bool test_restore_sigmask(void) | ||
136 | { | ||
137 | return test_thread_flag(TIF_RESTORE_SIGMASK); | ||
138 | } | ||
139 | static inline bool test_and_clear_restore_sigmask(void) | ||
140 | { | ||
141 | return test_and_clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
129 | } | 142 | } |
130 | #endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */ | 143 | #endif /* TIF_RESTORE_SIGMASK && !HAVE_SET_RESTORE_SIGMASK */ |
131 | 144 | ||
145 | #ifndef HAVE_SET_RESTORE_SIGMASK | ||
146 | #error "no set_restore_sigmask() provided and default one won't work" | ||
147 | #endif | ||
148 | |||
132 | #endif /* __KERNEL__ */ | 149 | #endif /* __KERNEL__ */ |
133 | 150 | ||
134 | #endif /* _LINUX_THREAD_INFO_H */ | 151 | #endif /* _LINUX_THREAD_INFO_H */ |