All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: Steve Muckle <smuckle@google.com>
Cc: Sandeep Patil <sspatil@google.com>,
	Martin Doucha <martin.doucha@suse.com>, ltp <ltp@lists.linux.it>
Subject: Re: [LTP] Requested user & group [was: Re: [linux-test-project/ltp] Release 20210927 - LTP 20210927]
Date: Tue, 5 Oct 2021 22:24:29 +0200	[thread overview]
Message-ID: <YVy0fTqiKM3lCCQj@pevik> (raw)
In-Reply-To: <2a6a43e1-25da-7eef-f212-bfe0371275d3@google.com>

> On 10/4/21 11:02 AM, Petr Vorel wrote:
> > 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_

> cheers,
> Steve

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

  reply	other threads:[~2021-10-05 20:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <linux-test-project/ltp/releases/50325863@github.com>
2021-09-29  8:12 ` [LTP] Requested user & group [was: Re: [linux-test-project/ltp] Release 20210927 - LTP 20210927] Petr Vorel
2021-10-01 17:40   ` Sandeep Patil via ltp
2021-10-02 17:30     ` Petr Vorel
2021-10-04 18:02     ` Petr Vorel
2021-10-04 22:10       ` Steve Muckle via ltp
2021-10-05 20:24         ` Petr Vorel [this message]
2021-10-05 22:16           ` Steve Muckle via ltp
2021-10-06  8:12           ` Martin Doucha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YVy0fTqiKM3lCCQj@pevik \
    --to=petr.vorel@gmail.com \
    --cc=ltp@lists.linux.it \
    --cc=martin.doucha@suse.com \
    --cc=smuckle@google.com \
    --cc=sspatil@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.