diff options
| -rw-r--r-- | kernel/signal.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 4e3cff10fdce..31751868de88 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
| @@ -2421,9 +2421,13 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig, | |||
| 2421 | return -EFAULT; | 2421 | return -EFAULT; |
| 2422 | 2422 | ||
| 2423 | /* Not even root can pretend to send signals from the kernel. | 2423 | /* Not even root can pretend to send signals from the kernel. |
| 2424 | Nor can they impersonate a kill(), which adds source info. */ | 2424 | * Nor can they impersonate a kill()/tgkill(), which adds source info. |
| 2425 | if (info.si_code >= 0) | 2425 | */ |
| 2426 | if (info.si_code != SI_QUEUE) { | ||
| 2427 | /* We used to allow any < 0 si_code */ | ||
| 2428 | WARN_ON_ONCE(info.si_code < 0); | ||
| 2426 | return -EPERM; | 2429 | return -EPERM; |
| 2430 | } | ||
| 2427 | info.si_signo = sig; | 2431 | info.si_signo = sig; |
| 2428 | 2432 | ||
| 2429 | /* POSIX.1b doesn't mention process groups. */ | 2433 | /* POSIX.1b doesn't mention process groups. */ |
| @@ -2437,9 +2441,13 @@ long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) | |||
| 2437 | return -EINVAL; | 2441 | return -EINVAL; |
| 2438 | 2442 | ||
| 2439 | /* Not even root can pretend to send signals from the kernel. | 2443 | /* Not even root can pretend to send signals from the kernel. |
| 2440 | Nor can they impersonate a kill(), which adds source info. */ | 2444 | * Nor can they impersonate a kill()/tgkill(), which adds source info. |
| 2441 | if (info->si_code >= 0) | 2445 | */ |
| 2446 | if (info->si_code != SI_QUEUE) { | ||
| 2447 | /* We used to allow any < 0 si_code */ | ||
| 2448 | WARN_ON_ONCE(info->si_code < 0); | ||
| 2442 | return -EPERM; | 2449 | return -EPERM; |
| 2450 | } | ||
| 2443 | info->si_signo = sig; | 2451 | info->si_signo = sig; |
| 2444 | 2452 | ||
| 2445 | return do_send_specific(tgid, pid, sig, info); | 2453 | return do_send_specific(tgid, pid, sig, info); |
