提交 b07e35f9 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

setpgid(child) fails if the child was forked by sub-thread

Spotted by Marcin Kowalczyk <qrczak@knm.org.pl>.

sys_setpgid(child) fails if the child was forked by sub-thread.

Fix the "is it our child" check. The previous commit
ee0acf90 was not complete.

(this patch asks for the new same_thread_group() helper, but mainline doesn't
 have it yet).
Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
Acked-by: NRoland McGrath <roland@redhat.com>
Cc: <stable@kernel.org>
Tested-by: N"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5d540fb7
...@@ -1442,7 +1442,6 @@ asmlinkage long sys_times(struct tms __user * tbuf) ...@@ -1442,7 +1442,6 @@ asmlinkage long sys_times(struct tms __user * tbuf)
* Auch. Had to add the 'did_exec' flag to conform completely to POSIX. * Auch. Had to add the 'did_exec' flag to conform completely to POSIX.
* LBT 04.03.94 * LBT 04.03.94
*/ */
asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
{ {
struct task_struct *p; struct task_struct *p;
...@@ -1470,7 +1469,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) ...@@ -1470,7 +1469,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
if (!thread_group_leader(p)) if (!thread_group_leader(p))
goto out; goto out;
if (p->real_parent == group_leader) { if (p->real_parent->tgid == group_leader->tgid) {
err = -EPERM; err = -EPERM;
if (task_session(p) != task_session(group_leader)) if (task_session(p) != task_session(group_leader))
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册