lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1d52e2w86.fsf@ebiederm.dsl.xmission.com>
Date:	Sun, 08 Apr 2007 19:05:29 -0600
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Oleg Nesterov <oleg@...sign.ru>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Davide Libenzi <davidel@...ilserver.org>,
	Ingo Molnar <mingo@...e.hu>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Robin Holt <holt@....com>, Roland McGrath <roland@...hat.com>,
	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [RFC, PATCH 1/3] introduce SYS_CLONE_MASK

Oleg Nesterov <oleg@...sign.ru> writes:

> On 04/08, Eric W. Biederman wrote:
>
>> If we are going to have kernel only flags please use an additional
>> argument to do_fork and copy_process.
>
> Yes, we can do this. But we have a number of architectures which use
> sys_clone() to implement kernel_thread(). It would be nice to have an
> architecture neutral kernel_thread() implementation as you proposed.
> We should change all of them if we want to add a new parameter to
> do_fork().
>
> Perhaps it is better to add reparent_kthread() (next patch) to kthread()
> and forget about CLONE_KERNEL_THREAD.

Please. 

> Anyway, re-parenting to swapper breaks pstree, it doesn't show kernel
> threads. And if ->parent == /sbin/init, we can't remove us from ->children
> (unless we forbid sub-thread-of-init exec). So the only safe change is
> set ->exit_state = -1.

Yes.  We certainly need ->exit_state = -1.
Earlier I had forgotten about second the use of ->children to update
the parent pointer of processes when their parent exits.

There is a practical question how much we care about pstree being
confused (I assume it doesn't crash).  If this is just a confusion
issue then I say go for it.  PPID == 0 is a very legitimate way to say
the kernel is the parent process.

There are a few more cases where we are likely to get PPID == 0 in the
future and /sbin/init already has that now.  Plus there is a lot of
historic precedent.  The odd part is PPID = 0 having multiple
children.

If we decide maintaining a tree is important I would much rather put
init_task on the task_list so we can see it in /proc then go the other
way around.

I would like a confirmation that it PPID == 0 is what is confusing
pstree just to make certain we haven't half filled in some field
in init_task and are thus giving in correct /proc output.  But that is
all the double checking I would do.

>> Your current scheme also has the bad side that if user space supplied
>> a kernel flag it is hard to detect it and return -EINVAL.  Which
>> limits future expansion.  Silently dropping clone flags is a real
>> pain, if you are trying to detect if a new flag has been implemented.
>
> Yes. But that is what we are doing now. copy_process() just ignores
> unknown flags.

Agreed.  I fixed that in sys_unshare but I should really submit a
patch to do the same for sys_clone at some point.

When know flags aren't implemented we certainly return -EINVAL.

Given that this line of work looks to fix the race that messes allows
a threaded init to generate unkillable zombies I can probably find
some time in the next while to work on it.

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ