From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fork: Allow init to become a session leader.
Date: Wed, 08 Feb 2006 21:28:59 +0300 [thread overview]
Message-ID: <43EA386B.D1A20AEB@tv-sign.ru> (raw)
In-Reply-To: <m1acd196hr.fsf@ebiederm.dsl.xmission.com>
"Eric W. Biederman" wrote:
>
> With the bug fixes from killing session == 0 and pgrp == 0 we
> have essentially made pid == 1 a session leader. However reading
> through the code I can see nothing, that sets the session->leader
> flag. In fact we actively clear it in all cases during clone.
> And setsid will fail to set it because the session == 1 and
> process group == 1 already exist.
>
> So this patch forces the session leader flag and for good measure
> the pgrp, session and tty of init as well.
>
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1179,9 +1179,16 @@ static task_t *copy_process(unsigned lon
> attach_pid(p, PIDTYPE_PID, p->pid);
> attach_pid(p, PIDTYPE_TGID, p->tgid);
> if (thread_group_leader(p)) {
> - p->signal->tty = current->signal->tty;
> - p->signal->pgrp = process_group(current);
> - p->signal->session = current->signal->session;
> + if (unlikely(p->pid == 1)) {
> + p->signal->tty = NULL;
> + p->signal->leader = 1;
> + p->signal->pgrp = 1;
> + p->signal->session = 1;
Isn't it enough to just set current->signal->leader = 1
in init/main.c:init() ? This process was already forked
with (1,1) special pids and ->tty == NULL.
Oleg.
next prev parent reply other threads:[~2006-02-08 17:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-08 16:10 Eric W. Biederman
2006-02-08 18:28 ` Oleg Nesterov [this message]
2006-02-08 17:29 ` Eric W. Biederman
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=43EA386B.D1A20AEB@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
/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®