Skip to contentSkip to conversation

syscalls/creat09: Add umask(0) to setup

PATCH zhaogongyi via ltp 2 participants 2 messages Jul 8, 2022

lore
Share & tools
lore
#0 lore raw

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

Quoted 41 lines

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

Quoted 14 lines

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

---
  testcases/kernel/syscalls/creat/creat09.c | 2 ++
  1 file changed, 2 insertions(+)
testcases/kernel/syscalls/creat/creat09.c +0 -0
index bed7bddb0..6edd5dbb9 100644

testcases/kernel/syscalls/creat/creat09.c static void setup(void) · line 57

Quoted 6 lines
testcases/kernel/syscalls/creat/creat09.c +2 -0
@@ -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,

Quoted 6 lines
testcases/kernel/syscalls/creat/creat09.c +0 -1
  		(int)ltpuser->pw_gid);
  	free_gid = tst_get_free_gid(ltpuser->pw_gid);
--

2.17.1

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Zhao

Quoted 1 line

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

Don't need, it will hide actual kernel bug.

Best Regards
Yang Xu

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp