All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugene Teo <eugeneteo@kernel.sg>
To: linux-kernel@vger.kernel.org
Cc: "Kawai, Hidehiro" <hidehiro.kawai.ez@hitachi.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	Bryan Wu <bryan.wu@analog.com>
Subject: [PATCH 2/3] coredump: remove suidsafe mode related dead code
Date: Tue, 31 Jul 2007 15:04:58 +0800	[thread overview]
Message-ID: <20070731070458.GC2412@kernel.sg> (raw)
In-Reply-To: <20070731070238.GA2412@kernel.sg>

This patch removes suidsafe core dump mode related dead code.

Signed-off-by: Eugene Teo <eugeneteo@kernel.sg>
---
 fs/exec.c               |   16 +---------------
 include/linux/binfmts.h |    3 ---
 2 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 7bdea79..60b4080 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1723,8 +1723,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
 	struct inode * inode;
 	struct file * file;
 	int retval = 0;
-	int fsuid = current->fsuid;
-	int flag = 0;
 	int ispipe = 0;
 
 	audit_core_dumps(signr);
@@ -1737,16 +1735,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
 		up_write(&mm->mmap_sem);
 		goto fail;
 	}
-
-	/*
-	 *	We cannot trust fsuid as being the "true" uid of the
-	 *	process nor do we know its entire history. We only know it
-	 *	was tainted so we dump it as root in mode 2.
-	 */
-	if (get_dumpable(mm) == 2) {	/* Setuid core dump mode */
-		flag = O_EXCL;		/* Stop rewrite attacks */
-		current->fsuid = 0;	/* Dump root private */
-	}
 	set_dumpable(mm, 0);
 
 	retval = coredump_wait(exit_code);
@@ -1778,8 +1766,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
  		}
  	} else
  		file = filp_open(corename,
-				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
-				 0600);
+				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE, 0600);
 	if (IS_ERR(file))
 		goto fail_unlock;
 	inode = file->f_path.dentry->d_inode;
@@ -1806,7 +1793,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
 close_fail:
 	filp_close(file, NULL);
 fail_unlock:
-	current->fsuid = fsuid;
 	complete_all(&mm->core_done);
 fail:
 	return retval;
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 91c8c07..ca75ee4 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -81,9 +81,6 @@ extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
 extern int flush_old_exec(struct linux_binprm * bprm);
 
 extern int suid_dumpable;
-#define SUID_DUMP_DISABLE	0	/* No setuid dumping */
-#define SUID_DUMP_USER		1	/* Dump as user of process */
-#define SUID_DUMP_ROOT		2	/* Dump as root */
 
 /* Stack area protections */
 #define EXSTACK_DEFAULT   0	/* Whatever the arch defaults to */


  parent reply	other threads:[~2007-07-31  7:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31  7:02 [PATCH 0/3] coredump: setuid core dump cleanups Eugene Teo
2007-07-31  7:03 ` [PATCH 1/3] coredump: cleanup documentation for suid_dumpable Eugene Teo
2007-07-31  8:13   ` Alan Cox
2007-08-01  2:31     ` Eugene Teo
2007-08-01 12:28       ` Alan Cox
2007-07-31  7:04 ` Eugene Teo [this message]
2007-07-31  8:14   ` [PATCH 2/3] coredump: remove suidsafe mode related dead code Alan Cox
2007-07-31  7:05 ` [PATCH 3/3] coredump: re-implement suid_dumpable using a flag Eugene Teo
2007-07-31  8:15   ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070731070458.GC2412@kernel.sg \
    --to=eugeneteo@kernel.sg \
    --cc=bryan.wu@analog.com \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.