From: Cyril Hrubis <chrubis@suse.cz>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: brauner@kernel.org, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 1/3] syscalls/creat09: Add umask test condition
Date: Wed, 14 Sep 2022 13:28:20 +0200 [thread overview]
Message-ID: <YyG61JHO7iDAfJ1N@yuki> (raw)
In-Reply-To: <1663143142-2283-1-git-send-email-xuyang2018.jy@fujitsu.com>
Hi!
> diff --git a/testcases/kernel/syscalls/creat/creat09.c b/testcases/kernel/syscalls/creat/creat09.c
> index bed7bddb0..d583cceca 100644
> --- a/testcases/kernel/syscalls/creat/creat09.c
> +++ b/testcases/kernel/syscalls/creat/creat09.c
> @@ -28,6 +28,16 @@
> * Date: Fri Jan 22 16:48:18 2021 -0800
> *
> * xfs: fix up non-directory creation in SGID directories
> + *
> + * When use acl or umask, it still has bug.
> + *
> + * Fixed in:
> + *
> + * commit 1639a49ccdce58ea248841ed9b23babcce6dbb0b
> + * Author: Yang Xu <xuyang2018.jy@fujitsu.com>
> + * Date: Thu July 14 14:11:27 2022 +0800
> + *
> + * fs: move S_ISGID stripping into the vfs_*() helpers
> */
>
> #include <stdlib.h>
> @@ -47,6 +57,14 @@
> static gid_t free_gid;
> static int fd = -1;
>
> +static struct tcase {
> + const char *msg;
> + int mask;
> +} tcases[] = {
> + {"under umask(0) situation", 0},
> + {"under umask(S_IXGRP) situation", S_IXGRP}
> +};
> +
> static void setup(void)
> {
> struct stat buf;
> @@ -94,8 +112,14 @@ static void file_test(const char *name)
> tst_res(TPASS, "%s: Setgid bit not set", name);
> }
>
> -static void run(void)
> +static void run(unsigned int n)
> {
> + struct tcase *tc = &tcases[n];
> +
> + umask(tc->mask);
> + tst_res(TINFO, "Testing setgid behaviour when creating file %s",
> + tc->msg);
This can be shorter and more to the point, something as:
tst_res(TINFO, "File created with %s", tc->msg);
And the msg could be just "umask(0)" and "umask(S_IXGRP)".
Otherwise it's fine and I can fix the messages before applying if you
want.
> fd = SAFE_CREAT(CREAT_FILE, MODE_SGID);
> SAFE_CLOSE(fd);
> file_test(CREAT_FILE);
> @@ -115,13 +139,14 @@ static void cleanup(void)
> }
>
> static struct tst_test test = {
> - .test_all = run,
> + .test = run,
> .setup = setup,
> .cleanup = cleanup,
> .needs_root = 1,
> .all_filesystems = 1,
> .mount_device = 1,
> .mntpoint = MNTPOINT,
> + .tcnt = ARRAY_SIZE(tcases),
> .skip_filesystems = (const char*[]) {
> "exfat",
> "ntfs",
> @@ -132,6 +157,7 @@ static struct tst_test test = {
> {"linux-git", "0fa3ecd87848"},
> {"CVE", "2018-13405"},
> {"linux-git", "01ea173e103e"},
> + {"linux-git", "1639a49ccdce"},
> {}
> },
> };
> --
> 2.23.0
>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-09-14 11:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 8:12 [LTP] [PATCH v4 1/3] syscalls/creat09: Add umask test condition Yang Xu
2022-09-14 7:49 ` xuyang2018.jy
2022-09-14 8:12 ` [LTP] [PATCH v4 2/3] tst_safe_file_at: Add SAFE_FSTATAT macro Yang Xu
2022-09-14 11:30 ` Cyril Hrubis
2022-09-14 8:12 ` [LTP] [PATCH v4 3/3] syscalls/openat: Add new regression test when using open(O_TMPFILE) under umask Yang Xu
2022-09-22 8:52 ` Cyril Hrubis
2022-09-22 9:06 ` xuyang2018.jy
2022-09-22 9:27 ` Cyril Hrubis
2022-09-22 10:02 ` xuyang2018.jy
2022-09-23 10:27 ` Christian Brauner
2022-09-26 1:55 ` xuyang2018.jy
2022-10-10 6:32 ` xuyang2018.jy
2022-09-14 11:28 ` Cyril Hrubis [this message]
2022-09-15 0:37 ` [LTP] [PATCH v4 1/3] syscalls/creat09: Add umask test condition xuyang2018.jy
2022-09-20 1:08 ` xuyang2018.jy
2022-09-21 13:55 ` Cyril Hrubis
2022-09-21 15:40 ` Christian Brauner
2022-09-22 8:00 ` Cyril Hrubis
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=YyG61JHO7iDAfJ1N@yuki \
--to=chrubis@suse.cz \
--cc=brauner@kernel.org \
--cc=ltp@lists.linux.it \
--cc=xuyang2018.jy@fujitsu.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