[LTP] [PATCH v1 08/10] Remove check_newuser from userns testing suite

Andrea Cervesato andrea.cervesato@suse.com
Wed Feb 15 11:16:13 CET 2023


CLONE_NEWUSER is supported from kernel 3.8 and LTP supports all
kernels >= 3.10. For this reason, we can remove any check for
CLONE_NEWUSER support and to make userns common.h a bit simpler.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 testcases/kernel/containers/userns/common.h | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/testcases/kernel/containers/userns/common.h b/testcases/kernel/containers/userns/common.h
index 635d0f190..9b3a47b69 100644
--- a/testcases/kernel/containers/userns/common.h
+++ b/testcases/kernel/containers/userns/common.h
@@ -8,35 +8,17 @@
 #define COMMON_H
 
 #include "tst_test.h"
-#include "lapi/sched.h"
 
 #define UID_MAP 0
 #define GID_MAP 1
 
-static int dummy_child(void *v)
-{
-	(void)v;
-	return 0;
-}
-
-static inline void check_newuser(void)
-{
-	int pid, status;
-
-	pid = ltp_clone_quick(CLONE_NEWUSER | SIGCHLD, dummy_child, NULL);
-	if (pid == -1)
-		tst_brk(TCONF | TTERRNO, "CLONE_NEWUSER not supported");
-
-	SAFE_WAIT(&status);
-}
-
 static inline void updatemap(int cpid, int type, int idnum, int parentmappid)
 {
 	char path[BUFSIZ];
 	char content[BUFSIZ];
 	int fd;
 
-	switch(type) {
+	switch (type) {
 	case UID_MAP:
 		sprintf(path, "/proc/%d/uid_map", cpid);
 		break;
-- 
2.35.3



More information about the ltp mailing list