ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] chdir01: Skip nobody when problems on umask 0070
@ 2021-03-31 10:03 Petr Vorel
  2022-01-12 15:23 ` Petr Vorel
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2021-03-31 10:03 UTC (permalink / raw)
  To: ltp

FAT and exFAT from Samsung have EACCES for nobody on umask 0070.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/chdir/chdir01.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/chdir/chdir01.c b/testcases/kernel/syscalls/chdir/chdir01.c
index 23cd455d6..57b92f3f8 100644
--- a/testcases/kernel/syscalls/chdir/chdir01.c
+++ b/testcases/kernel/syscalls/chdir/chdir01.c
@@ -27,7 +27,7 @@
 #define LINK_NAME2 "symloop2"
 
 static char *workdir;
-static int skip_symlinks, skip_blocked;
+static int skip_symlinks, skip_blocked, skip_umask;
 static struct passwd *ltpuser;
 
 static struct test_case {
@@ -57,6 +57,11 @@ static void setup(void)
 	SAFE_CHDIR(workdir);
 
 	mode_t sys_umask = umask(0);
+
+	/* FAT and exFAT from Samsung have EACCES for nobody on umask 0070 */
+	if (sys_umask & S_IRWXG)
+		skip_umask = 1;
+
 	SAFE_MKDIR(DIR_NAME, 0755);
 	SAFE_MKDIR(BLOCKED_NAME, 0644);
 	umask(sys_umask);
@@ -118,8 +123,7 @@ static void run(unsigned int n)
 	check_result("root", tc->name, tc->root_ret, tc->root_err);
 
 	if (tc->nobody_err == EACCES && skip_blocked) {
-		tst_res(TCONF, "Skipping unprivileged permission test, "
-			"FS mangles dir mode");
+		tst_res(TCONF, "Skipping unprivileged permission test, FS mangles dir mode");
 		return;
 	}
 
@@ -127,6 +131,12 @@ static void run(unsigned int n)
 	SAFE_SETEUID(ltpuser->pw_uid);
 	TEST(chdir(tc->name));
 	SAFE_SETEUID(0);
+
+	if (skip_blocked && skip_umask && TST_ERR == EACCES) {
+		tst_res(TCONF, "Skipping unprivileged permission test, FS mangles dir mode on umask");
+		return;
+	}
+
 	check_result("nobody", tc->name, tc->nobody_ret, tc->nobody_err);
 }
 
-- 
2.30.2


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

* Re: [LTP] [PATCH 1/1] chdir01: Skip nobody when problems on umask 0070
  2021-03-31 10:03 [LTP] [PATCH 1/1] chdir01: Skip nobody when problems on umask 0070 Petr Vorel
@ 2022-01-12 15:23 ` Petr Vorel
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Vorel @ 2022-01-12 15:23 UTC (permalink / raw)
  To: ltp; +Cc: Xie Ziyao

Hi,

FYI fixed by Cyril in e18dee565c ("chdir01: Fix on more restrictive umask")
=> rejecting this in patchwork.

Kind regards,
Petr

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

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

end of thread, other threads:[~2022-01-12 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-31 10:03 [LTP] [PATCH 1/1] chdir01: Skip nobody when problems on umask 0070 Petr Vorel
2022-01-12 15:23 ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).