All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][Resend v2] Fix infinite loop in search_binary_handler()
@ 2011-07-04 11:30 Richard Weinberger
  2011-07-04 11:51 ` Tetsuo Handa
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Weinberger @ 2011-07-04 11:30 UTC (permalink / raw)
  To: viro; +Cc: akpm, linux-kernel, linux-fsdevel, Richard Weinberger

When search_binary_handler() is called to find a handler
for /sbin/modprobe it will end up in an infinite loop because
it executes request_module() to load a binfmt module with
/sbin/modprobe...

Running a x86_64 kernel without ia32 emulation and a x86 user land
triggers this issue.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/exec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 97e0d52..7271b22 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1411,7 +1411,10 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
 			    printable(bprm->buf[2]) &&
 			    printable(bprm->buf[3]))
 				break; /* -ENOEXEC */
-			request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
+
+			/* Avoid an infinite loop */
+			if (strcmp(modprobe_path, bprm->filename))
+				request_module("binfmt-%04x", *(unsigned short *)(&bprm->buf[2]));
 #endif
 		}
 	}
-- 
1.7.5.4


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

end of thread, other threads:[~2011-07-07  4:06 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-04 11:30 [PATCH][Resend v2] Fix infinite loop in search_binary_handler() Richard Weinberger
2011-07-04 11:51 ` Tetsuo Handa
2011-07-04 11:57   ` Richard Weinberger
2011-07-04 12:10     ` Tetsuo Handa
2011-07-04 12:20       ` Richard Weinberger
2011-07-04 14:42         ` Tetsuo Handa
2011-07-04 14:59           ` Richard Weinberger
2011-07-04 15:07             ` Richard Weinberger
2011-07-04 22:03               ` Tetsuo Handa
2011-07-04 22:17                 ` Richard Weinberger
2011-07-05  1:24                   ` Tetsuo Handa
2011-07-05  9:55                     ` Richard Weinberger
2011-07-05 12:02                       ` Tetsuo Handa
2011-07-05 12:21                         ` Richard Weinberger
2011-07-06 11:28                           ` Tetsuo Handa
2011-07-06 11:36                             ` Richard Weinberger
2011-07-06 20:21                             ` Andrew Morton
2011-07-07  4:04                               ` Tetsuo Handa

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.