mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, B.Steinbrink@gmx.de, viro@ftp.linux.org.uk
Subject: Re: + daemonize-detach-from-current-namespace.patch added to -mm tree
Date: Mon, 20 Feb 2006 02:04:27 -0700	[thread overview]
Message-ID: <m1ek1ymmec.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <1140425218.2979.14.camel@laptopd505.fenrus.org> (Arjan van de Ven's message of "Mon, 20 Feb 2006 09:46:57 +0100")

Arjan van de Ven <arjan@infradead.org> writes:

>> diff -puN kernel/exit.c~daemonize-detach-from-current-namespace kernel/exit.c
>> --- devel/kernel/exit.c~daemonize-detach-from-current-namespace 2006-02-19
> 20:36:58.000000000 -0800
>> +++ devel-akpm/kernel/exit.c	2006-02-19 20:36:58.000000000 -0800
>> @@ -360,6 +360,9 @@ void daemonize(const char *name, ...)
>>  	fs = init_task.fs;
>>  	current->fs = fs;
>>  	atomic_inc(&fs->count);
>> +	exit_namespace(current);
>> +	current->namespace = init_task.namespace;
>> +	get_namespace(current->namespace);
>>   	exit_files(current);
>
> not that it'll matter much here, but this is normally the wrong order of
> refcounting ;) First take the count, then start using it ;)

Well what would need in a general case situation here would be task_lock,
for the two tasks.  Having that as long as all of the operations happened
under the lock it wouldn't matter.  In this case the init_task is known
not to change, and no one else should be messing with current.

I am beginning to suspect that we will want to fix kernel_thread so it
creates copies of the init_task rather than copies of whatever random
user space process we happen to be a member of at the time.  With an
enhanced kernel_thread this problem could more easily avoided, as
we add additional namespaces to the kernel.

The problem with a kernel thread running in a private namespace like this
is that you can't kill the kernel thread and when it is the last user
of a private namespace.  So you can never free up your mounts etc.

As for this patch in particular matching the style that is already there for
a bug fix seems to make a lot of sense :)

Eric

  reply	other threads:[~2006-02-20  9:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200602200438.k1K4ct5n013388@shell0.pdx.osdl.net>
2006-02-20  8:46 ` Arjan van de Ven
2006-02-20  9:04   ` Eric W. Biederman [this message]
2006-02-20 10:09     ` Andrew Morton
2006-02-20 18:11       ` Eric W. Biederman
2006-02-21  0:30         ` 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=m1ek1ymmec.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=B.Steinbrink@gmx.de \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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

Powered by JetHome