From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Marcin Kowalczyk <qrczak@knm.org.pl>, linux-kernel@vger.kernel.org
Subject: [PATCH] setpgid(child) fails if the child was forked by sub-thread
Date: Wed, 22 Aug 2007 20:55:39 +0400 [thread overview]
Message-ID: <20070822165539.GA191@tv-sign.ru> (raw)
In-Reply-To: <20070822082517.321edfa5.akpm@linux-foundation.org>
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
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 <oleg@tv-sign.ru>
--- t/kernel/sys.c~SETPGID 2007-08-09 19:59:27.000000000 +0400
+++ t/kernel/sys.c 2007-08-22 20:11:23.000000000 +0400
@@ -1442,7 +1442,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;
@@ -1470,7 +1469,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 (task_session(p) != task_session(group_leader))
goto out;
next parent reply other threads:[~2007-08-22 16:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-8921-10286@http.bugzilla.kernel.org/>
[not found] ` <20070822082517.321edfa5.akpm@linux-foundation.org>
2007-08-22 16:55 ` Oleg Nesterov [this message]
2007-08-22 17:08 ` Randy Dunlap
2007-08-22 17:24 ` Oleg Nesterov
2007-08-22 17:30 ` Randy Dunlap
2007-08-23 8:49 ` Marcin 'Qrczak' Kowalczyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070822165539.GA191@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qrczak@knm.org.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®