Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/creat09: Add umask(0) to setup
@ 2022-07-08  0:56 Zhao Gongyi via ltp
  2022-07-08  1:19 ` xuyang2018.jy
  0 siblings, 1 reply; 4+ messages in thread
From: Zhao Gongyi via ltp @ 2022-07-08  0:56 UTC (permalink / raw)
  To: ltp

The bit S_ISGID of st_mode is also affected by umask, if umask is 0077,
the test will fail.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 testcases/kernel/syscalls/creat/creat09.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/syscalls/creat/creat09.c b/testcases/kernel/syscalls/creat/creat09.c
index bed7bddb0..6edd5dbb9 100644
--- a/testcases/kernel/syscalls/creat/creat09.c
+++ b/testcases/kernel/syscalls/creat/creat09.c
@@ -52,6 +52,8 @@ static void setup(void)
 	struct stat buf;
 	struct passwd *ltpuser = SAFE_GETPWNAM("nobody");

+	umask(0);
+
 	tst_res(TINFO, "User nobody: uid = %d, gid = %d", (int)ltpuser->pw_uid,
 		(int)ltpuser->pw_gid);
 	free_gid = tst_get_free_gid(ltpuser->pw_gid);
--
2.17.1


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] syscalls/creat09: Add umask(0) to setup
@ 2022-07-08  6:18 zhaogongyi via ltp
  2022-07-08  7:26 ` xuyang2018.jy
  0 siblings, 1 reply; 4+ messages in thread
From: zhaogongyi via ltp @ 2022-07-08  6:18 UTC (permalink / raw)
  To: xuyang2018.jy@fujitsu.com; +Cc: Zhao Gongyi via ltp

Hi Xu,

Shall we also need to add umask(0) in setup() though the setgid strip logic is affected by acl operations?

Best wishes,
Gongyi 

> 
> Hi Zhao
> 
> I don't this fix is meaningful because it only for "fix" this failure
> 
> so do you look into why umask(0077) lead this case fail?
> 
> I have rejected a similar patch[1] from petr yesterday because it has bug
> exists on kernel fs sgid strip logic.
> 
> [1]https://lists.linux.it/pipermail/ltp/2022-July/029495.html
> 
> Best Regards
> Yang Xu
> > The bit S_ISGID of st_mode is also affected by umask, if umask is
> > 0077, the test will fail.
> >
> > Signed-off-by: Zhao Gongyi<zhaogongyi@huawei.com>
> > ---
> >   testcases/kernel/syscalls/creat/creat09.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/testcases/kernel/syscalls/creat/creat09.c
> > b/testcases/kernel/syscalls/creat/creat09.c
> > index bed7bddb0..6edd5dbb9 100644
> > --- a/testcases/kernel/syscalls/creat/creat09.c
> > +++ b/testcases/kernel/syscalls/creat/creat09.c
> > @@ -52,6 +52,8 @@ static void setup(void)
> >   	struct stat buf;
> >   	struct passwd *ltpuser = SAFE_GETPWNAM("nobody");
> >
> > +	umask(0);
> > +
> >   	tst_res(TINFO, "User nobody: uid = %d, gid = %d",
> (int)ltpuser->pw_uid,
> >   		(int)ltpuser->pw_gid);
> >   	free_gid = tst_get_free_gid(ltpuser->pw_gid);
> > --
> > 2.17.1
> >
> >

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-08  7:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-08  0:56 [LTP] [PATCH] syscalls/creat09: Add umask(0) to setup Zhao Gongyi via ltp
2022-07-08  1:19 ` xuyang2018.jy
  -- strict thread matches above, loose matches on Subject: below --
2022-07-08  6:18 zhaogongyi via ltp
2022-07-08  7:26 ` xuyang2018.jy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox