[Toybox] Valid range for stat userID and groupID?

Rob Landley rob at landley.net
Sun May 14 11:21:01 PDT 2017


On 05/13/2017 12:00 PM, darken wrote:
>> are you building with bionic? glibc won't know what android does with
> 
> I'm building against musl libc.

which will try to read /etc/passwd and /etc/group which don't exist on
android.

> I couldn't get toybox with bionic
> (though the last time i tried was a few month ago).

I'm poking at the NDK, in theory that should build against bionic. In
practice, it's a work in progress:

http://lists.landley.net/pipermail/toybox-landley.net/2017-May/008976.html

>> glibc won't know what android does with uid/gid for apps.
> 
> Doesn't bionic/3rd party only make a difference when trying to resolve
> the ids to names?
> 
>> (also, 4294967295 is -1.)
> 
> Hm, -1 is not a valid guid though right? They all have to be positive
> ranging from 0 to X?

They should, yes. (The two magic values to the kernel are 0 and 65534.
The second means "nobody" and there's actually some effort to make
multiple processes belonging to nobody not able to access each _other_.
See https://lwn.net/Articles/695478/ )

>> i couldn't find any files on a Pixel XL where the built-in toybox
> reported unusual uids or gids.
> 
> It's not very common, a few files, among a few devices out of thousands.
> I never saw this in person either, just the occasional reports.

Does it reliably happen on those files, or is it a race condition?

>> as usual, not using Android's libc on an Android device is likely to
> lead to confusing results.
> 
> I'll look into setting up a bionic toolchain again.
> You don't happen to have an edition of "Crosscompiling toybox with
> bionic for dummies" at hand :)?

Send it to me if you find it. Bionic doesn't have a conventional
makefile you can use to build it outside the AOSP hairball.

Rob



More information about the Toybox mailing list