[LTP] Requested user & group [was: Re: [linux-test-project/ltp] Release 20210927 - LTP 20210927]

Steve Muckle smuckle@google.com
Wed Oct 6 00:16:49 CEST 2021


On 10/5/21 1:24 PM, Petr Vorel wrote:> Hi Steve, Martin, Sandeep, Cyril,
> 
> @Steve, I'm very sorry, I didn't interpret the changelog correctly. As Martin
> notified me, since his patchset [1][2] merged as dc84a2490~..7d4fdf3bb the only
> groups queried by name are "users" and "daemon" (these in
> SAFE_GETGRNAM_FALLBACK()). He actually removed all references to "nobody" and
> "nogroup" in the patchset, tests now use tst_get_gids(), getgid() or get the
> primary group through getpwnam("nobody"). Thus there is no need to create group
> "nogroup", please close that internal aosp ticket.

Thanks for letting me know.

> Looking into tst_get_{g,u}ids() implementation it "The function will fill the
> remaining (size-start) entries with unique UID/GID values.". But the problem is
> that it expect there are no gaps in UID/GID values. While this is true for
> traditional linux distros (not sure about embedded distros), it's definitely not
> true for aosp, see AID_ definitions in libcutils source [1].
> 
> e.g. tst_get_gids(test_groups, 0, 2) (from setregid03.c) returns GID 1 and 2.
> But on aosp getpwuid(1) and getpwuid(2) fails (I verified that by running code
> on aosp 8). There is GID AID_DAEMON 1 ("daemon") and AID_BIN 2 ("bin"), which
> has been added for aosp 9 (8e8648463d7 ("libcutils: Add "daemon" and "bin" users
> for testing only")) and IMHO no use of tst_get_gids() so far does require higher
> GID that 2, but once higher ID is needed it will break (and even adding GID
> "nobody" would help much).
> 
> Fix would be to actually try to run getpwuid(with expected id) until
> it's found, but next GID for aosp is AID_SYSTEM 1000, thus it wouldn't scale.
> But it would work with aosp < 9 (not sure if anybody cares for old aosp).

I'm personally not worried about aosp < 9. As this will be an issue on 
Android if a test uses tst_get_gids() for more groups, I'll repurpose 
the bug I filed to work on that, if and when we can get time for it.

> 
> Back to tests which use SAFE_GETGRNAM_FALLBACK() (used in chmod07.c, fchmod02.c).
> With current implementation, it'd be possible to replace it with tst_get_gids().
> 
> Kind regards,
> Petr
> 
> [1] https://cs.android.com/android/platform/superproject/+/master:system/core/libcutils/include/private/android_filesystem_config.h;l=43?q=AID_

thanks,
Steve


More information about the ltp mailing list