<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/fork.c, branch v2.6.16</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.16</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.16'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2006-03-18T18:49:36Z</updated>
<entry>
<title>[PATCH] disable unshare(CLONE_VM) for now</title>
<updated>2006-03-18T18:49:36Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@tv-sign.ru</email>
</author>
<published>2006-03-18T17:41:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2d61b86775a5676a8fba2ba2f0f869564e35c630'/>
<id>urn:sha1:2d61b86775a5676a8fba2ba2f0f869564e35c630</id>
<content type='text'>
sys_unshare() does mmput(new_mm).  This is not enough if we have
mm-&gt;core_waiters.

This patch is a temporary fix for soon to be released 2.6.16.

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
[ Checked with Uli: "I'm not planning to use unshare(CLONE_VM).  It's
  not needed for any functionality planned so far.  What we (as in Red
  Hat) need unshare() for now is the filesystem side." ]
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] unshare: Use rcu_assign_pointer when setting sighand</title>
<updated>2006-03-17T15:46:59Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@xmission.com</email>
</author>
<published>2006-03-16T17:31:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e0e8eb54d8ae0c4cfd1d297f6351b08a7f635c5f'/>
<id>urn:sha1:e0e8eb54d8ae0c4cfd1d297f6351b08a7f635c5f</id>
<content type='text'>
The sighand pointer only needs the rcu_read_lock on the
read side.  So only depending on task_lock protection
when setting this pointer is not enough.  We also need
a memory barrier to ensure the initialization is seen first.

Use rcu_assign_pointer as it does this for us, and clearly
documents that we are setting an rcu readable pointer.

Signed-off-by: Eric W. Biederman &lt;ebiederm@xmission.com&gt;
Acked-by: Paul E. McKenney &lt;paulmck@us.ibm.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] Fix sigaltstack corruption among cloned threads</title>
<updated>2006-03-14T15:57:17Z</updated>
<author>
<name>GOTO Masanori</name>
<email>gotom@sanori.org</email>
</author>
<published>2006-03-14T05:20:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f9a3879abf2f1a27c39915e6074b8ff15a24cb55'/>
<id>urn:sha1:f9a3879abf2f1a27c39915e6074b8ff15a24cb55</id>
<content type='text'>
This patch fixes alternate signal stack corruption among cloned threads
with CLONE_SIGHAND (and CLONE_VM) for linux-2.6.16-rc6.

The value of alternate signal stack is currently inherited after a call of
clone(...  CLONE_SIGHAND | CLONE_VM).  But if sigaltstack is set by a
parent thread, and then if multiple cloned child threads (+ parent threads)
call signal handler at the same time, some threads may be conflicted -
because they share to use the same alternative signal stack region.
Finally they get sigsegv.  It's an undesirable race condition.  Note that
child threads created from NPTL pthread_create() also hit this conflict
when the parent thread uses sigaltstack, without my patch.

To fix this problem, this patch clears the child threads' sigaltstack
information like exec().  This behavior follows the SUSv3 specification.
In SUSv3, pthread_create() says "The alternate stack shall not be inherited
(when new threads are initialized)".  It means that sigaltstack should be
cleared when sigaltstack memory space is shared by cloned threads with
CLONE_SIGHAND.

Note that I chose "if (clone_flags &amp; CLONE_SIGHAND)" line because:
  - If clone_flags line is not existed, fork() does not inherit sigaltstack.
  - CLONE_VM is another choice, but vfork() does not inherit sigaltstack.
  - CLONE_SIGHAND implies CLONE_VM, and it looks suitable.
  - CLONE_THREAD is another candidate, and includes CLONE_SIGHAND + CLONE_VM,
    but this flag has a bit different semantics.
I decided to use CLONE_SIGHAND.

[ Changed to test for CLONE_VM &amp;&amp; !CLONE_VFORK after discussion --Linus ]

Signed-off-by: GOTO Masanori &lt;gotom@sanori.org&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
Cc: Ulrich Drepper &lt;drepper@redhat.com&gt;
Cc: Jakub Jelinek &lt;jakub@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] remove __put_task_struct_cb export again</title>
<updated>2006-03-11T17:19:34Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2006-03-11T11:27:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7cd9013be6c22f3ff6f777354f766c8c0b955e17'/>
<id>urn:sha1:7cd9013be6c22f3ff6f777354f766c8c0b955e17</id>
<content type='text'>
The patch '[PATCH] RCU signal handling' [1] added an export for
__put_task_struct_cb, a put_task_struct helper newly introduced in that
patch.  But the put_task_struct couldn't be used modular previously as
__put_task_struct wasn't exported.  There are not callers of it in modular
code, and it shouldn't be exported because we don't want drivers to hold
references to task_structs.

This patch removes the export and folds __put_task_struct into
__put_task_struct_cb as there's no other caller.

[1] http://www2.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e56d090310d7625ecb43a1eeebd479f04affb48b

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Paul E. McKenney &lt;paulmck@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] fix kill_proc_info() vs fork() theoretical race</title>
<updated>2006-02-15T18:21:24Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@tv-sign.ru</email>
</author>
<published>2006-02-15T19:13:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dadac81b1b86196fcc48fb87620403c4a7174f06'/>
<id>urn:sha1:dadac81b1b86196fcc48fb87620403c4a7174f06</id>
<content type='text'>
copy_process:

	attach_pid(p, PIDTYPE_PID, p-&gt;pid);
	attach_pid(p, PIDTYPE_TGID, p-&gt;tgid);

What if kill_proc_info(p-&gt;pid) happens in between?

copy_process() holds current-&gt;sighand.siglock, so we are safe
in CLONE_THREAD case, because current-&gt;sighand == p-&gt;sighand.

Otherwise, p-&gt;sighand is unlocked, the new process is already
visible to the find_task_by_pid(), but have a copy of parent's
'struct pid' in -&gt;pids[PIDTYPE_TGID].

This means that __group_complete_signal() may hang while doing

	do ... while (next_thread() != p)

We can solve this problem if we reverse these 2 attach_pid()s:

	attach_pid() does wmb()

	group_send_sig_info() calls spin_lock(), which
	provides a read barrier. // Yes ?

I don't think we can hit this race in practice, but still.

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] fix kill_proc_info() vs CLONE_THREAD race</title>
<updated>2006-02-15T18:21:23Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@tv-sign.ru</email>
</author>
<published>2006-02-15T19:13:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3f17da699431ec48540beabc55c54d4b5e66c8e7'/>
<id>urn:sha1:3f17da699431ec48540beabc55c54d4b5e66c8e7</id>
<content type='text'>
There is a window after copy_process() unlocks -&gt;sighand.siglock
and before it adds the new thread to the thread list.

In that window __group_complete_signal(SIGKILL) will not see the
new thread yet, so this thread will start running while the whole
thread group was supposed to exit.

I beleive we have another good reason to place attach_pid(PID/TGID)
under -&gt;sighand.siglock. We can do the same for

	release_task()-&gt;__unhash_process()

	de_thread()-&gt;switch_exec_pids()

After that we don't need tasklist_lock to iterate over the thread
list, and we can simplify things, see for example do_sigaction()
or sys_times().

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] unshare system call -v5: unshare files</title>
<updated>2006-02-08T00:12:34Z</updated>
<author>
<name>JANAK DESAI</name>
<email>janak@us.ibm.com</email>
</author>
<published>2006-02-07T20:59:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a016f3389c06606dd80e687942ff3c71d41823c4'/>
<id>urn:sha1:a016f3389c06606dd80e687942ff3c71d41823c4</id>
<content type='text'>
If the file descriptor structure is being shared, allocate a new one and copy
information from the current, shared, structure.

Signed-off-by: Janak Desai &lt;janak@us.ibm.com&gt;
Cc: Al Viro &lt;viro@ftp.linux.org.uk&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Michael Kerrisk &lt;mtk-manpages@gmx.net&gt;
Cc: Andi Kleen &lt;ak@muc.de&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] unshare system call -v5: unshare vm</title>
<updated>2006-02-08T00:12:34Z</updated>
<author>
<name>JANAK DESAI</name>
<email>janak@us.ibm.com</email>
</author>
<published>2006-02-07T20:59:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a0a7ec308f1be5957b20a1a535d21f683dfd83f0'/>
<id>urn:sha1:a0a7ec308f1be5957b20a1a535d21f683dfd83f0</id>
<content type='text'>
If vm structure is being shared, allocate a new one and copy information from
the current, shared, structure.

Signed-off-by: Janak Desai &lt;janak@us.ibm.com&gt;
Cc: Al Viro &lt;viro@ftp.linux.org.uk&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Michael Kerrisk &lt;mtk-manpages@gmx.net&gt;
Cc: Andi Kleen &lt;ak@muc.de&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] unshare system call -v5: unshare namespace</title>
<updated>2006-02-08T00:12:34Z</updated>
<author>
<name>JANAK DESAI</name>
<email>janak@us.ibm.com</email>
</author>
<published>2006-02-07T20:59:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=741a295130606143edbf9fc740f633dbc1e6225f'/>
<id>urn:sha1:741a295130606143edbf9fc740f633dbc1e6225f</id>
<content type='text'>
If the namespace structure is being shared, allocate a new one and copy
information from the current, shared, structure.

Signed-off-by: Janak Desai &lt;janak@us.ibm.com&gt;
Cc: Al Viro &lt;viro@ftp.linux.org.uk&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Michael Kerrisk &lt;mtk-manpages@gmx.net&gt;
Cc: Andi Kleen &lt;ak@muc.de&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] unshare system call -v5: unshare filesystem info</title>
<updated>2006-02-08T00:12:34Z</updated>
<author>
<name>JANAK DESAI</name>
<email>janak@us.ibm.com</email>
</author>
<published>2006-02-07T20:58:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=99d1419d96d7df9cfa56bc977810be831bd5ef64'/>
<id>urn:sha1:99d1419d96d7df9cfa56bc977810be831bd5ef64</id>
<content type='text'>
If filesystem structure is being shared, allocate a new one and copy
information from the current, shared, structure.

Signed-off-by: Janak Desai &lt;janak@us.ibm.com&gt;
Cc: Al Viro &lt;viro@ftp.linux.org.uk&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Michael Kerrisk &lt;mtk-manpages@gmx.net&gt;
Cc: Andi Kleen &lt;ak@muc.de&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
</feed>
