From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Weinberger Subject: [PATCH][Resend] Fix infinite loop in search_binary_handler() Date: Mon, 27 Jun 2011 23:17:04 +0200 Message-ID: <1309209424-32679-1-git-send-email-richard@nod.at> Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Weinberger To: viro@zeniv.linux.org.uk Return-path: Received: from a.ns.miles-group.at ([95.130.255.143]:48996 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754326Ab1F0VRY (ORCPT ); Mon, 27 Jun 2011 17:17:24 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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