All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/6] idmapped-mount: split setgid test from test-core
@ 2022-04-07 12:09 Yang Xu
  2022-04-07 12:09 ` [PATCH v2 2/6] idmapped-mounts: Add mknodat operation in setgid test Yang Xu
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Yang Xu @ 2022-04-07 12:09 UTC (permalink / raw)
  To: david, brauner, djwong; +Cc: linux-fsdevel, fstests, Yang Xu

Since we plan to increase setgid test covertage, it will find new bug
, so add a new test group test-setgid is better.

Also add a new test case to test test-setgid instead of miss it.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 src/idmapped-mounts/idmapped-mounts.c | 19 +++++++++++++++----
 tests/generic/999                     | 26 ++++++++++++++++++++++++++
 tests/generic/999.out                 |  2 ++
 3 files changed, 43 insertions(+), 4 deletions(-)
 create mode 100755 tests/generic/999
 create mode 100644 tests/generic/999.out

diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c
index 4cf6c3bb..dff6820f 100644
--- a/src/idmapped-mounts/idmapped-mounts.c
+++ b/src/idmapped-mounts/idmapped-mounts.c
@@ -13809,6 +13809,7 @@ static void usage(void)
 	fprintf(stderr, "--test-nested-userns                Run nested userns idmapped mount testsuite\n");
 	fprintf(stderr, "--test-btrfs                        Run btrfs specific idmapped mount testsuite\n");
 	fprintf(stderr, "--test-setattr-fix-968219708108     Run setattr regression tests\n");
+	fprintf(stderr, "--test-setgid                       Run setgid create tests\n");
 
 	_exit(EXIT_SUCCESS);
 }
@@ -13826,6 +13827,7 @@ static const struct option longopts[] = {
 	{"test-nested-userns",			no_argument,		0,	'n'},
 	{"test-btrfs",				no_argument,		0,	'b'},
 	{"test-setattr-fix-968219708108",	no_argument,		0,	'i'},
+	{"test-setgid",				no_argument,		0,	'j'},
 	{NULL,					0,			0,	  0},
 };
 
@@ -13866,9 +13868,6 @@ struct t_idmapped_mounts {
 	{ setattr_truncate,						false,	"setattr truncate",										},
 	{ setattr_truncate_idmapped,					true,	"setattr truncate on idmapped mounts",								},
 	{ setattr_truncate_idmapped_in_userns,				true,	"setattr truncate on idmapped mounts in user namespace",					},
-	{ setgid_create,						false,	"create operations in directories with setgid bit set",						},
-	{ setgid_create_idmapped,					true,	"create operations in directories with setgid bit set on idmapped mounts",			},
-	{ setgid_create_idmapped_in_userns,				true,	"create operations in directories with setgid bit set on idmapped mounts in user namespace",	},
 	{ setid_binaries,						false,	"setid binaries on regular mounts",								},
 	{ setid_binaries_idmapped_mounts,				true,	"setid binaries on idmapped mounts",								},
 	{ setid_binaries_idmapped_mounts_in_userns,			true,	"setid binaries on idmapped mounts in user namespace",						},
@@ -13923,6 +13922,12 @@ struct t_idmapped_mounts t_setattr_fix_968219708108[] = {
 	{ setattr_fix_968219708108,					true,	"test that setattr works correctly",								},
 };
 
+struct t_idmapped_mounts t_setgid[] = {
+	{ setgid_create,						false,	"create operations in directories with setgid bit set",						},
+	{ setgid_create_idmapped,					true,	"create operations in directories with setgid bit set on idmapped mounts",			},
+	{ setgid_create_idmapped_in_userns,				true,	"create operations in directories with setgid bit set on idmapped mounts in user namespace",	},
+};
+
 static bool run_test(struct t_idmapped_mounts suite[], size_t suite_size)
 {
 	int i;
@@ -14000,7 +14005,7 @@ int main(int argc, char *argv[])
 	int index = 0;
 	bool supported = false, test_btrfs = false, test_core = false,
 	     test_fscaps_regression = false, test_nested_userns = false,
-	     test_setattr_fix_968219708108 = false;
+	     test_setattr_fix_968219708108 = false, test_setgid = false;
 
 	while ((ret = getopt_long_only(argc, argv, "", longopts, &index)) != -1) {
 		switch (ret) {
@@ -14037,6 +14042,9 @@ int main(int argc, char *argv[])
 		case 'i':
 			test_setattr_fix_968219708108 = true;
 			break;
+		case 'j':
+			test_setgid = true;
+			break;
 		case 'h':
 			/* fallthrough */
 		default:
@@ -14106,6 +14114,9 @@ int main(int argc, char *argv[])
 		      ARRAY_SIZE(t_setattr_fix_968219708108)))
 		goto out;
 
+	if (test_setgid && !run_test(t_setgid, ARRAY_SIZE(t_setgid)))
+		goto out;
+
 	fret = EXIT_SUCCESS;
 
 out:
diff --git a/tests/generic/999 b/tests/generic/999
new file mode 100755
index 00000000..46a34804
--- /dev/null
+++ b/tests/generic/999
@@ -0,0 +1,26 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 FUJITSU LIMITED. All rights reserved
+#
+# FS QA Test 999
+#
+# Test that setgid bit behave correctly.
+#
+. ./common/preamble
+_begin_fstest auto quick cap idmapped mount perms rw
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+
+_supported_fs generic
+_require_test
+
+echo "Silence is golden"
+
+$here/src/idmapped-mounts/idmapped-mounts --test-setgid --device "$TEST_DEV" \
+	--mount "$TEST_DIR" --fstype "$FSTYP"
+
+status=$?
+exit
diff --git a/tests/generic/999.out b/tests/generic/999.out
new file mode 100644
index 00000000..3b276ca8
--- /dev/null
+++ b/tests/generic/999.out
@@ -0,0 +1,2 @@
+QA output created by 999
+Silence is golden
-- 
2.27.0


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

end of thread, other threads:[~2022-04-08 10:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 12:09 [PATCH v2 1/6] idmapped-mount: split setgid test from test-core Yang Xu
2022-04-07 12:09 ` [PATCH v2 2/6] idmapped-mounts: Add mknodat operation in setgid test Yang Xu
2022-04-07 13:40   ` Christian Brauner
2022-04-08  3:02     ` xuyang2018.jy
2022-04-07 12:09 ` [PATCH v2 3/6] idmapped-mounts: Reset errno to zero after detect fs_allow_idmap Yang Xu
2022-04-07 12:59   ` Christian Brauner
2022-04-07 12:09 ` [PATCH v2 4/6] idmapped-mounts: Add umask(S_IXGRP) wrapper for setgid_create* cases Yang Xu
2022-04-07 15:12   ` Christian Brauner
2022-04-08  3:38     ` xuyang2018.jy
2022-04-07 12:09 ` [PATCH v2 5/6] idmapped-mounts: Add setfacl(S_IXGRP) " Yang Xu
2022-04-07 12:09 ` [PATCH v2 6/6] idmapped-mounts: Add open with O_TMPFILE operation in setgid test Yang Xu
2022-04-07 13:43   ` Christian Brauner
2022-04-08  3:58     ` xuyang2018.jy
2022-04-08  7:34       ` Zorro Lang
2022-04-08  7:55         ` xuyang2018.jy
2022-04-07 12:55 ` [PATCH v2 1/6] idmapped-mount: split setgid test from test-core Christian Brauner
2022-04-08  1:20   ` xuyang2018.jy
2022-04-08 10:17     ` xuyang2018.jy
2022-04-08 10:33       ` Christian Brauner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.