[Toybox] Valid range for stat userID and groupID?

darken darken at darken.eu
Sun May 14 12:16:31 PDT 2017


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

And then fall back to just use the numeric ids? Which are stored in the
filesystem? Inodes I think?
Isn't reading uids/guids from inodes be independent from bionic/musl etc.?
On second thought, if this data is stored and read from the filesystem,
couldn't a filesystem corruption cause these values?

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

If there is such a file, it's read everytime like this.
I don't think it's a new issue either, I just usually don't log this.
Could have been the same with busybox.

I've looked a bit more through the reports.
4294967295 is most common but there is also: 3912069456 or 3800903683
or 3780276225
or 3851690820 etc. but with those I can see that the user used some root
tools to mount extra partitions (e.g. apps2sd -> /data/sdext2), so I would
write those ones off as unrelated.

4294967295 accounts for 80% of the reports and 99% are from devices on
Android 6.0.1, 93% of those are Samsung and mostly SM-N930F or SM-G900F.
While I'm the first to chalk an issue up to a Samsung specific bug, this
could also just be coincidence due to Samsungs device popularity...

> 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.

Will do if I find one, first need to see about resizing my VM though if I
want to download AOSP :)


2017-05-14 20:21 GMT+02:00 Rob Landley <rob at landley.net>:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170514/4071cfc1/attachment-0003.htm>


More information about the Toybox mailing list