public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] error out on execve with no binfmts
Date: Wed, 27 Oct 2004 18:43:39 -0700	[thread overview]
Message-ID: <20041027184339.M2357@build.pdx.osdl.net> (raw)

Early calls to userspace can invoke an execve() before any binfmt handlers
are registered.  Properly return an error in this case rather than 0.
On at least one arch (x86_64) without this patch, the system will double
fault on early attempts to call_usermodehelper.  Suggestions on a better
error?

Signed-off-by: Chris Wright <chrisw@osdl.org>

===== fs/exec.c 1.142 vs edited =====
--- 1.142/fs/exec.c	2004-10-22 21:23:42 -07:00
+++ edited/fs/exec.c	2004-10-27 18:11:54 -07:00
@@ -984,7 +984,7 @@
  */
 int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
 {
-	int try,retval=0;
+	int try,retval;
 	struct linux_binfmt *fmt;
 #ifdef __alpha__
 	/* handle /sbin/loader.. */
@@ -1028,6 +1028,7 @@
 	/* kernel module loader fixup */
 	/* so we don't try to load run modprobe in kernel space. */
 	set_fs(USER_DS);
+	retval = -ENOENT;
 	for (try=0; try<2; try++) {
 		read_lock(&binfmt_lock);
 		for (fmt = formats ; fmt ; fmt = fmt->next) {

             reply	other threads:[~2004-10-28  1:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-28  1:43 Chris Wright [this message]
2004-10-28  1:56 ` [PATCH] error out on execve with no binfmts Andrew Morton
2004-10-28  4:29   ` Chris Wright

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=20041027184339.M2357@build.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox