From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762956AbXJMOt4 (ORCPT ); Sat, 13 Oct 2007 10:49:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761544AbXJMOml (ORCPT ); Sat, 13 Oct 2007 10:42:41 -0400 Received: from 1wt.eu ([62.212.114.60]:3002 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761942AbXJMOmk (ORCPT ); Sat, 13 Oct 2007 10:42:40 -0400 From: Willy Tarreau Message-Id: <20071013143455.%N@1wt.eu> References: <20071013142822.%N@1wt.eu> User-Agent: quilt/0.46-1 Date: Sat, 13 Oct 2007 17:28:38 +0200 To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Oleg Nesterov , Roland McGrath , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman Subject: [2.6.20.21 review 16/35] setpgid(child) fails if the child was forked by sub-thread Content-Disposition: inline; filename=0058-setpgid-child-fails-if-the-child-was-forked-by-sub.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org commit b07e35f94a7b6a059f889b904529ee907dc0634d in mainline tree Spotted by Marcin Kowalczyk . sys_setpgid(child) fails if the child was forked by sub-thread. Fix the "is it our child" check. The previous commit ee0acf90d320c29916ba8c5c1b2e908d81f5057d was not complete. (this patch asks for the new same_thread_group() helper, but mainline doesn't have it yet). Signed-off-by: Oleg Nesterov Acked-by: Roland McGrath Tested-by: "Marcin 'Qrczak' Kowalczyk" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/sys.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) Index: 2.6/kernel/sys.c =================================================================== --- 2.6.orig/kernel/sys.c +++ 2.6/kernel/sys.c @@ -1358,7 +1358,6 @@ asmlinkage long sys_times(struct tms __u * Auch. Had to add the 'did_exec' flag to conform completely to POSIX. * LBT 04.03.94 */ - asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) { struct task_struct *p; @@ -1386,7 +1385,7 @@ asmlinkage long sys_setpgid(pid_t pid, p if (!thread_group_leader(p)) goto out; - if (p->real_parent == group_leader) { + if (p->real_parent->tgid == group_leader->tgid) { err = -EPERM; if (process_session(p) != process_session(group_leader)) goto out; --