public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] error out on execve with no binfmts
@ 2004-10-28  1:43 Chris Wright
  2004-10-28  1:56 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wright @ 2004-10-28  1:43 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-28  4:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-28  1:43 [PATCH] error out on execve with no binfmts Chris Wright
2004-10-28  1:56 ` Andrew Morton
2004-10-28  4:29   ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox