<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/exec.c, branch v2.6.35.9</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs/exec.c?h=v2.6.35.9</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs/exec.c?h=v2.6.35.9'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2010-10-29T04:51:47Z</updated>
<entry>
<title>execve: make responsive to SIGKILL with large arguments</title>
<updated>2010-10-29T04:51:47Z</updated>
<author>
<name>Roland McGrath</name>
<email>roland@redhat.com</email>
</author>
<published>2010-09-08T02:37:06Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e4037861387fe89ac082e8cf092b6a7bada09cb5'/>
<id>urn:sha1:e4037861387fe89ac082e8cf092b6a7bada09cb5</id>
<content type='text'>
commit 9aea5a65aa7a1af9a4236dfaeb0088f1624f9919 upstream.

An execve with a very large total of argument/environment strings
can take a really long time in the execve system call.  It runs
uninterruptibly to count and copy all the strings.  This change
makes it abort the exec quickly if sent a SIGKILL.

Note that this is the conservative change, to interrupt only for
SIGKILL, by using fatal_signal_pending().  It would be perfectly
correct semantics to let any signal interrupt the string-copying in
execve, i.e. use signal_pending() instead of fatal_signal_pending().
We'll save that change for later, since it could have user-visible
consequences, such as having a timer set too quickly make it so that
an execve can never complete, though it always happened to work before.

Signed-off-by: Roland McGrath &lt;roland@redhat.com&gt;
Reviewed-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Cc: Chuck Ebbert &lt;cebbert@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;

</content>
</entry>
<entry>
<title>execve: improve interactivity with large arguments</title>
<updated>2010-10-29T04:51:46Z</updated>
<author>
<name>Roland McGrath</name>
<email>roland@redhat.com</email>
</author>
<published>2010-09-08T02:36:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c7d3b6415c472deae3fab07d06239abba9070c93'/>
<id>urn:sha1:c7d3b6415c472deae3fab07d06239abba9070c93</id>
<content type='text'>
commit 7993bc1f4663c0db67bb8f0d98e6678145b387cd upstream.

This adds a preemption point during the copying of the argument and
environment strings for execve, in copy_strings().  There is already
a preemption point in the count() loop, so this doesn't add any new
points in the abstract sense.

When the total argument+environment strings are very large, the time
spent copying them can be much more than a normal user time slice.
So this change improves the interactivity of the rest of the system
when one process is doing an execve with very large arguments.

Signed-off-by: Roland McGrath &lt;roland@redhat.com&gt;
Reviewed-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Chuck Ebbert &lt;cebbert@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>setup_arg_pages: diagnose excessive argument size</title>
<updated>2010-10-29T04:51:46Z</updated>
<author>
<name>Roland McGrath</name>
<email>roland@redhat.com</email>
</author>
<published>2010-09-08T02:35:49Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a376eaa89e3931a4088deb6ef5d94569688efec0'/>
<id>urn:sha1:a376eaa89e3931a4088deb6ef5d94569688efec0</id>
<content type='text'>
commit 1b528181b2ffa14721fb28ad1bd539fe1732c583 upstream.

The CONFIG_STACK_GROWSDOWN variant of setup_arg_pages() does not
check the size of the argument/environment area on the stack.
When it is unworkably large, shift_arg_pages() hits its BUG_ON.
This is exploitable with a very large RLIMIT_STACK limit, to
create a crash pretty easily.

Check that the initial stack is not too large to make it possible
to map in any executable.  We're not checking that the actual
executable (or intepreter, for binfmt_elf) will fit.  So those
mappings might clobber part of the initial stack mapping.  But
that is just userland lossage that userland made happen, not a
kernel problem.

Signed-off-by: Roland McGrath &lt;roland@redhat.com&gt;
Reviewed-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Chuck Ebbert &lt;cebbert@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>exit: avoid sig-&gt;count in de_thread/__exit_signal synchronization</title>
<updated>2010-05-27T16:12:46Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2010-05-26T21:43:11Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d344193a05da89c97e965da2c5cbf687d7385eae'/>
<id>urn:sha1:d344193a05da89c97e965da2c5cbf687d7385eae</id>
<content type='text'>
de_thread() and __exit_signal() use signal_struct-&gt;count/notify_count for
synchronization.  We can simplify the code and use -&gt;notify_count only.
Instead of comparing these two counters, we can change de_thread() to set
-&gt;notify_count = nr_of_sub_threads, then change __exit_signal() to
dec-and-test this counter and notify group_exit_task.

Note that __exit_signal() checks "notify_count &gt; 0" just for symmetry with
exit_notify(), we could just check it is != 0.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Acked-by: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Veaceslav Falico &lt;vfalico@redhat.com&gt;
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>coredump: shift down_write(mmap_sem) into coredump_wait()</title>
<updated>2010-05-27T16:12:45Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2010-05-26T21:43:08Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=269b005a28e124a341df4adef2c3661cf7371fcc'/>
<id>urn:sha1:269b005a28e124a341df4adef2c3661cf7371fcc</id>
<content type='text'>
- move the cprm.mm_flags checks up, before we take mmap_sem

- move down_write(mmap_sem) and -&gt;core_state check from do_coredump()
  to coredump_wait()

This simplifies the code and makes the locking symmetrical.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
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>coredump: factor out put_cred() calls</title>
<updated>2010-05-27T16:12:45Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2010-05-26T21:43:07Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5e43aef530ba39206f7923295388f7ec3c5a7d93'/>
<id>urn:sha1:5e43aef530ba39206f7923295388f7ec3c5a7d93</id>
<content type='text'>
Given that do_coredump() calls put_cred() on exit path, it is a bit ugly
to do put_cred() + "goto fail" twice, just add the new "fail_creds" label.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
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>coredump: cleanup "ispipe" code</title>
<updated>2010-05-27T16:12:45Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2010-05-26T21:43:06Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d5bf4c4f5f9dcc90b7e25dbb2f7c4436cf6e7ed0'/>
<id>urn:sha1:d5bf4c4f5f9dcc90b7e25dbb2f7c4436cf6e7ed0</id>
<content type='text'>
- kill "int dump_count", argv_split(argcp) accepts argcp == NULL.

- move "int dump_count" under " if (ispipe)" branch, fail_dropcount
  can check ispipe.

- move "char **helper_argv" as well, change the code to do argv_free()
  right after call_usermodehelper_fns().

- If call_usermodehelper_fns() fails goto close_fail label instead
  of closing the file by hand.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
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>coredump: factor out the not-ispipe file checks</title>
<updated>2010-05-27T16:12:45Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2010-05-26T21:43:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c713541125002b8bc9e681af3b09118e771e2d8a'/>
<id>urn:sha1:c713541125002b8bc9e681af3b09118e771e2d8a</id>
<content type='text'>
do_coredump() does a lot of file checks after it opens the file or calls
usermode helper.  But all of these checks are only needed in !ispipe case.

Move this code into the "else" branch and kill the ugly repetitive ispipe
checks.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Cc: Roland McGrath &lt;roland@redhat.com&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
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>exec: replace call_usermodehelper_pipe with use of umh init function and resolve limit</title>
<updated>2010-05-27T16:12:44Z</updated>
<author>
<name>Neil Horman</name>
<email>nhorman@tuxdriver.com</email>
</author>
<published>2010-05-26T21:42:59Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=898b374af6f71041bd3bceebe257e564f3f1d458'/>
<id>urn:sha1:898b374af6f71041bd3bceebe257e564f3f1d458</id>
<content type='text'>
The first patch in this series introduced an init function to the
call_usermodehelper api so that processes could be customized by caller.
This patch takes advantage of that fact, by customizing the helper in
do_coredump to create the pipe and set its core limit to one (for our
recusrsion check).  This lets us clean up the previous uglyness in the
usermodehelper internals and factor call_usermodehelper out entirely.
While I'm at it, we can also modify the helper setup to look for a core
limit value of 1 rather than zero for our recursion check

Signed-off-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Reviewed-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
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>mm: migration: avoid race between shift_arg_pages() and rmap_walk() during migration by not migrating temporary stacks</title>
<updated>2010-05-25T15:06:59Z</updated>
<author>
<name>Mel Gorman</name>
<email>mel@csn.ul.ie</email>
</author>
<published>2010-05-24T21:32:24Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a8bef8ff6ea15fa4c67433cab0f5f3484574ef7c'/>
<id>urn:sha1:a8bef8ff6ea15fa4c67433cab0f5f3484574ef7c</id>
<content type='text'>
Page migration requires rmap to be able to find all ptes mapping a page
at all times, otherwise the migration entry can be instantiated, but it
is possible to leave one behind if the second rmap_walk fails to find
the page.  If this page is later faulted, migration_entry_to_page() will
call BUG because the page is locked indicating the page was migrated by
the migration PTE not cleaned up. For example

  kernel BUG at include/linux/swapops.h:105!
  invalid opcode: 0000 [#1] PREEMPT SMP
  ...
  Call Trace:
   [&lt;ffffffff810e951a&gt;] handle_mm_fault+0x3f8/0x76a
   [&lt;ffffffff8130c7a2&gt;] do_page_fault+0x44a/0x46e
   [&lt;ffffffff813099b5&gt;] page_fault+0x25/0x30
   [&lt;ffffffff8114de33&gt;] load_elf_binary+0x152a/0x192b
   [&lt;ffffffff8111329b&gt;] search_binary_handler+0x173/0x313
   [&lt;ffffffff81114896&gt;] do_execve+0x219/0x30a
   [&lt;ffffffff8100a5c6&gt;] sys_execve+0x43/0x5e
   [&lt;ffffffff8100320a&gt;] stub_execve+0x6a/0xc0
  RIP  [&lt;ffffffff811094ff&gt;] migration_entry_wait+0xc1/0x129

There is a race between shift_arg_pages and migration that triggers this
bug.  A temporary stack is setup during exec and later moved.  If
migration moves a page in the temporary stack and the VMA is then removed
before migration completes, the migration PTE may not be found leading to
a BUG when the stack is faulted.

This patch causes pages within the temporary stack during exec to be
skipped by migration.  It does this by marking the VMA covering the
temporary stack with an otherwise impossible combination of VMA flags.
These flags are cleared when the temporary stack is moved to its final
location.

[kamezawa.hiroyu@jp.fujitsu.com: idea for having migration skip temporary stacks]
Signed-off-by: Mel Gorman &lt;mel@csn.ul.ie&gt;
Reviewed-by: KAMEZAWA Hiroyuki &lt;kamezawa.hiroyu@jp.fujitsu.com&gt;
Reviewed-by: Rik van Riel &lt;riel@redhat.com&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Minchan Kim &lt;minchan.kim@gmail.com&gt;
Cc: Christoph Lameter &lt;cl@linux.com&gt;
Cc: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Cc: Rik van Riel &lt;riel@redhat.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Reviewed-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
