diff mbox series

security/prot_hsymlinks: Set umask before mkdir

Message ID 20210401135638.4111-1-zhaogongyi@huawei.com
State Accepted
Headers show
Series security/prot_hsymlinks: Set umask before mkdir | expand

Commit Message

Zhao Gongyi April 1, 2021, 1:56 p.m. UTC
When uid is nobody, umask is 0077, the test process might has
not permmission to access the file which created by SAFE_MKDIR
with mode 0755.

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

--
2.17.1

Comments

Petr Vorel April 6, 2021, 2:43 p.m. UTC | #1
Hi,

> When uid is nobody, umask is 0077, the test process might has
it's actually hsym user.
> not permmission to access the file which created by SAFE_MKDIR
(permission)
> with mode 0755.

Thanks for your fix!
Merged with comment in the code. BTW I guess we might want to add this umask
to SAFE_MKDIR() instead of fixing all tests which are affected by 0077.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
index ecb393297..d883ab508 100644
--- a/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
+++ b/testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c
@@ -227,6 +227,8 @@  static void setup(int argc, char *argv[])

 	tst_tmpdir();

+	umask(0);
+
 	init_base_dirs();

 	init_files_dirs();