Hi Joshua,
Joshua Kinard wrote,
I think I've run into a rather odd bug on a
big-endian MIPS platform while
trying to hand-assemble a MIPS-II ISA netboot image built from a uclibc-ng
chroot. In my netboot, I need to include xfsprogs, but this has a dependency
on the 'valloc' function call. So in uclibc-ng, I enabled
CONFIG_UCLIBC_SUSV2_LEGACY to enable that function, and rebuilt uclibc-ng.
This fixes the xfsprogs build, but it very subtly breaks busybox's ash shell.
After rebuilding uclibc-ng, then rebuilding busybox statically/multicall, if
you run /bin/ash with a malformed argument or give it a script to execute that
doesn't have the execute bit set, you get a SIGSEGV:
Fudging up the argument syntax to /bin/ash:
octane / # /bin/ash "-c"
/bin/ash: -c requires an argument
Segmentation fault
Via a non-executable script "x.sh", we start with this sample:
octane / # cat ./x.sh
#!/bin/ash
echo "foo!"
If "x.sh" has the executable bit set, we're all good:
octane / # ls -l ./x.sh
-rwxr-xr-x 1 root root 24 Oct 12 01:57 ./x.sh
octane / # /bin/ash -c ./x.sh
foo!
But if we turn off the executable bit...
octane / # chmod -x ./x.sh
octane / # ls -l ./x.sh
-rw-r--r-- 1 root root 24 Oct 12 01:57 ./x.sh
octane / # /bin/ash -c ./x.sh
/bin/ash: ./x.sh: Permission denied
Segmentation fault
After sorting out my last bootup problems (missing N32/O32 binary
support in the kernel), I can confirm that the bug is fixed in
uCLibc-ng 1.0.19:
root@openadk:/root # ash -c /tmp/c.sh
ash: /tmp/c.sh: Permission denied
root@openadk:/root # chmod 755 .
root@openadk:/root # chmod 755 /tmp/c.sh
root@openadk:/root # ash -c /tmp/c.sh
foo!
root@openadk:/root # ash -c
ash: -c requires an argument
root@openadk:/root # ls /lib
Please update to 1.0.19, thanks
Waldemar