public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [RFC] 'nobody' user for testing
Date: Thu, 16 Oct 2025 15:35:29 +0200	[thread overview]
Message-ID: <aPD0oQRSUqVATsZs@yuki.lan> (raw)
In-Reply-To: <20251016130952.GA281409@pevik>

Hi!
> OK, I can write it unless Jan plans to work on it (Jan, please let me know).
> 
> I propose to have the usual LTP approach to have functionality used by C API
> (e.g. lib/tst_sudo.c) and reused by thin wrapper available for shell API
> (testcases/lib/tst_sudo.c).
> 
> Few C API tests would use it (prctl06 and other mentioned previously [1] as 3)),
> in shell API only these 2 IMA tests.

There are likely more nuances in the tests that use C, some set real
uid/git some only uid etc. So I wouldn't bother adding helper for six
tests or so and write directly just the shell helper.

> > And I think that the question if we need a separate user for LTP testing is
> > orthogonal.
> 
> Agree. I just brought these two topics together as they are related.
> So, as a separate topic/effort, do you see any room for C API functions for 1)
> and 2) in [1]?

Technically most of the C tests does not even need an user to be created
on the system. They just need UID/GID that is not priviledged, kernel
does not really care about the users in /etc/passwd that's purely
userspace thing. All that kernel does is to compare numbers before it
allows/disallows access. So we may get away with a function that returns
UID and GID suitable for the tests, or even a global varible.

Possibly we may add:

struct tst_usr {
	uid_t uid;
	gid_t gid;
};

struct tst_usr tst_usr = {
	.uid = 65534,
	.gid = 65534,
};

and add an option to override these values with TST_USR_UID and
TST_USR_GID.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2025-10-16 13:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 10:27 [LTP] [RFC] 'nobody' user for testing Petr Vorel
2025-09-22  8:48 ` Jan Stancek via ltp
2025-09-26 12:25   ` Petr Vorel
2025-10-06  9:48   ` Petr Vorel
2025-09-26 13:24 ` Andrea Cervesato via ltp
2025-09-29  8:31   ` Petr Vorel
2025-10-16 12:32     ` Cyril Hrubis
2025-10-16 13:09       ` Petr Vorel
2025-10-16 13:35         ` Cyril Hrubis [this message]
2025-10-16 14:07           ` Petr Vorel

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=aPD0oQRSUqVATsZs@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox