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]
Date:	Wed, 10 Mar 2010 13:07:50 -0500
From:	Neil Horman <nhorman@...driver.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	David Howells <dhowells@...hat.com>,
	Roland McGrath <roland@...hat.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] wait_for_helper: SIGCHLD from user-space can lead to
 use-after-free

On Wed, Mar 10, 2010 at 06:16:34PM +0100, Oleg Nesterov wrote:
> (this patch is orthogonal to other umh changes in -mm)
> 
> 1. wait_for_helper() does allow_signal(SIGCHLD) to ensure the child can't
>    autoreap itself.
> 
>    However, this means that a spurious SIGCHILD from user-space can
>    set TIF_SIGPENDING and:
> 
>    	- kernel_thread() or sys_wait4() can fail due to signal_pending()
> 
>    	- worse, wait4() can fail before ____call_usermodehelper() execs
>    	  or exits. In this case the caller may kfree(subprocess_info)
>    	  while the child still uses this memory.
> 
>    Change the code to use SIG_DFL instead of magic "(void __user *)2"
>    set by allow_signal(). This means that SIGCHLD won't be delivered,
>    yet the child won't autoreap itsefl.
> 
>    The problem is minor, only root can send a signal to this kthread.
> 
> 2. If sys_wait4(&ret) fails it doesn't populate "ret", in this case
>    wait_for_helper() reports a random value from uninitialized var.
> 
>    With this patch sys_wait4() should never fail, but still it makes
>    sense to initialize ret = -ECHILD so that the caller can notice
>    the problem.
> 
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Acked-by: Neil Horman <nhorman@...driver.com>

> 
--
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