From: Petr Vorel <pvorel@suse.cz>
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v5 3/8] syscalls/mknod03: Convert to new API
Date: Fri, 6 Jun 2025 12:34:12 +0200 [thread overview]
Message-ID: <20250606103412.GA1289709@pevik> (raw)
In-Reply-To: <20250605-conversions-mknod-v5-3-0b5cff90c21c@suse.com>
Hi Ricardo, all,
...
> - /*
> - * Set the effective group id and user id of the test process
> - * to that of guest user (nobody)
> - */
> - SAFE_SETGID(cleanup, group1_gid);
> - if (setreuid(-1, user1_uid) < 0) {
> - tst_brkm(TBROK, cleanup,
> - "Unable to set process uid to that of ltp user");
> - }
> -
> - /* Save the real group ID of the current process */
> - mygid = getgid();
> -
> - /* Change directory to DIR_TEMP */
> - SAFE_CHDIR(cleanup, DIR_TEMP);
> + SAFE_SETGID(nobody_gid);
> + SAFE_SETREUID(-1, nobody_uid);
> }
> -/*
> - * cleanup() - Performs all ONE TIME cleanup for this test at
> - * completion or premature exit.
> - * Print test timing stats and errno log if test executed with options.
> - * Restore the real/effective user id of the process changed during
> - * setup().
> - * Remove temporary directory and sub-directories/files under it
> - * created during setup().
> - * Exit the test program with normal exit code.
> - */
> -void cleanup(void)
> -{
> -
> - /*
> - * Restore the effective uid of the process changed in the
> - * setup().
> - */
> - if (setreuid(-1, save_myuid) < 0) {
> - tst_brkm(TBROK, NULL,
> - "resetting process real/effective uid failed");
> - }
+1 for avoiding restoring UID in cleanup (I also think that while setreuid(-1,
nobody_uid) in setup is a subject of testing thus needed, restoring UID is
indeed *not* needed. IMHO this is often done i real programs which gain root
in setuid, but that's not the case).
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-06-06 10:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 12:52 [LTP] [PATCH v5 0/8] syscalls/mknod: Refactor all tests Ricardo B. Marlière via ltp
2025-06-05 12:52 ` [LTP] [PATCH v5 1/8] syscalls/mknod01: Fix checkpatch.pl warnings Ricardo B. Marlière via ltp
2025-06-05 12:52 ` [LTP] [PATCH v5 2/8] syscalls/mknod02: Use relative path to avoid use of SAFE_CHDIR Ricardo B. Marlière via ltp
2025-06-06 10:08 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 3/8] syscalls/mknod03: Convert to new API Ricardo B. Marlière via ltp
2025-06-06 10:34 ` Petr Vorel [this message]
2025-06-06 11:49 ` Petr Vorel
2025-06-06 11:57 ` Ricardo B. Marlière via ltp
2025-06-06 12:33 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 4/8] syscalls/mknod04: " Ricardo B. Marlière via ltp
2025-06-06 10:48 ` Petr Vorel
2025-06-06 11:05 ` Ricardo B. Marlière via ltp
2025-06-06 11:27 ` Petr Vorel
2025-06-06 11:31 ` Ricardo B. Marlière via ltp
2025-06-06 13:59 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 5/8] syscalls/mknod05: " Ricardo B. Marlière via ltp
2025-06-06 11:44 ` Petr Vorel
2025-06-06 11:45 ` Ricardo B. Marlière via ltp
2025-06-05 12:52 ` [LTP] [PATCH v5 6/8] syscalls/mknod06: " Ricardo B. Marlière via ltp
2025-06-06 12:06 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 7/8] syscalls/mknod07: " Ricardo B. Marlière via ltp
2025-06-06 12:21 ` Petr Vorel
2025-06-05 12:52 ` [LTP] [PATCH v5 8/8] syscalls/mknod08: " Ricardo B. Marlière 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=20250606103412.GA1289709@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=rbm@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 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.