On 07/21/2016 02:58 AM, Michael Eder wrote: > |toybox stat| is crashing on Android emulator running Android 5.1.1 > (Lollipop) > > |root@generic:/data/local # ./toybox-armv6l stat script.sh File: > `script.sh' Size: 14722 Blocks: 32 IO Blocks: 4096 regular file Device: > 1f01h/7937d Inode: 14524 Links: 1 Access: (770/-rwxrwx---Segmentation > fault |
Hmmm... Under qemu-system-arm I get: $ ./toybox stat toybox File: `toybox' Size: 297768 Blocks: 588 IO Blocks: 1024 regular file Device: 810h/2064d Inode: 23 Links: 1 Access: (555/-r-xr-xr-x) Uid: (0/ root) Gid: (0/ root) Access: 2016-07-22 06:43:49.980000000 Modify: 2016-07-22 06:43:50.010000000 Change: 2016-07-22 06:43:50.020000000 I tried building current git from source, and "wget http://landley.net/toybox/bin/toybox-armv6l" and both behaved the same for me. Possibly qemu isn't complaining about an unaligned access correctly? (I thought it was...) > I tried with the latest release version from the toybox website > <http://landley.net/toybox/bin/> for arm-v6l as well as a version built > from latest git using your cross-compiler for armv6 from your homepage: > > |root@generic:/data/local # ./toybox stat toybox File: `toybox' Size: > 467296 Blocks: 920 IO Blocks: 4096 regular file Device: 1f01h/7937d > Inode: 14531 Links: 1 Access: (555/-r-xr-xr-xSegmentation fault | > > It seems that the emulator is running ARMv7l, but AFAIK it should be > compatible to ARMv6l binaries: Yeah, it should. You're running a binary statically built against uClibc with the old gcc 4.2 toolchain, so it's not a bionic thing nor a toolchain thing. You built current git so it's not version skew. What it really sounds like is the vanilla qemu I'm using and the android emulator you're using are doing something different? Or maybe a kernel .config issue? (I rebuilt qemu from current git to make sure it wasn't the oldish version i was using, and I still get the full unsegfaulted output. Now it's possible what's happening is that the next thing it tries to do is fetch the uid, and the android kernel code is behaving differently because of how they've set up user ID's. Or maybe it's a problem trying to display a uid that's not in /etc/passwd, which sadly I can't easily test here at the moment because I just noticed that "chown 123:123 toybox" is saying: chown: user '123' Which is broken in a couple ways (there should be a ":errno message" on the end of that if it's an actual error, and numeric user IDs should work even if they're not in /etc/passwd) so I need to off and fix THAT before cycling back to this. :) If I can't reproduce this with a bit more fiddling here, I should download this android emulator and build environment. I'm guessing that would be from... Android NDK version 10c? https://developer.android.com/about/versions/android-5.0-changes.html https://developer.android.com/ndk/downloads/revision_history.html (Sigh, is the NDK standalone with its own emulator or does it assume you have the SDK installed already? The NDK page assumes you already know this. Oh well, I can dig through it, lemme fix the chown thing first...) Thanks, Rob _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
