<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/exec.c, branch v2.6.30</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.30</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.30'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2009-05-09T14:49:42Z</updated>
<entry>
<title>Switch open_exec() and sys_uselib() to do_open_filp()</title>
<updated>2009-05-09T14:49:42Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-04-06T15:16:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6e8341a11eb21826b7192d0bb88cb5b44900a9af'/>
<id>urn:sha1:6e8341a11eb21826b7192d0bb88cb5b44900a9af</id>
<content type='text'>
... and make path_lookup_open() static

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Make open_exec() and sys_uselib() use may_open(), instead of duplicating its parts</title>
<updated>2009-05-09T14:49:42Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-04-06T13:38:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a44ddbb6d8a8ffe4e34e417048dfdd8f3dd1de4f'/>
<id>urn:sha1:a44ddbb6d8a8ffe4e34e417048dfdd8f3dd1de4f</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>alpha: binfmt_aout fix</title>
<updated>2009-05-02T22:36:10Z</updated>
<author>
<name>Ivan Kokshaysky</name>
<email>ink@jurassic.park.msu.ru</email>
</author>
<published>2009-04-30T22:08:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74641f584da8eccf30becfbb5507ab457187db22'/>
<id>urn:sha1:74641f584da8eccf30becfbb5507ab457187db22</id>
<content type='text'>
This fixes the problem introduced by commit 3bfacef412 (get rid of
special-casing the /sbin/loader on alpha): osf/1 ecoff binary segfaults
when binfmt_aout built as module.  That happens because aout binary
handler gets on the top of the binfmt list due to late registration, and
kernel attempts to execute the binary without preparatory work that must
be done by binfmt_loader.

Fixed by changing the registration order of the default binfmt handlers
using list_add_tail() and introducing insert_binfmt() function which
places new handler on the top of the binfmt list.  This might be generally
useful for installing arch-specific frontends for default handlers or just
for overriding them.

Signed-off-by: Ivan Kokshaysky &lt;ink@jurassic.park.msu.ru&gt;
Cc: Al Viro &lt;viro@ZenIV.linux.org.uk&gt;
Cc: Richard Henderson &lt;rth@twiddle.net
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>check_unsafe_exec: s/lock_task_sighand/rcu_read_lock/</title>
<updated>2009-04-24T14:39:45Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2009-04-23T23:02:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=437f7fdb607f32b737e4da9f14bebcfdac2c90c3'/>
<id>urn:sha1:437f7fdb607f32b737e4da9f14bebcfdac2c90c3</id>
<content type='text'>
write_lock(&amp;current-&gt;fs-&gt;lock) guarantees we can't wrongly miss
LSM_UNSAFE_SHARE, this is what we care about. Use rcu_read_lock()
instead of -&gt;siglock to iterate over the sub-threads. We must see
all CLONE_THREAD|CLONE_FS threads which didn't pass exit_fs(), it
takes fs-&gt;lock too.

With or without this patch we can miss the freshly cloned thread
and set LSM_UNSAFE_SHARE, we don't care.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Acked-by: Roland McGrath &lt;roland@redhat.com&gt;
[ Fixed lock/unlock typo  - Hugh ]
Acked-by: Hugh Dickins &lt;hugh@veritas.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>do_execve() must not clear fs-&gt;in_exec if it was set by another thread</title>
<updated>2009-04-24T14:39:45Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2009-04-23T23:01:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c652f96d3852b97a49c331cd0bb02d22f3cb31b'/>
<id>urn:sha1:8c652f96d3852b97a49c331cd0bb02d22f3cb31b</id>
<content type='text'>
If do_execve() fails after check_unsafe_exec(), it clears fs-&gt;in_exec
unconditionally. This is wrong if we race with our sub-thread which
also does do_execve:

	Two threads T1 and T2 and another process P, all share the same
	-&gt;fs.

	T1 starts do_execve(BAD_FILE). It calls check_unsafe_exec(), since
	-&gt;fs is shared, we set LSM_UNSAFE but not -&gt;in_exec.

	P exits and decrements fs-&gt;users.

	T2 starts do_execve(), calls check_unsafe_exec(), now -&gt;fs is not
	shared, we set fs-&gt;in_exec.

	T1 continues, open_exec(BAD_FILE) fails, we clear -&gt;in_exec and
	return to the user-space.

	T1 does clone(CLONE_FS /* without CLONE_THREAD */).

	T2 continues without LSM_UNSAFE_SHARE while -&gt;fs is shared with
	another process.

Change check_unsafe_exec() to return res = 1 if we set -&gt;in_exec, and change
do_execve() to clear -&gt;in_exec depending on res.

When do_execve() suceeds, it is safe to clear -&gt;in_exec unconditionally.
It can be set only if we don't share -&gt;fs with another process, and since
we already killed all sub-threads either -&gt;in_exec == 0 or we are the
only user of this -&gt;fs.

Also, we do not need fs-&gt;lock to clear fs-&gt;in_exec.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Acked-by: Roland McGrath &lt;roland@redhat.com&gt;
Acked-by: Hugh Dickins &lt;hugh@veritas.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Get rid of indirect include of fs_struct.h</title>
<updated>2009-04-01T03:00:27Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-03-29T23:50:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5ad4e53bd5406ee214ddc5a41f03f779b8b2d526'/>
<id>urn:sha1:5ad4e53bd5406ee214ddc5a41f03f779b8b2d526</id>
<content type='text'>
Don't pull it in sched.h; very few files actually need it and those
can include directly.  sched.h itself only needs forward declaration
of struct fs_struct;

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>check_unsafe_exec() doesn't care about signal handlers sharing</title>
<updated>2009-04-01T03:00:26Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-03-30T11:35:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f1191b50ec11c8e2ca766d6d99eb5bb9d2c084a3'/>
<id>urn:sha1:f1191b50ec11c8e2ca766d6d99eb5bb9d2c084a3</id>
<content type='text'>
... since we'll unshare sighand anyway

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>New locking/refcounting for fs_struct</title>
<updated>2009-04-01T03:00:26Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2009-03-30T11:20:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=498052bba55ecaff58db6a1436b0e25bfd75a7ff'/>
<id>urn:sha1:498052bba55ecaff58db6a1436b0e25bfd75a7ff</id>
<content type='text'>
* all changes of current-&gt;fs are done under task_lock and write_lock of
  old fs-&gt;lock
* refcount is not atomic anymore (same protection)
* its decrements are done when removing reference from current; at the
  same time we decide whether to free it.
* put_fs_struct() is gone
* new field - -&gt;in_exec.  Set by check_unsafe_exec() if we are trying to do
  execve() and only subthreads share fs_struct.  Cleared when finishing exec
  (success and failure alike).  Makes CLONE_FS fail with -EAGAIN if set.
* check_unsafe_exec() may fail with -EAGAIN if another execve() from subthread
  is in progress.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>fix setuid sometimes doesn't</title>
<updated>2009-03-29T00:30:00Z</updated>
<author>
<name>Hugh Dickins</name>
<email>hugh@veritas.com</email>
</author>
<published>2009-03-28T23:20:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e426b64c412aaa3e9eb3e4b261dc5be0d5a83e78'/>
<id>urn:sha1:e426b64c412aaa3e9eb3e4b261dc5be0d5a83e78</id>
<content type='text'>
Joe Malicki reports that setuid sometimes doesn't: very rarely,
a setuid root program does not get root euid; and, by the way,
they have a health check running lsof every few minutes.

Right, check_unsafe_exec() notes whether the files_struct is being
shared by more threads than will get killed by the exec, and if so
sets LSM_UNSAFE_SHARE to make bprm_set_creds() careful about euid.
But /proc/&lt;pid&gt;/fd and /proc/&lt;pid&gt;/fdinfo lookups make transient
use of get_files_struct(), which also raises that sharing count.

There's a rather simple fix for this: exec's check on files-&gt;count
has been redundant ever since 2.6.1 made it unshare_files() (except
while compat_do_execve() omitted to do so) - just remove that check.

[Note to -stable: this patch will not apply before 2.6.29: earlier
releases should just remove the files-&gt;count line from unsafe_exec().]

Reported-by: Joe Malicki &lt;jmalicki@metacarta.com&gt;
Narrowed-down-by: Michael Itz &lt;mitz@metacarta.com&gt;
Tested-by: Joe Malicki &lt;jmalicki@metacarta.com&gt;
Signed-off-by: Hugh Dickins &lt;hugh@veritas.com&gt;
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'master' into next</title>
<updated>2009-03-23T23:52:46Z</updated>
<author>
<name>James Morris</name>
<email>jmorris@namei.org</email>
</author>
<published>2009-03-23T23:52:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=703a3cd72817e99201cef84a8a7aecc60b2b3581'/>
<id>urn:sha1:703a3cd72817e99201cef84a8a7aecc60b2b3581</id>
<content type='text'>
</content>
</entry>
</feed>
