On Tuesday 07 July 2009 21:45, Tito wrote:
> Hi,
> I'm experiencing a strange behaviour of busybox.
> I'm trying to use upx on an android g1 phone.
> So far I was able to cross-compile a statically linked 
> and working copy of upx
> upx compresses the executables on the phone just fine,
> only busybox seems not to work as expected.
> upx compresses it but when the compressed
> busybox is launched it runs the command as
> expected but never returns to the shell unless it is killed.
> The only suspect log i can see after killing it is:
> 
> <3>[ 3261.966003] init: untracked pid 5064 exited
> <3>[ 3290.064056] init: untracked pid 5066 exited
> <3>[ 3339.908325] init: untracked pid 5069 exited
> 
> Any hints about what is going wrong here?
> 
> BTW: busybox packed with upx on x86 works.
> 
> /system/sd # ./upx busybox
>                        Ultimate Packer for eXecutables
>                           Copyright (C) 1996 - 2009
> UPX 3.04        Markus Oberhumer, Laszlo Molnar & John Reiser   Apr 27th 2009
> 
>         File size         Ratio      Format      Name
>    --------------------   ------   -----------   -----------
>     690276 ->    381428   55.26%   linux/armel   busybox
> 
> Packed 1 file.
> /system/sd # ./busybox
> BusyBox v1.14.2 (2009-07-01 18:27:27 EDT) multi-call binary
> Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
> and others. Licensed under GPLv2.
> See source distribution for full notice.
> 
> Usage: busybox [function] [arguments]...
>    or: function [arguments]...
> 
>         BusyBox is a multi-call binary that combines many common Unix
>         utilities into a single executable.  Most people will create a
>         link to busybox for each function they wish to use and BusyBox
>         will act like whatever it was invoked as!
> 
> Currently defined functions:
>         [, [[, arping, ash, awk, basename, bbconfig, bunzip2, bzcat,
>         bzip2, cat, catv, chgrp, chmod, chown, chroot, chrt, chvt, cksum,
>         clear, cmp, cp, cpio, crond, crontab, cut, date, dc, dd, deallocvt,
>         depmod, devmem, df, dhcprelay, diff, dirname, dmesg, dnsd, dos2unix,
>         du, dumpkmap, dumpleases, echo, egrep, env, ether-wake, expr,
>         false, fbset, fdisk, fgrep, find, fold, free, freeramdisk, fuser,
>         getopt, grep, gunzip, gzip, head, hexdump, hostname, hwclock,
>         ifconfig, ifdown, ifup, insmod, install, ip, ipaddr, iplink,
>         iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5,
>         last, length, less, ln, loadfont, loadkmap, losetup, ls, lsmod,
>         makedevs, md5sum, mdev, mkdir, mkfifo, mknod, mkswap, mktemp,
>         modprobe, more, mount, mountpoint, mv, nameif, nc, netstat,
>         nice, nohup, nslookup, od, openvt, patch, pidof, ping, pipe_progress,
>         pivot_root, printenv, printf, ps, pwd, rdate, rdev, readlink,
>         readprofile, realpath, renice, reset, rm, rmdir, rmmod, route,
>         run-parts, sed, seq, setconsole, setkeycodes, setlogcons, setsid,
>         sh, sha1sum, showkey, sleep, sort, split, stat, strings, stty,
>         swapoff, swapon, switch_root, sync, sysctl, tac, tail, tar,
>         tcpsvd, tee, telnet, telnetd, test, tftp, time, top, touch,
>         tr, traceroute, true, tty, udhcpd, udpsvd, umount, uname, uniq,
>         unix2dos, unzip, uptime, usleep, uudecode, uuencode, vconfig,
>         vi, watch, wc, wget, which, who, whoami, xargs, yes, zcat
> Killed

Try in libbb/appletlib.c:


void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv)
{
        int argc = 1;

        while (argv[argc])
                argc++;

        /* Reinit some shared global data */
        xfunc_error_retval = EXIT_FAILURE;

        applet_name = APPLET_NAME(applet_no);
        if (argc == 2 && strcmp(argv[1], "--help") == 0) {
                /* Special case. POSIX says "test --help"
                 * should be no different from e.g. "test --foo".  */
//TODO: just compare applet_no with APPLET_NO_test
                if (!ENABLE_TEST || strcmp(applet_name, "test") != 0)
                        bb_show_usage();
        }
        if (ENABLE_FEATURE_SUID)
                check_suid(applet_no);
        exit(applet_main[applet_no](argc, argv));
}

Replace
        exit(applet_main[applet_no](argc, argv));
with
        printf("Entering applet_main\n");
        n = applet_main[applet_no](argc, argv);
        printf("Exited epplet_main, exiting...\n");
        exit(n);

and let me know hat do you see when you run "busybox true".
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to