[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <812529.11018.qm@web110312.mail.gq1.yahoo.com>
Date: Thu, 11 Mar 2010 02:56:16 -0800 (PST)
From: Valery Reznic <valery_reznic@...oo.com>
To: linux-kernel@...r.kernel.org
Subject: execve for script don't return ENOEXEC, bug ?
Hi,
I Have following to scripts:
a.sh
#!/bin/sh
echo "It's a.sh
and b.sh:
#! ./b.sh
echo "It's b.sh"
As per execve man page, script interpreter should not be script itself.
When I run it on my Fedora 8 x86_64 box (with stock kernel, never updated)
under strace I got following:
strace -f -e execve setarch x86_64 ./b.sh
execve("/usr/bin/setarch", ["setarch", "x86_64", "./b.sh"], [/* 23 vars */]) = 0
execve("./b.sh", ["./b.sh"], [/* 23 vars */]) = -1 ENOEXEC (Exec format error)
execve("/bin/sh", ["/bin/sh", "./b.sh"], [/* 23 vars */]) = 0
It's b.sh
I.e execve failed as it should
When I run same scripts on Fedora 12 x86_64 box with stock kernel 2.6.31.5-127.fc12.x86_64 I got following:
strace -f -e execve setarch i386 ./b.sh
execve("/usr/bin/setarch", ["setarch", "i386", "./b.sh"], [/* 41 vars */]) = 0
execve("./b.sh", ["./b.sh"], [/* 41 vars */]) = 0
It's a.sh
I.e execve succeeded, instead of failing with ENOEXEC
Regards,
Valery.
P.S. I am not subscribed to this list, so please CC me
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists