On Wednesday 09 March 2011 02:58:40 Denys Vlasenko wrote:
> On Monday 07 March 2011 15:31, Tito wrote:
> > > > I see, but I guess this will not work :
> > > > 
> > > > 1) in the case of multiple busybox binaries (e.g.: one suid and one 
> > > > not, or base + extra applets)
> > > 
> > > Re-execution is used only for NOMMU tricks to create a daemonized child
> > > (in which case we always re-execute *the same applet*, and having several
> > > busyboxes is not a problem), and for standalone shell and noexec trick,
> > > both of which fall back to $PATH searching, meaning they will also
> > > woth in "multiple busyboxes" setup.
> > 
> > So lets make a little test:
> > 
> > mkdir test
> > mkdir test/bin
> > mkdir test/sbin
> > mkdir test/usr/bin
> > mkdir test/usr/sbin
> > 
> > compile a static busybox with all commands but without ls
> > compile a static busybox containing only ls
> > copy them to test/bin as busybox and busybox2
> > we do not mount proc on purpose
> > 
> > su
> > cd test
> > cd bin 
> > ln -s busybox bash
> > cd ..
> > chroot .
> > busybox --install -s
> > busybox2 --install -s
> > ls
> > /bin/bash: ls: not found
> > cd bin
> > ./ls
> > ./ls: not found
> > 
> > from another non chrooted shell
> > 
> > ls
> > lrwxrwxrwx 1 tito tito       7 2011-03-07 15:08 bash -> busybox
> > lrwxrwxrwx 1 root root      14 2011-03-07 15:09 ls -> /proc/self/exe
> > 
> > so the shell of our first busybox instance (bash)
> > calls ls by looking it up on the path as you have said
> > and founds it as link to /proc/self/exe and therefore
> > tries to rexec itself as ls rather than the other 
> > busybox(2) binary containing the ls applet.
> 
> I agree that symlinks to /proc/self/exe are useless.
> 
> What do you propose to do?
> 

Hi,
rather than fallback to bb_exec_path when xmalloc_readlink fails
promt the user about the correct full path, or remove 
completely this bb_exec_stuff from --install
code and always ask the user for the full path.
The latter is my preferred solution.

Ciao,
Tito

P.S: if you are to busy I think i could prepare this patch
as it is trivial, just let me know the way you want it fixed.

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to