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:	Fri, 4 Sep 2009 12:42:30 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	torvalds@...ux-foundation.org, dhowells@...hat.com,
	roland@...hat.com, jmorris@...ei.org, tom.horsley@....net,
	linux-kernel@...r.kernel.org, stable@...nel.org
Subject: Re: [PATCH v3] exec: do not sleep in TASK_TRACED under
 ->cred_guard_mutex

On Fri, 4 Sep 2009 19:26:48 +0200
Oleg Nesterov <oleg@...hat.com> wrote:

> Tom Horsley reports that his debugger hangs when it tries to read
> /proc/pid_of_tracee/maps, this happens since
> 
> 	"mm_for_maps: take ->cred_guard_mutex to fix the race with exec"
> 	04b836cbf19e885f8366bccb2e4b0474346c02d
> 
> commit in 2.6.31.
> 
> But the root of the problem lies in the fact that do_execve() path calls
> tracehook_report_exec() which can stop if the tracer sets PT_TRACE_EXEC.
> 
> The tracee must not sleep in TASK_TRACED holding this mutex. Even if we
> remove ->cred_guard_mutex from mm_for_maps() and proc_pid_attr_write(),
> another task doing PTRACE_ATTACH should not hang until it is killed or
> the tracee resumes.
> 
> With this patch do_execve() does not use ->cred_guard_mutex directly and
> we do not hold it throughout, instead:
> 
> 	- introduce prepare_bprm_creds() helper, it locks the mutex
> 	  and calls prepare_exec_creds() to initialize bprm->cred.
> 
> 	- install_exec_creds() drops the mutex after commit_creds(),
> 	  and thus before tracehook_report_exec()->ptrace_stop().
> 
> 	  or, if exec fails,
> 
> 	  free_bprm() drops this mutex when bprm->cred != NULL which
> 	  indicates install_exec_creds() was not called.
> 
> Reported-by: Tom Horsley <tom.horsley@....net>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> Acked-by: David Howells <dhowells@...hat.com>

I get a reject in binfmts.h because your kernel has `extern void
set_binfmt' and mine has `extern int set_binfmt'.

Hopefully this patch works OK in mainline as well as in whatever kernel
you tested against!

I see a Cc:stable in the mail headers, but not in the changelog.  I
don't think the patch is applicable to -stable unless we miss 2.6.31.

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