[PATCH] do_coredump() and not stopping rewrite attacks? (CVE-2006-6304)
commita526d58e9f362189b49a3ca73315101ff0fc1dc1
authorAlexey Dobriyan <adobriyan@gmail.com>
Sat, 2 Dec 2006 20:58:49 +0000 (2 23:58 +0300)
committerChris Wright <chrisw@sous-sol.org>
Mon, 11 Dec 2006 19:32:39 +0000 (11 11:32 -0800)
treed1c6ed597b480b6bf99c34f25d5531f95578c7dc
parent68057dcdf944f5801af3692c63e1f193e0f1a818
[PATCH] do_coredump() and not stopping rewrite attacks? (CVE-2006-6304)

On Sat, Dec 02, 2006 at 11:47:44PM +0300, Alexey Dobriyan wrote:
> David Binderman compiled 2.6.19 with icc and grepped for "was set but never
> used". Many warnings are on
>  http://coderock.org/kj/unused-2.6.19-fs

Heh, the very first line:
fs/exec.c(1465): remark #593: variable "flag" was set but never used

fs/exec.c:
  1477 /*
  1478  * We cannot trust fsuid as being the "true" uid of the
  1479  * process nor do we know its entire history. We only know it
  1480  * was tainted so we dump it as root in mode 2.
  1481  */
  1482 if (mm->dumpable == 2) { /* Setuid core dump mode */
  1483 flag = O_EXCL; /* Stop rewrite attacks */
  1484 current->fsuid = 0; /* Dump root private */
  1485 }

And then filp_open follows with "flag" totally ignored.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
fs/exec.c