Skip to contentSkip to conversation

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

LTP Petr Vorel 4 participants 8 messages Sep 29, 2021 – Oct 6, 2021 1 message not in the archive

lore
Share & tools
lore

Petr Vorel

author
#1 lore raw
In reply to a message not in the archive

Hi,

from 20210927 LTP release:

Quoted 3 lines

* Testcases were fixed not to expect certain users and groups to be present on the system
- some tests were expecting bin, daemon and similar groups and users to exist on the system
- now LTP depends only on user 'nobody' and group 'nogroup'

At least some tests (e.g. fchmod02.c, chmod07.c) require other groups ('users', fallback to 'daemon' which is on AOSP):
ltpgroup = SAFE_GETGRNAM_FALLBACK("users", "daemon");

@Sandeep: is 'nobody' on AOSP or do we still need SAFE_GETGRNAM_FALLBACK()?

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
Quoted 7 lines · Petr Vorel

Hi,

from 20210927 LTP release:

Quoted 1 line

* Testcases were fixed not to expect certain users and groups to be

present on the system

Quoted 1 line

- some tests were expecting bin, daemon and similar groups and users

to exist on the system

Quoted 8 lines
Quoted 1 line

- now LTP depends only on user 'nobody' and group 'nogroup'

At least some tests (e.g. fchmod02.c, chmod07.c) require other groups ('users',
fallback to 'daemon' which is on AOSP):
ltpgroup = SAFE_GETGRNAM_FALLBACK("users", "daemon");

@Sandeep: is 'nobody' on AOSP or do we still need SAFE_GETGRNAM_FALLBACK()?

AID_NOBODY seems to be part of the AOSP already[1], so I think that might work.
I dont have a way to test this immediately right now, so adding others who may be able
to verify in CC.

- ssp

1.
https://cs.android.com/android/platform/superproject/+/master:system/core/libcutils/include/private/android_filesystem_config.h;l=183?q=AID_NOBODY

Quoted 7 lines

Kind regards,
Petr

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 2 lines
-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Sandeep,

Quoted 16 lines · Petr Vorel
Quoted 14 lines

Hi,

from 20210927 LTP release:

Quoted 1 line

* Testcases were fixed not to expect certain users and groups to be

present on the system

Quoted 1 line

- some tests were expecting bin, daemon and similar groups and users

to exist on the system

Quoted 1 line

- now LTP depends only on user 'nobody' and group 'nogroup'

At least some tests (e.g. fchmod02.c, chmod07.c) require other groups ('users',
fallback to 'daemon' which is on AOSP):
ltpgroup = SAFE_GETGRNAM_FALLBACK("users", "daemon");

Quoted 8 lines
Quoted 1 line

@Sandeep: is 'nobody' on AOSP or do we still need SAFE_GETGRNAM_FALLBACK()?

AID_NOBODY seems to be part of the AOSP already[1], so I think that might work.
I dont have a way to test this immediately right now, so adding others who may be able
to verify in CC.

Thanks for info, it'd be great to have anybody to test it before we drop it.

Kind regards,
Petr

Quoted 13 lines

- ssp

1.
https://cs.android.com/android/platform/superproject/+/master:system/core/libcutils/include/private/android_filesystem_config.h;l=183?q=AID_NOBODY

Quoted 5 lines

Kind regards,
Petr

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw
In reply to Sandeep Patil via ltp
Quoted 16 lines · Petr Vorel
Quoted 14 lines

Hi,

from 20210927 LTP release:

Quoted 1 line

* Testcases were fixed not to expect certain users and groups to be

present on the system

Quoted 1 line

- some tests were expecting bin, daemon and similar groups and users

to exist on the system

Quoted 1 line

- now LTP depends only on user 'nobody' and group 'nogroup'

At least some tests (e.g. fchmod02.c, chmod07.c) require other groups ('users',
fallback to 'daemon' which is on AOSP):
ltpgroup = SAFE_GETGRNAM_FALLBACK("users", "daemon");

Quoted 8 lines
Quoted 1 line

@Sandeep: is 'nobody' on AOSP or do we still need SAFE_GETGRNAM_FALLBACK()?

AID_NOBODY seems to be part of the AOSP already[1], so I think that might work.
I dont have a way to test this immediately right now, so adding others who may be able
to verify in CC.

I'm sorry, I was wrong, I meant GID "nogroup". Looking into the source, there is no "AID_NOGROUP", thus we need to keep using GID "daemon" for AOSP instead "nogroup". IMHO instead SAFE_GETGRNAM_FALLBACK() this should be set somewhere in the library, so that it's for all tests.

Kind regards,
Petr

Quoted 13 lines

- ssp

1.
https://cs.android.com/android/platform/superproject/+/master:system/core/libcutils/include/private/android_filesystem_config.h;l=183?q=AID_NOBODY

Quoted 5 lines

Kind regards,
Petr

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
Quoted 4 lines · Petr Vorel

I'm sorry, I was wrong, I meant GID "nogroup". Looking into the source, there is no "AID_NOGROUP", thus we need to keep using GID "daemon" for AOSP instead "nogroup". IMHO instead SAFE_GETGRNAM_FALLBACK() this should be set somewhere in the library, so that it's for all tests.

Hi Petr, I've created an issue internally to track adding 'nogroup'. It may be a little while before it goes in though.

cheers,
Steve

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw
Quoted 8 lines · Petr Vorel
Quoted 4 lines

I'm sorry, I was wrong, I meant GID "nogroup". Looking into the source, there is no "AID_NOGROUP", thus we need to keep using GID "daemon" for AOSP instead "nogroup". IMHO instead SAFE_GETGRNAM_FALLBACK() this should be set somewhere in the library, so that it's for all tests.

Hi Petr, I've created an issue internally to track adding 'nogroup'. It may be a little while before it goes in though.

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.

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

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_

Quoted 2 lines

cheers,
Steve

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

On 10/5/21 1:24 PM, Petr Vorel wrote:> Hi Steve, Martin, Sandeep, Cyril,

Quoted 8 lines

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

Quoted 14 lines

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

Quoted 3 lines

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.

Quoted 8 lines

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

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw
In reply to Petr Vorel
Quoted 7 lines · Petr Vorel
Quoted 1 line · Petr Vorel

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

Quoted 7 lines

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

Actually, the tests using tst_get_uids() or tst_get_gids() currently do not query any additional information about the returned UID/GID values. Those tests will work just fine even if there is no corresponding user account or group.

Signature · 10 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp