From: Avinesh Kumar <akumar@suse.de>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] setresuid04.c: Rewrite the test using new LTP API
Date: Thu, 08 Dec 2022 12:05:28 +0530 [thread overview]
Message-ID: <2042676.XiyxxtkoYD@localhost> (raw)
In-Reply-To: <CAEemH2dW2u+tYQUtvresJXMYYfaqiXqtKksdK4rHaGTCG+5L0w@mail.gmail.com>
Hi Li,
On Thursday, December 8, 2022 9:07:08 AM IST Li Wang wrote:
> Hi Avinesh,
>
> Avinesh Kumar <akumar@suse.de> wrote:
>
> > - /* Test 2: Check a son process cannot open the file
> > - * with RDWR permissions.
> > - */
> > - pid = FORK_OR_VFORK();
> > - if (pid < 0)
> > - tst_brkm(TBROK, NULL, "Fork failed");
> > -
> > - if (pid == 0) {
> > - int tst_fd2;
> > + SAFE_SETRESUID(0, ltpuser->pw_uid, 0);
>
> There is no reason to modify 'real UID' and 'saved set-user-ID'
> at this time, we do only care about 'effective UID' made changes
> successfully or not.
>
Yes, Thank you, I realized this while working on setresuid05.c test.
I think we should leave the 'real UID' and 'saved set-user-ID'
untouched even when resetting 'effective UID' to root:
SAFE_SETRESUID(0, 0, 0); should be
SAFE_SETRESUID(-1, 0, -1);
I will send another patch as we also need to add .needs_tmpdir=1
because we are creating a temp file.
> So I tweaked the patch a tiny and merged it:
>
> --- a/testcases/kernel/syscalls/setresuid/setresuid04.c
> +++ b/testcases/kernel/syscalls/setresuid/setresuid04.c
> @@ -40,7 +40,7 @@ static void run(void)
> pid_t pid;
> int status;
>
> - SAFE_SETRESUID(0, ltpuser->pw_uid, 0);
> + SAFE_SETRESUID(-1, ltpuser->pw_uid, -1);
> TST_EXP_FAIL2(open(TEMP_FILE, O_RDWR), EACCES);
>
> pid = SAFE_FORK();
>
>
>
Best regards,
Avinesh
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-12-08 6:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 7:57 [LTP] [PATCH] setresuid04.c: Rewrite the test using new LTP API Avinesh Kumar
2022-12-08 3:37 ` Li Wang
2022-12-08 6:35 ` Avinesh Kumar [this message]
2022-12-08 6:54 ` Li Wang
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=2042676.XiyxxtkoYD@localhost \
--to=akumar@suse.de \
--cc=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/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