Skip to contentSkip to conversation

security/prot_hsymlinks: Set umask before mkdir

PATCH New Zhao Gongyi 2 participants 2 messages Apr 1, 2021 – Apr 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security/prot_hsymlinks: Set umask before mkdir

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.

---
 testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/security/prot_hsymlinks/prot_hsymlinks.c +2 -0
index ecb393297..d883ab508 100644
@@ -227,6 +227,8 @@ static void setup(int argc, char *argv[])
 
 	tst_tmpdir();
 
+	umask(0);
+
 	init_base_dirs();
 
 	init_files_dirs();

--
2.17.1

#1 lore raw

PATCH 1/1 security/prot_hsymlinks: Set umask before mkdir

Hi,

Quoted 1 line

When uid is nobody, umask is 0077, the test process might has

it's actually hsym user.

Quoted 1 line

not permmission to access the file which created by SAFE_MKDIR

(permission)

Quoted 1 line

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