<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/kmod.c, branch linux-2.6.32.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.32.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.32.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-05-19T05:53:14Z</updated>
<entry>
<title>kernel/kmod.c: check for NULL in call_usermodehelper_exec()</title>
<updated>2014-05-19T05:53:14Z</updated>
<author>
<name>Tetsuo Handa</name>
</author>
<published>2013-09-30T20:45:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=023ae3b03883fab864e2ca8d801cdae83938713a'/>
<id>urn:sha1:023ae3b03883fab864e2ca8d801cdae83938713a</id>
<content type='text'>
If /proc/sys/kernel/core_pattern contains only "|", a NULL pointer
dereference happens upon core dump because argv_split("") returns
argv[0] == NULL.

This bug was once fixed by commit 264b83c07a84 ("usermodehelper: check
subprocess_info-&gt;path != NULL") but was by error reintroduced by commit
7f57cfa4e2aa ("usermodehelper: kill the sub_info-&gt;path[0] check").

This bug seems to exist since 2.6.19 (the version which core dump to
pipe was added).  Depending on kernel version and config, some side
effect might happen immediately after this oops (e.g.  kernel panic with
2.6.32-358.18.1.el6).

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Acked-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
(cherry picked from commit 4c1c7be95c345cf2ad537a0c48e9aeadc7304527)
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>kmod: make __request_module() killable</title>
<updated>2013-06-10T09:42:17Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2012-03-23T22:02:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ec4808e70c93b17965a7c6de9f243eceb02389a9'/>
<id>urn:sha1:ec4808e70c93b17965a7c6de9f243eceb02389a9</id>
<content type='text'>
commit 1cc684ab75123efe7ff446eb821d44375ba8fa30 upstream

As Tetsuo Handa pointed out, request_module() can stress the system
while the oom-killed caller sleeps in TASK_UNINTERRUPTIBLE.

The task T uses "almost all" memory, then it does something which
triggers request_module().  Say, it can simply call sys_socket().  This
in turn needs more memory and leads to OOM.  oom-killer correctly
chooses T and kills it, but this can't help because it sleeps in
TASK_UNINTERRUPTIBLE and after that oom-killer becomes "disabled" by the
TIF_MEMDIE task T.

Make __request_module() killable.  The only necessary change is that
call_modprobe() should kmalloc argv and module_name, they can't live in
the stack if we use UMH_KILLABLE.  This memory is freed via
call_usermodehelper_freeinfo()-&gt;cleanup.

Reported-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[dannf, bwh: backported to Debian's 2.6.32]
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>kmod: introduce call_modprobe() helper</title>
<updated>2013-06-10T09:42:16Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2012-03-23T22:02:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d5734d32817bb3a425eee4b1f5b9be78e9a8684d'/>
<id>urn:sha1:d5734d32817bb3a425eee4b1f5b9be78e9a8684d</id>
<content type='text'>
commit 3e63a93b987685f02421e18b2aa452d20553a88b upstream

No functional changes.  Move the call_usermodehelper code from
__request_module() into the new simple helper, call_modprobe().

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[dannf: backported to Debian's 2.6.32]
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>usermodehelper: ____call_usermodehelper() doesn't need do_exit()</title>
<updated>2013-06-10T09:42:16Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2012-03-23T22:02:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67fd05cc8b160538a9da654758c45e0295272c47'/>
<id>urn:sha1:67fd05cc8b160538a9da654758c45e0295272c47</id>
<content type='text'>
commit 5b9bd473e3b8a8c6c4ae99be475e6e9b27568555 upstream

Minor cleanup.  ____call_usermodehelper() can simply return, no need to
call do_exit() explicitely.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[dannf: adjusted to apply to Debian's 2.6.32]
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>usermodehelper: implement UMH_KILLABLE</title>
<updated>2013-06-10T09:42:15Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2012-03-23T22:02:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e2a28e9a9f98d9a73ea5ce58328595dcab64a1f6'/>
<id>urn:sha1:e2a28e9a9f98d9a73ea5ce58328595dcab64a1f6</id>
<content type='text'>
commit d0bd587a80960d7ba7e0c8396e154028c9045c54 upstream

Implement UMH_KILLABLE, should be used along with UMH_WAIT_EXEC/PROC.
The caller must ensure that subprocess_info-&gt;path/etc can not go away
until call_usermodehelper_freeinfo().

call_usermodehelper_exec(UMH_KILLABLE) does
wait_for_completion_killable.  If it fails, it uses
xchg(&amp;sub_info-&gt;complete, NULL) to serialize with umh_complete() which
does the same xhcg() to access sub_info-&gt;complete.

If call_usermodehelper_exec wins, it can safely return.  umh_complete()
should get NULL and call call_usermodehelper_freeinfo().

Otherwise we know that umh_complete() was already called, in this case
call_usermodehelper_exec() falls back to wait_for_completion() which
should succeed "very soon".

Note: UMH_NO_WAIT == -1 but it obviously should not be used with
UMH_KILLABLE.  We delay the neccessary cleanup to simplify the back
porting.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[dannf: backported to Debian's 2.6.32]
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>usermodehelper: introduce umh_complete(sub_info)</title>
<updated>2013-06-10T09:42:15Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2012-03-23T22:02:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=13db73535cc63e0034b901a287cf5bb20919825b'/>
<id>urn:sha1:13db73535cc63e0034b901a287cf5bb20919825b</id>
<content type='text'>
commit b3449922502f5a161ee2b5022a33aec8472fbf18 upstream

Preparation.  Add the new trivial helper, umh_complete().  Currently it
simply does complete(sub_info-&gt;complete).

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
[dannf: Adjusted to apply to Debian's 2.6.32]
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled()</title>
<updated>2012-03-04T17:49:23Z</updated>
<author>
<name>Srivatsa S. Bhat</name>
</author>
<published>2012-02-29T06:54:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0707a9cd9c31b1d831c459469387943978292ff4'/>
<id>urn:sha1:0707a9cd9c31b1d831c459469387943978292ff4</id>
<content type='text'>
[ Upstream commit b298d289c79211508f11cb50749b0d1d54eb244a ]

Commit a144c6a (PM: Print a warning if firmware is requested when tasks
are frozen) introduced usermodehelper_is_disabled() to warn and exit
immediately if firmware is requested when usermodehelpers are disabled.

However, it is racy. Consider the following scenario, currently used in
drivers/base/firmware_class.c:

...
if (usermodehelper_is_disabled())
        goto out;

/* Do actual work */
...

out:
        return err;

Nothing prevents someone from disabling usermodehelpers just after the check
in the 'if' condition, which means that it is quite possible to try doing the
"actual work" with usermodehelpers disabled, leading to undesirable
consequences.

In particular, this race condition in _request_firmware() causes task freezing
failures whenever suspend/hibernation is in progress because, it wrongly waits
to get the firmware/microcode image from userspace when actually the
usermodehelpers are disabled or userspace has been frozen.
Some of the example scenarios that cause freezing failures due to this race
are those that depend on userspace via request_firmware(), such as x86
microcode module initialization and microcode image reload.

Previous discussions about this issue can be found at:
http://thread.gmane.org/gmane.linux.kernel/1198291/focus=1200591

This patch adds proper synchronization to fix this issue.

It is to be noted that this patchset fixes the freezing failures but doesn't
remove the warnings. IOW, it does not attempt to add explicit synchronization
to x86 microcode driver to avoid requesting microcode image at inopportune
moments. Because, the warnings were introduced to highlight such cases, in the
first place. And we need not silence the warnings, since we take care of the
*real* problem (freezing failure) and hence, after that, the warnings are
pretty harmless anyway.

Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>PM: Print a warning if firmware is requested when tasks are frozen</title>
<updated>2012-03-04T17:49:23Z</updated>
<author>
<name>Rafael J. Wysocki</name>
</author>
<published>2012-02-29T06:52:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4e5c29cfbc26e6ebb93c54d1652f41d90d6a8843'/>
<id>urn:sha1:4e5c29cfbc26e6ebb93c54d1652f41d90d6a8843</id>
<content type='text'>
[ Upstream commit a144c6a6c924aa1da04dd77fb84b89927354fdff ]

Some drivers erroneously use request_firmware() from their -&gt;resume()
(or -&gt;thaw(), or -&gt;restore()) callbacks, which is not going to work
unless the firmware has been built in.  This causes system resume to
stall until the firmware-loading timeout expires, which makes users
think that the resume has failed and reboot their machines
unnecessarily.  For this reason, make _request_firmware() print a
warning and return immediately with error code if it has been called
when tasks are frozen and it's impossible to start any new usermode
helpers.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
Reviewed-by: Valdis Kletnieks &lt;valdis.kletnieks@vt.edu&gt;
Signed-off-by: Srivatsa S. Bhat &lt;srivatsa.bhat@linux.vnet.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kmod: prevent kmod_loop_msg overflow in __request_module()</title>
<updated>2011-11-07T20:32:27Z</updated>
<author>
<name>Jiri Kosina</name>
</author>
<published>2011-10-26T02:40:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d3e486fb80b593cdb04d240b2cadaf8c40dd863'/>
<id>urn:sha1:4d3e486fb80b593cdb04d240b2cadaf8c40dd863</id>
<content type='text'>
commit 37252db6aa576c34fd794a5a54fb32d7a8b3a07a upstream.

Due to post-increment in condition of kmod_loop_msg in __request_module(),
the system log can be spammed by much more than 5 instances of the 'runaway
loop' message if the number of events triggering it makes the kmod_loop_msg
to overflow.

Fix that by making sure we never increment it past the threshold.

Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Revert "kmod: fix race in usermodehelper code"</title>
<updated>2009-09-24T01:12:10Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
</author>
<published>2009-09-23T23:02:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95e0d86badc410d525ea7218fd32df7bfbf9c837'/>
<id>urn:sha1:95e0d86badc410d525ea7218fd32df7bfbf9c837</id>
<content type='text'>
This reverts commit c02e3f361c7 ("kmod: fix race in usermodehelper code")

The patch is wrong.  UMH_WAIT_EXEC is called with VFORK what ensures
that the child finishes prior returing back to the parent.  No race.

In fact, the patch makes it even worse because it does the thing it
claims not do:

 - It calls -&gt;complete() on UMH_WAIT_EXEC

 - the complete() callback may de-allocated subinfo as seen in the
   following call chain:

    [&lt;c009f904&gt;] (__link_path_walk+0x20/0xeb4) from [&lt;c00a094c&gt;] (path_walk+0x48/0x94)
    [&lt;c00a094c&gt;] (path_walk+0x48/0x94) from [&lt;c00a0a34&gt;] (do_path_lookup+0x24/0x4c)
    [&lt;c00a0a34&gt;] (do_path_lookup+0x24/0x4c) from [&lt;c00a158c&gt;] (do_filp_open+0xa4/0x83c)
    [&lt;c00a158c&gt;] (do_filp_open+0xa4/0x83c) from [&lt;c009ba90&gt;] (open_exec+0x24/0xe0)
    [&lt;c009ba90&gt;] (open_exec+0x24/0xe0) from [&lt;c009bfa8&gt;] (do_execve+0x7c/0x2e4)
    [&lt;c009bfa8&gt;] (do_execve+0x7c/0x2e4) from [&lt;c0026a80&gt;] (kernel_execve+0x34/0x80)
    [&lt;c0026a80&gt;] (kernel_execve+0x34/0x80) from [&lt;c004b514&gt;] (____call_usermodehelper+0x130/0x148)
    [&lt;c004b514&gt;] (____call_usermodehelper+0x130/0x148) from [&lt;c0024858&gt;] (kernel_thread_exit+0x0/0x8)

   and the path pointer was NULL.  Good that ARM's kernel_execve()
   doesn't check the pointer for NULL or else I wouldn't notice it.

The only race there might be is with UMH_NO_WAIT but it is too late for
me to investigate it now.  UMH_WAIT_PROC could probably also use VFORK
and we could save one exec.  So the only race I see is with UMH_NO_WAIT
and recent scheduler changes where the child does not always run first
might have trigger here something but as I said, it is late....

Signed-off-by: Sebastian Andrzej Siewior &lt;sebastian@breakpoint.cc&gt;
Acked-by: Neil Horman &lt;nhorman@tuxdriver.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
