diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-06-11 02:01:14 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-06-11 02:01:14 -0400 |
commit | cf9fe114e3b37e14fc8434d5abb192e35df551b1 (patch) | |
tree | 0f82879295dc792f9df1a3ce79e143a3c073510f /kernel/signal.c | |
parent | c1d0d32a603ed06377f404adf2c538de33bb3634 (diff) | |
parent | 991ec02cdca33b03a132a0cacfe6f0aa0be9aa8d (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index d8034737db4c..dba6ae99978a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/freezer.h> | 27 | #include <linux/freezer.h> |
28 | #include <linux/pid_namespace.h> | 28 | #include <linux/pid_namespace.h> |
29 | #include <linux/nsproxy.h> | 29 | #include <linux/nsproxy.h> |
30 | #include <trace/sched.h> | 30 | #include <trace/events/sched.h> |
31 | 31 | ||
32 | #include <asm/param.h> | 32 | #include <asm/param.h> |
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
@@ -41,8 +41,6 @@ | |||
41 | 41 | ||
42 | static struct kmem_cache *sigqueue_cachep; | 42 | static struct kmem_cache *sigqueue_cachep; |
43 | 43 | ||
44 | DEFINE_TRACE(sched_signal_send); | ||
45 | |||
46 | static void __user *sig_handler(struct task_struct *t, int sig) | 44 | static void __user *sig_handler(struct task_struct *t, int sig) |
47 | { | 45 | { |
48 | return t->sighand->action[sig - 1].sa.sa_handler; | 46 | return t->sighand->action[sig - 1].sa.sa_handler; |
@@ -2278,24 +2276,17 @@ SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) | |||
2278 | return kill_something_info(sig, &info, pid); | 2276 | return kill_something_info(sig, &info, pid); |
2279 | } | 2277 | } |
2280 | 2278 | ||
2281 | static int do_tkill(pid_t tgid, pid_t pid, int sig) | 2279 | static int |
2280 | do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info) | ||
2282 | { | 2281 | { |
2283 | int error; | ||
2284 | struct siginfo info; | ||
2285 | struct task_struct *p; | 2282 | struct task_struct *p; |
2286 | unsigned long flags; | 2283 | unsigned long flags; |
2287 | 2284 | int error = -ESRCH; | |
2288 | error = -ESRCH; | ||
2289 | info.si_signo = sig; | ||
2290 | info.si_errno = 0; | ||
2291 | info.si_code = SI_TKILL; | ||
2292 | info.si_pid = task_tgid_vnr(current); | ||
2293 | info.si_uid = current_uid(); | ||
2294 | 2285 | ||
2295 | rcu_read_lock(); | 2286 | rcu_read_lock(); |
2296 | p = find_task_by_vpid(pid); | 2287 | p = find_task_by_vpid(pid); |
2297 | if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) { | 2288 | if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) { |
2298 | error = check_kill_permission(sig, &info, p); | 2289 | error = check_kill_permission(sig, info, p); |
2299 | /* | 2290 | /* |
2300 | * The null signal is a permissions and process existence | 2291 | * The null signal is a permissions and process existence |
2301 | * probe. No signal is actually delivered. | 2292 | * probe. No signal is actually delivered. |
@@ -2305,7 +2296,7 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig) | |||
2305 | * signal is private anyway. | 2296 | * signal is private anyway. |
2306 | */ | 2297 | */ |
2307 | if (!error && sig && lock_task_sighand(p, &flags)) { | 2298 | if (!error && sig && lock_task_sighand(p, &flags)) { |
2308 | error = specific_send_sig_info(sig, &info, p); | 2299 | error = specific_send_sig_info(sig, info, p); |
2309 | unlock_task_sighand(p, &flags); | 2300 | unlock_task_sighand(p, &flags); |
2310 | } | 2301 | } |
2311 | } | 2302 | } |
@@ -2314,6 +2305,19 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig) | |||
2314 | return error; | 2305 | return error; |
2315 | } | 2306 | } |
2316 | 2307 | ||
2308 | static int do_tkill(pid_t tgid, pid_t pid, int sig) | ||
2309 | { | ||
2310 | struct siginfo info; | ||
2311 | |||
2312 | info.si_signo = sig; | ||
2313 | info.si_errno = 0; | ||
2314 | info.si_code = SI_TKILL; | ||
2315 | info.si_pid = task_tgid_vnr(current); | ||
2316 | info.si_uid = current_uid(); | ||
2317 | |||
2318 | return do_send_specific(tgid, pid, sig, &info); | ||
2319 | } | ||
2320 | |||
2317 | /** | 2321 | /** |
2318 | * sys_tgkill - send signal to one specific thread | 2322 | * sys_tgkill - send signal to one specific thread |
2319 | * @tgid: the thread group ID of the thread | 2323 | * @tgid: the thread group ID of the thread |
@@ -2363,6 +2367,32 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig, | |||
2363 | return kill_proc_info(sig, &info, pid); | 2367 | return kill_proc_info(sig, &info, pid); |
2364 | } | 2368 | } |
2365 | 2369 | ||
2370 | long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) | ||
2371 | { | ||
2372 | /* This is only valid for single tasks */ | ||
2373 | if (pid <= 0 || tgid <= 0) | ||
2374 | return -EINVAL; | ||
2375 | |||
2376 | /* Not even root can pretend to send signals from the kernel. | ||
2377 | Nor can they impersonate a kill(), which adds source info. */ | ||
2378 | if (info->si_code >= 0) | ||
2379 | return -EPERM; | ||
2380 | info->si_signo = sig; | ||
2381 | |||
2382 | return do_send_specific(tgid, pid, sig, info); | ||
2383 | } | ||
2384 | |||
2385 | SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig, | ||
2386 | siginfo_t __user *, uinfo) | ||
2387 | { | ||
2388 | siginfo_t info; | ||
2389 | |||
2390 | if (copy_from_user(&info, uinfo, sizeof(siginfo_t))) | ||
2391 | return -EFAULT; | ||
2392 | |||
2393 | return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); | ||
2394 | } | ||
2395 | |||
2366 | int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) | 2396 | int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) |
2367 | { | 2397 | { |
2368 | struct task_struct *t = current; | 2398 | struct task_struct *t = current; |