Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v16 2/2] open16: allow restricted O_CREAT of FIFOs and regular files
Date: Thu, 22 Oct 2026 17:44:36 +0200	[thread overview]
Message-ID: <20261022154436.GA419745@pevik> (raw)
In-Reply-To: <20261022022824.19735-3-wegao@suse.com>

Hi Wei,

...
> +static void verify_open(unsigned int n)
> +{
> +	struct tcase *tc = &tcases[n];
> +
> +	SAFE_FILE_PRINTF(PATH_FS_PROTECTED_REGULAR, "%u", n);
> +	SAFE_FILE_PRINTF(PATH_FS_PROTECTED_FIFOS, "%u", n);
> +
> +	if (tc->owner_uid != (uid_t)-1 || tc->use_nobody_gid) {
> +		gid_t gid = tc->use_nobody_gid ? gid1 : 0;
> +
> +		SAFE_CHOWN(DIR, tc->owner_uid, gid);
> +	}
> +
> +	if (tc->dir_mode)
> +		SAFE_CHMOD(DIR, tc->dir_mode);
> +
> +	if (SAFE_FORK())
> +		return;
> +
> +	SAFE_SETGID(gid1);
> +	SAFE_SETUID(uid2);
> +
> +	TST_EXP_FD_OR_FAIL(openat(dir_fd, TEST_FILE, O_RDWR | O_CREAT, 0777),
> +			   tc->exp_errno, "openat %s (sysctl_val=%u)", TEST_FILE, n);
> +	if (TST_RET != -1)
> +		SAFE_CLOSE(TST_RET);
> +
> +	TST_EXP_FD_OR_FAIL(open(TEST_FIFO_PATH, O_RDWR | O_CREAT, 0777),
> +			   tc->exp_errno, "open %s (sysctl_val=%u)", TEST_FIFO, n);
> +	if (TST_RET != -1)
> +		SAFE_CLOSE(TST_RET);
> +
> +	exit(0);

Do we need this explicit exit?

The rest LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

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

  reply	other threads:[~2026-10-22 15:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22  2:28 [LTP] [PATCH v16 0/2] open16: allow restricted O_CREAT of FIFOs and regular files Wei Gao via ltp
2026-10-22  2:28 ` [LTP] [PATCH v16 1/2] lib: New library function tst_get_free_uid Wei Gao via ltp
2026-10-22  7:12   ` [LTP] " linuxtestproject.agent
2026-10-22 15:25   ` [LTP] [PATCH v16 1/2] " Petr Vorel
2026-10-22 15:32     ` Petr Vorel
2026-10-23  2:44       ` Wei Gao via ltp
2026-10-22  2:28 ` [LTP] [PATCH v16 2/2] open16: allow restricted O_CREAT of FIFOs and regular files Wei Gao via ltp
2026-10-22 15:44   ` Petr Vorel [this message]
2026-10-23  2:46     ` Wei Gao via ltp

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