* [patch 0/3] add rt_tgsigqueueinfo syscall for 2.6.30
@ 2009-04-04 21:00 Thomas Gleixner
2009-04-04 21:01 ` [patch 1/3] signals: split do_tkill Thomas Gleixner
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Thomas Gleixner @ 2009-04-04 21:00 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, LKML, Oleg Nesterov, Roland McGrath,
Ulrich Drepper, Ingo Molnar, Michael Kerrisk
Linus, Andrew,
the following patch set has been discussed and reviewed on LKML for
quite a while and has reached its final state.
It implements sys_rt_tgsigqueueinfo which allows to queue signals to
a particulart thread. It's the counterpart for sys_rt_sigqueueinfo
and complements the sys_kill / sys_tgkill interface pair.
While I think that the ability to target a particular thread is useful
itself the lack of this interface is a serious show stopper for migrating
existing applications from other Unix like OSes which provide this.
The new syscall interface is acked by Ulrich and the implementation has
been reviewed by Oleg and acked by Roland.
Please apply.
Thanks,
tglx
^ permalink raw reply [flat|nested] 6+ messages in thread* [patch 1/3] signals: split do_tkill 2009-04-04 21:00 [patch 0/3] add rt_tgsigqueueinfo syscall for 2.6.30 Thomas Gleixner @ 2009-04-04 21:01 ` Thomas Gleixner 2009-04-04 21:01 ` [patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner 2009-04-04 21:01 ` [patch 3/3] x86: hookup sys_rt_tgsigqueueinfo Thomas Gleixner 2 siblings, 0 replies; 6+ messages in thread From: Thomas Gleixner @ 2009-04-04 21:01 UTC (permalink / raw) To: Linus Torvalds Cc: Andrew Morton, LKML, Oleg Nesterov, Roland McGrath, Ulrich Drepper, Ingo Molnar, Michael Kerrisk [-- Attachment #1: signals-split-do-tkill.patch --] [-- Type: text/plain, Size: 1990 bytes --] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Oleg Nesterov <oleg@redhat.com> --- kernel/signal.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) Index: linux-2.6/kernel/signal.c =================================================================== --- linux-2.6.orig/kernel/signal.c +++ linux-2.6/kernel/signal.c @@ -2278,24 +2278,17 @@ SYSCALL_DEFINE2(kill, pid_t, pid, int, s return kill_something_info(sig, &info, pid); } -static int do_tkill(pid_t tgid, pid_t pid, int sig) +static int +do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info) { - int error; - struct siginfo info; struct task_struct *p; unsigned long flags; - - error = -ESRCH; - info.si_signo = sig; - info.si_errno = 0; - info.si_code = SI_TKILL; - info.si_pid = task_tgid_vnr(current); - info.si_uid = current_uid(); + int error = -ESRCH; rcu_read_lock(); p = find_task_by_vpid(pid); if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) { - error = check_kill_permission(sig, &info, p); + error = check_kill_permission(sig, info, p); /* * The null signal is a permissions and process existence * probe. No signal is actually delivered. @@ -2305,7 +2298,7 @@ static int do_tkill(pid_t tgid, pid_t pi * signal is private anyway. */ if (!error && sig && lock_task_sighand(p, &flags)) { - error = specific_send_sig_info(sig, &info, p); + error = specific_send_sig_info(sig, info, p); unlock_task_sighand(p, &flags); } } @@ -2314,6 +2307,19 @@ static int do_tkill(pid_t tgid, pid_t pi return error; } +static int do_tkill(pid_t tgid, pid_t pid, int sig) +{ + struct siginfo info; + + info.si_signo = sig; + info.si_errno = 0; + info.si_code = SI_TKILL; + info.si_pid = task_tgid_vnr(current); + info.si_uid = current_uid(); + + return do_send_specific(tgid, pid, sig, &info); +} + /** * sys_tgkill - send signal to one specific thread * @tgid: the thread group ID of the thread ^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 2/3] signals: implement sys_rt_tgsigqueueinfo 2009-04-04 21:00 [patch 0/3] add rt_tgsigqueueinfo syscall for 2.6.30 Thomas Gleixner 2009-04-04 21:01 ` [patch 1/3] signals: split do_tkill Thomas Gleixner @ 2009-04-04 21:01 ` Thomas Gleixner 2009-04-04 21:01 ` [patch 3/3] x86: hookup sys_rt_tgsigqueueinfo Thomas Gleixner 2 siblings, 0 replies; 6+ messages in thread From: Thomas Gleixner @ 2009-04-04 21:01 UTC (permalink / raw) To: Linus Torvalds Cc: Andrew Morton, LKML, Oleg Nesterov, Roland McGrath, Ulrich Drepper, Ingo Molnar, Michael Kerrisk [-- Attachment #1: signals-implement-sys-rt-tgsigqueueinfo.patch --] [-- Type: text/plain, Size: 3488 bytes --] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Roland McGrath <roland@redhat.com> Acked-by: Ulrich Drepper <drepper@redhat.com> --- include/linux/compat.h | 2 ++ include/linux/signal.h | 2 ++ kernel/compat.c | 11 +++++++++++ kernel/signal.c | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) Index: linux-2.6/include/linux/compat.h =================================================================== --- linux-2.6.orig/include/linux/compat.h +++ linux-2.6/include/linux/compat.h @@ -222,6 +222,8 @@ int copy_siginfo_from_user32(siginfo_t * int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); int get_compat_sigevent(struct sigevent *event, const struct compat_sigevent __user *u_event); +long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, + struct compat_siginfo __user *uinfo); static inline int compat_timeval_compare(struct compat_timeval *lhs, struct compat_timeval *rhs) Index: linux-2.6/include/linux/signal.h =================================================================== --- linux-2.6.orig/include/linux/signal.h +++ linux-2.6/include/linux/signal.h @@ -235,6 +235,8 @@ static inline int valid_signal(unsigned extern int next_signal(struct sigpending *pending, sigset_t *mask); extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); +extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, + siginfo_t *info); extern long do_sigpending(void __user *, unsigned long); extern int sigprocmask(int, sigset_t *, sigset_t *); extern int show_unhandled_signals; Index: linux-2.6/kernel/compat.c =================================================================== --- linux-2.6.orig/kernel/compat.c +++ linux-2.6/kernel/compat.c @@ -882,6 +882,17 @@ compat_sys_rt_sigtimedwait (compat_sigse } +asmlinkage long +compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, + struct compat_siginfo __user *uinfo) +{ + siginfo_t info; + + if (copy_siginfo_from_user32(&info, uinfo)) + return -EFAULT; + return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); +} + #ifdef __ARCH_WANT_COMPAT_SYS_TIME /* compat_time_t is a 32 bit "long" and needs to get converted. */ Index: linux-2.6/kernel/signal.c =================================================================== --- linux-2.6.orig/kernel/signal.c +++ linux-2.6/kernel/signal.c @@ -2369,6 +2369,32 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, return kill_proc_info(sig, &info, pid); } +long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) +{ + /* This is only valid for single tasks */ + if (pid <= 0 || tgid <= 0) + return -EINVAL; + + /* Not even root can pretend to send signals from the kernel. + Nor can they impersonate a kill(), which adds source info. */ + if (info->si_code >= 0) + return -EPERM; + info->si_signo = sig; + + return do_send_specific(tgid, pid, sig, info); +} + +SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig, + siginfo_t __user *, uinfo) +{ + siginfo_t info; + + if (copy_from_user(&info, uinfo, sizeof(siginfo_t))) + return -EFAULT; + + return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); +} + int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) { struct task_struct *t = current; ^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 3/3] x86: hookup sys_rt_tgsigqueueinfo 2009-04-04 21:00 [patch 0/3] add rt_tgsigqueueinfo syscall for 2.6.30 Thomas Gleixner 2009-04-04 21:01 ` [patch 1/3] signals: split do_tkill Thomas Gleixner 2009-04-04 21:01 ` [patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner @ 2009-04-04 21:01 ` Thomas Gleixner 2 siblings, 0 replies; 6+ messages in thread From: Thomas Gleixner @ 2009-04-04 21:01 UTC (permalink / raw) To: Linus Torvalds Cc: Andrew Morton, LKML, Oleg Nesterov, Roland McGrath, Ulrich Drepper, Ingo Molnar, Michael Kerrisk [-- Attachment #1: x86-hookup-sys-rt-tgsigqueueinfo.patch --] [-- Type: text/plain, Size: 1910 bytes --] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- arch/x86/ia32/ia32entry.S | 1 + arch/x86/include/asm/unistd_32.h | 1 + arch/x86/include/asm/unistd_64.h | 2 ++ arch/x86/kernel/syscall_table_32.S | 1 + 4 files changed, 5 insertions(+) Index: linux-2.6/arch/x86/ia32/ia32entry.S =================================================================== --- linux-2.6.orig/arch/x86/ia32/ia32entry.S +++ linux-2.6/arch/x86/ia32/ia32entry.S @@ -830,4 +830,5 @@ ia32_sys_call_table: .quad sys_inotify_init1 .quad compat_sys_preadv .quad compat_sys_pwritev + .quad compat_sys_rt_tgsigqueueinfo /* 335 */ ia32_syscall_end: Index: linux-2.6/arch/x86/include/asm/unistd_32.h =================================================================== --- linux-2.6.orig/arch/x86/include/asm/unistd_32.h +++ linux-2.6/arch/x86/include/asm/unistd_32.h @@ -340,6 +340,7 @@ #define __NR_inotify_init1 332 #define __NR_preadv 333 #define __NR_pwritev 334 +#define __NR_rt_tgsigqueueinfo 335 #ifdef __KERNEL__ Index: linux-2.6/arch/x86/include/asm/unistd_64.h =================================================================== --- linux-2.6.orig/arch/x86/include/asm/unistd_64.h +++ linux-2.6/arch/x86/include/asm/unistd_64.h @@ -657,6 +657,8 @@ __SYSCALL(__NR_inotify_init1, sys_inotif __SYSCALL(__NR_preadv, sys_preadv) #define __NR_pwritev 296 __SYSCALL(__NR_pwritev, sys_pwritev) +#define __NR_rt_tgsigqueueinfo 297 +__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo) #ifndef __NO_STUBS Index: linux-2.6/arch/x86/kernel/syscall_table_32.S =================================================================== --- linux-2.6.orig/arch/x86/kernel/syscall_table_32.S +++ linux-2.6/arch/x86/kernel/syscall_table_32.S @@ -334,3 +334,4 @@ ENTRY(sys_call_table) .long sys_inotify_init1 .long sys_preadv .long sys_pwritev + .long sys_rt_tgsigqueueinfo /* 335 */ ^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 0/3] add rt_tgsigqueueinfo syscall -V2
@ 2009-03-24 10:35 Thomas Gleixner
2009-03-24 10:35 ` [patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2009-03-24 10:35 UTC (permalink / raw)
To: LKML
Cc: Roland McGrath, Oleg Nesterov, Michael Kerrisk, Ulrich Drepper,
Andrew Morton, Ingo Molnar
sys_kill has a counterpart sys_tgkill which allows to send signals to
a particular thread. sys_rt_sigqueueinfo is lacking such a counterpart.
Aside of the asymetry it is a show stopper for migrating applications
from other unix-alike RTOSes.
The following patch series implements rt_tgsigqueueinfo and hooks it
up for x86.
Changes since V1:
- match rt_siqqueueinfo and rt_tgsigqueueinfo handling of
info.si_pid/si_uid
Find below the raw documentation.
Thanks,
tglx
----
NAME
rt_tgsigqueueinfo - Send signal information to a signal to a thread
SYNOPSIS
long sys_rt_tgsigqueueinfo (int tgid, int tid, int sig, siginfo_t *uinfo);
DESCRIPTION
rt_tgsigqueueinfo sends signal sig information uinfo to the
thread with the thread ID tid in the thread group tgid. (By
contrast, rt_sigqueueinfo(2) can only be used to send a signal
info to a process (i.e., thread group) as a whole, and the
signal will be delivered to an arbitrary thread within that
process.)
RETURN VALUE
rt_tgsigqueueinfo returns 0 on success; otherwise,
rt_sigqueueinfo returns one of the errors listed in the
"Errors" section.
ERRORS
-EFAULT
An invalid value for uinfo was specified.
-EINVAL
An invalid TID, TGID or signal was specified.
-EPERM
Permission denied. For the required permissions,
see rt_sigqueueinfo(2).
-ESRCH
No process with the specified thread ID and thread group
ID exists.
^ permalink raw reply [flat|nested] 6+ messages in thread* [patch 2/3] signals: implement sys_rt_tgsigqueueinfo 2009-03-24 10:35 [patch 0/3] add rt_tgsigqueueinfo syscall -V2 Thomas Gleixner @ 2009-03-24 10:35 ` Thomas Gleixner 0 siblings, 0 replies; 6+ messages in thread From: Thomas Gleixner @ 2009-03-24 10:35 UTC (permalink / raw) To: LKML Cc: Roland McGrath, Oleg Nesterov, Michael Kerrisk, Ulrich Drepper, Andrew Morton, Ingo Molnar [-- Attachment #1: signals-implement-rt-tgsigqueueinfo.patch --] [-- Type: text/plain, Size: 3582 bytes --] sys_kill has the per thread counterpart sys_tgkill. sigqueueinfo is missing a thread directed counterpart. Such an interface is important for migrating applications from other OSes which have the per thread delivery implemented. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- include/linux/compat.h | 2 ++ include/linux/signal.h | 2 ++ kernel/compat.c | 11 +++++++++++ kernel/signal.c | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) Index: linux-2.6/include/linux/compat.h =================================================================== --- linux-2.6.orig/include/linux/compat.h +++ linux-2.6/include/linux/compat.h @@ -208,6 +208,8 @@ int copy_siginfo_from_user32(siginfo_t * int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); int get_compat_sigevent(struct sigevent *event, const struct compat_sigevent __user *u_event); +long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, + struct compat_siginfo __user *uinfo); static inline int compat_timeval_compare(struct compat_timeval *lhs, struct compat_timeval *rhs) Index: linux-2.6/include/linux/signal.h =================================================================== --- linux-2.6.orig/include/linux/signal.h +++ linux-2.6/include/linux/signal.h @@ -235,6 +235,8 @@ static inline int valid_signal(unsigned extern int next_signal(struct sigpending *pending, sigset_t *mask); extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); +extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, + siginfo_t *info); extern long do_sigpending(void __user *, unsigned long); extern int sigprocmask(int, sigset_t *, sigset_t *); extern int show_unhandled_signals; Index: linux-2.6/kernel/compat.c =================================================================== --- linux-2.6.orig/kernel/compat.c +++ linux-2.6/kernel/compat.c @@ -882,6 +882,17 @@ compat_sys_rt_sigtimedwait (compat_sigse } +asmlinkage long +compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, + struct compat_siginfo __user *uinfo) +{ + siginfo_t info; + + if (copy_siginfo_from_user32(&info, uinfo)) + return -EFAULT; + return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); +} + #ifdef __ARCH_WANT_COMPAT_SYS_TIME /* compat_time_t is a 32 bit "long" and needs to get converted. */ Index: linux-2.6/kernel/signal.c =================================================================== --- linux-2.6.orig/kernel/signal.c +++ linux-2.6/kernel/signal.c @@ -2326,6 +2326,32 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, return kill_proc_info(sig, &info, pid); } +long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) +{ + /* This is only valid for single tasks */ + if (pid <= 0 || tgid <= 0) + return -EINVAL; + + /* Not even root can pretend to send signals from the kernel. + Nor can they impersonate a kill(), which adds source info. */ + if (info->si_code >= 0) + return -EPERM; + info->si_signo = sig; + + return do_send_specific(tgid, pid, sig, info); +} + +SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig, + siginfo_t __user *, uinfo) +{ + siginfo_t info; + + if (copy_from_user(&info, uinfo, sizeof(siginfo_t))) + return -EFAULT; + + return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); +} + int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) { struct task_struct *t = current; ^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 0/3] add rt_tgsigqueueinfo syscall [RESEND]
@ 2009-02-26 13:35 Thomas Gleixner
2009-02-26 13:35 ` [patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2009-02-26 13:35 UTC (permalink / raw)
To: LKML; +Cc: Roland McGrath, Oleg Nesterov, Michael Kerrisk, Ingo Molnar
sys_kill has a counterpart sys_tgkill which allows to send signals to
a particular thread. sys_rt_sigqueueinfo is lacking such a counterpart.
Aside of the asymetry it is a show stopper for migrating applications
from other unix-alike RTOSes.
The following patch series implements rt_tgsigqueueinfo and hooks it
up for x86.
Find below the raw documentation.
Thanks,
tglx
----
NAME
rt_tgsigqueueinfo - Send signal information to a signal to a thread
SYNOPSIS
long sys_rt_tgsigqueueinfo (int tgid, int tid, int sig, siginfo_t *uinfo);
DESCRIPTION
rt_tgsigqueueinfo sends signal sig information uinfo to the
thread with the thread ID tid in the thread group tgid. (By
contrast, rt_sigqueueinfo(2) can only be used to send a signal
info to a process (i.e., thread group) as a whole, and the
signal will be delivered to an arbitrary thread within that
process.)
RETURN VALUE
rt_tgsigqueueinfo returns 0 on success; otherwise,
rt_sigqueueinfo returns one of the errors listed in the
"Errors" section.
ERRORS
-EFAULT
An invalid value for uinfo was specified.
-EINVAL
An invalid TID, TGID or signal was specified.
-EPERM
Permission denied. For the required permissions,
see rt_sigqueueinfo(2).
-ESRCH
No process with the specified thread ID and thread group
ID exists.
^ permalink raw reply [flat|nested] 6+ messages in thread* [patch 2/3] signals: implement sys_rt_tgsigqueueinfo 2009-02-26 13:35 [patch 0/3] add rt_tgsigqueueinfo syscall [RESEND] Thomas Gleixner @ 2009-02-26 13:35 ` Thomas Gleixner 0 siblings, 0 replies; 6+ messages in thread From: Thomas Gleixner @ 2009-02-26 13:35 UTC (permalink / raw) To: LKML; +Cc: Roland McGrath, Oleg Nesterov, Michael Kerrisk, Ingo Molnar [-- Attachment #1: signals-implement-rt-tgsigqueueinfo.patch --] [-- Type: text/plain, Size: 3630 bytes --] sys_kill has the per thread counterpart sys_tgkill. sigqueueinfo is missing a thread directed counterpart. Such an interface is important for migrating applications from other OSes which have the per thread delivery implemented. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> --- include/linux/compat.h | 2 ++ include/linux/signal.h | 2 ++ kernel/compat.c | 11 +++++++++++ kernel/signal.c | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) Index: linux-2.6-tip/include/linux/compat.h =================================================================== --- linux-2.6-tip.orig/include/linux/compat.h +++ linux-2.6-tip/include/linux/compat.h @@ -208,6 +208,8 @@ int copy_siginfo_from_user32(siginfo_t * int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); int get_compat_sigevent(struct sigevent *event, const struct compat_sigevent __user *u_event); +long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, + struct compat_siginfo __user *uinfo); static inline int compat_timeval_compare(struct compat_timeval *lhs, struct compat_timeval *rhs) Index: linux-2.6-tip/include/linux/signal.h =================================================================== --- linux-2.6-tip.orig/include/linux/signal.h +++ linux-2.6-tip/include/linux/signal.h @@ -235,6 +235,8 @@ static inline int valid_signal(unsigned extern int next_signal(struct sigpending *pending, sigset_t *mask); extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); +extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, + siginfo_t *info); extern long do_sigpending(void __user *, unsigned long); extern int sigprocmask(int, sigset_t *, sigset_t *); extern int show_unhandled_signals; Index: linux-2.6-tip/kernel/compat.c =================================================================== --- linux-2.6-tip.orig/kernel/compat.c +++ linux-2.6-tip/kernel/compat.c @@ -882,6 +882,17 @@ compat_sys_rt_sigtimedwait (compat_sigse } +asmlinkage long +compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig, + struct compat_siginfo __user *uinfo) +{ + siginfo_t info; + + if (copy_siginfo_from_user32(&info, uinfo)) + return -EFAULT; + return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); +} + #ifdef __ARCH_WANT_COMPAT_SYS_TIME /* compat_time_t is a 32 bit "long" and needs to get converted. */ Index: linux-2.6-tip/kernel/signal.c =================================================================== --- linux-2.6-tip.orig/kernel/signal.c +++ linux-2.6-tip/kernel/signal.c @@ -2327,6 +2327,32 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, return kill_proc_info(sig, &info, pid); } +long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) +{ + /* This is only valid for single tasks */ + if (pid <= 0 || tgid <= 0) + return -EINVAL; + + /* Not even root can pretend to send signals from the kernel. + Nor can they impersonate a kill(), which adds source info. */ + if (info->si_code >= 0) + return -EPERM; + info->si_signo = sig; + + return do_send_specific(tgid, pid, sig, info); +} + +SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig, + siginfo_t __user *, uinfo) +{ + siginfo_t info; + + if (copy_from_user(&info, uinfo, sizeof(siginfo_t))) + return -EFAULT; + + return do_rt_tgsigqueueinfo(tgid, pid, sig, &info); +} + int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) { struct task_struct *t = current; ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-04 21:03 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-04-04 21:00 [patch 0/3] add rt_tgsigqueueinfo syscall for 2.6.30 Thomas Gleixner 2009-04-04 21:01 ` [patch 1/3] signals: split do_tkill Thomas Gleixner 2009-04-04 21:01 ` [patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner 2009-04-04 21:01 ` [patch 3/3] x86: hookup sys_rt_tgsigqueueinfo Thomas Gleixner -- strict thread matches above, loose matches on Subject: below -- 2009-03-24 10:35 [patch 0/3] add rt_tgsigqueueinfo syscall -V2 Thomas Gleixner 2009-03-24 10:35 ` [patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner 2009-02-26 13:35 [patch 0/3] add rt_tgsigqueueinfo syscall [RESEND] Thomas Gleixner 2009-02-26 13:35 ` [patch 2/3] signals: implement sys_rt_tgsigqueueinfo Thomas Gleixner
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome