public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/3] idmapped-mounts: Reset errno to zero before run_test
@ 2022-05-07 13:05 Yang Xu
  2022-05-07 13:05 ` [PATCH v4 2/3] idmapped-mounts: Add mknodat operation in setgid test Yang Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yang Xu @ 2022-05-07 13:05 UTC (permalink / raw)
  To: david, brauner, djwong; +Cc: linux-fsdevel, fstests, Yang Xu

If we run case on old kernel that doesn't support mount_setattr and
then fail on our own function before call is_setgid/is_setuid function
to reset errno, run_test will print "Function not implement" error.

We also check whether system support user namespace, so reset errno to
zero after userns check.

Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
v3->v4: move this reset step after sys_has_usersn()
 src/idmapped-mounts/idmapped-mounts.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c
index ce3f73be..2e94bf71 100644
--- a/src/idmapped-mounts/idmapped-mounts.c
+++ b/src/idmapped-mounts/idmapped-mounts.c
@@ -14232,6 +14232,8 @@ int main(int argc, char *argv[])
 		exit(EXIT_SUCCESS);
 	}
 	t_has_userns = sys_has_userns();
+	/* don't copy ENOSYS errno to child process on older kernel */
+	errno = 0;
 
 	stash_overflowuid();
 	stash_overflowgid();
-- 
2.31.1


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

end of thread, other threads:[~2022-05-07 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-07 13:05 [PATCH v4 1/3] idmapped-mounts: Reset errno to zero before run_test Yang Xu
2022-05-07 13:05 ` [PATCH v4 2/3] idmapped-mounts: Add mknodat operation in setgid test Yang Xu
2022-05-07 13:05 ` [PATCH v4 3/3] idmapped-mounts: Add open with O_TMPFILE " Yang Xu
2022-05-07 13:33 ` [PATCH v4 1/3] idmapped-mounts: Reset errno to zero before run_test Zorro Lang
2022-05-07 13:56   ` xuyang2018.jy
2022-05-07 14:23     ` xuyang2018.jy

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