jailkit-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Jailkit-users] problems running commands, differing ldd output


From: Tzvi Edelman
Subject: Re: [Jailkit-users] problems running commands, differing ldd output
Date: Tue, 29 Apr 2014 20:02:49 +0300

Hi Oliver, thanks for joining in.

Those are interesting questions.

##############################################
# non-jail session:
$ ldd /bin/grep | fmt -1 | grep / | sort
        /lib/arm-linux-gnueabihf/ld-linux.so.3
        /lib/arm-linux-gnueabihf/libc.so.6
        /lib/arm-linux-gnueabihf/libdl.so.2
        /lib/arm-linux-gnueabihf/libgcc_s.so.1
        /lib/ld-linux-armhf.so.3
        /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so

$ ls -lL /bin/grep /lib/arm-linux-gnueabihf/{ld-linux.so.3,libc.so.6,libdl.so.2,libgcc_s.so.1} /lib/ld-linux-armhf.so.3 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
-rwxr-xr-x 1 root root  149536 May 27  2012 /bin/grep
-rwxr-xr-x 1 root root  126236 Feb 23  2013 /lib/arm-linux-gnueabihf/ld-linux.so.3
-rwxr-xr-x 1 root root 1196144 Feb 23  2013 /lib/arm-linux-gnueabihf/libc.so.6
-rw-r--r-- 1 root root    9812 Feb 23  2013 /lib/arm-linux-gnueabihf/libdl.so.2
-rw-r--r-- 1 root root  131372 Jan 19  2013 /lib/arm-linux-gnueabihf/libgcc_s.so.1
-rwxr-xr-x 1 root root  126236 Feb 23  2013 /lib/ld-linux-armhf.so.3
-rwxr-xr-x 1 2625 2625   10170 Mar 26  2013 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so

##############################################
# jailed session:
$ ls -lL /bin/grep /lib/arm-linux-gnueabihf/{ld-linux.so.3,libc.so.6,libdl.so.2,libgcc_s.so.1} /lib/ld-linux-armhf.so.3 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
ls: cannot access /lib/arm-linux-gnueabihf/ld-linux.so.3: No such file or directory
-rwxr-xr-x 1 root root  149536 May 27  2012 /bin/grep
-rwxr-xr-x 1 root root 1196144 Feb 23  2013 /lib/arm-linux-gnueabihf/libc.so.6
-rw-r--r-- 1 root root    9812 Feb 23  2013 /lib/arm-linux-gnueabihf/libdl.so.2
-rw-r--r-- 1 root root  131372 Jan 19  2013 /lib/arm-linux-gnueabihf/libgcc_s.so.1
-rwxr-xr-x 1 root root  126236 Feb 23  2013 /lib/ld-linux-armhf.so.3
-rwxr-xr-x 1 root root   10170 Mar 26  2013 /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so

WHOA!
ls: cannot access /lib/arm-linux-gnueabihf/ld-linux.so.3: No such file or directory

After I copy ld-linux.so.3 over with 
$ jk_cp -j $JAIL /lib/arm-linux-gnueabihf/ld-linux.so.3

everything works!

So, now the interesting question is:

  Why did this ld-linux.so.3 get left out?

Any thoughts on that?

Thanks - Tzvi.

--
Tzvi Edelman cell:+972-50-849-8805  <address@hidden> H.323:tevid.no-ip.biz


On Mon, Apr 28, 2014 at 9:30 PM, Olivier Sessink <address@hidden> wrote:
On 04/27/2014 08:51 PM, Tzvi Edelman wrote:
> Hi Rich, thanks for taking a whack at this.
>
> Running `which grep` does return "/bin/grep".
>
> Here is my PATH:
>   PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>
> Running `ls -l /bin/grep` returns
>   -rwxr-xr-x 1 root root 149536 May 27  2012 /bin/grep
>
> I'm really curious why the execve fails with ENOENT.
>
> # strace from the bash session in which I invoked grep
> /tmp/trace-20140426-213214.15117:write(2, "\10\10\10\10\10\10grep
> qtest /etc/passwd ", 29) = 29
>
> # strace from the process attempting to launch grep (filtered for "grep")
> /tmp/trace-20140426-213214.15274:execve("/bin/grep", ["grep", "qtest",
> "/etc/passwd"], [/* 7 vars */]) = -1 ENOENT (No such file or directory)
> /tmp/trace-20140426-213214.15274:stat64("/bin/grep",
> {st_mode=S_IFREG|0755, st_size=149536, ...}) = 0
> /tmp/trace-20140426-213214.15274:stat64("/bin/grep",
> {st_mode=S_IFREG|0755, st_size=149536, ...}) = 0
> /tmp/trace-20140426-213214.15274:stat64("/bin/grep",
> {st_mode=S_IFREG|0755, st_size=149536, ...}) = 0
> /tmp/trace-20140426-213214.15274:access("/bin/grep", X_OK)
>   = 0
> /tmp/trace-20140426-213214.15274:stat64("/bin/grep",
> {st_mode=S_IFREG|0755, st_size=149536, ...}) = 0
> /tmp/trace-20140426-213214.15274:access("/bin/grep", R_OK)
>   = 0
> /tmp/trace-20140426-213214.15274:open("/bin/grep",
> O_RDONLY|O_LARGEFILE) = 3
> /tmp/trace-20140426-213214.15274:write(2, "bash: /bin/grep: No such
> file or"..., 43) = 43
>
> Do any of you any ideas about execve failure?

just guessing:

could it be a permissions problem on the executable or any of it's
libraries?

Or perhaps there is a 'noexec' mount option used somewhere where the
binary is located?

Olivier


--
Bluefish website http://bluefish.openoffice.nl/
Blog http://oli4444.wordpress.com/


_______________________________________________
Jailkit-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/jailkit-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]