All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] userns/userns08.c: Enable userns in max_user_namespaces file
@ 2021-08-05  6:27 Yang Xu
  2021-08-18  9:57 ` xuyang2018.jy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yang Xu @ 2021-08-05  6:27 UTC (permalink / raw)
  To: ltp

On old distros ie centos7, the default value of max_user_namespaces is set to 0.
Enable it by increasing this value.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/containers/userns/userns08.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/testcases/kernel/containers/userns/userns08.c b/testcases/kernel/containers/userns/userns08.c
index aedfc6c4e..0910ea7d4 100644
--- a/testcases/kernel/containers/userns/userns08.c
+++ b/testcases/kernel/containers/userns/userns08.c
@@ -120,6 +120,11 @@ static void setup(void)
 
 	SAFE_WRITE(fd, 1, "\n", 1);
 	SAFE_CLOSE(fd);
+
+	/* The default value of max_user_namespaces is set to 0 on some distros,
+	 * We need to change the default value to call clone().
+	 */
+	SAFE_FILE_PRINTF("/proc/sys/user/max_user_namespaces", "%d", 10);
 }
 
 static struct tst_test test = {
@@ -133,6 +138,10 @@ static struct tst_test test = {
 		"CONFIG_USER_NS",
 		NULL
 	},
+	.save_restore = (const char * const[]) {
+		"?/proc/sys/user/max_user_namespaces",
+		NULL,
+	},
 	.tags = (const struct tst_tag[]) {
 		{"linux-git", "d2f007dbe7e4"},
 		{"CVE", "CVE-2018-18955"},
-- 
2.23.0


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

end of thread, other threads:[~2021-08-31 10:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  6:27 [LTP] [PATCH] userns/userns08.c: Enable userns in max_user_namespaces file Yang Xu
2021-08-18  9:57 ` xuyang2018.jy
2021-08-27 10:19 ` [LTP] [PATCH v2] testcases: " Yang Xu
2021-08-27 10:35 ` [LTP] [PATCH] userns/userns08.c: " Richard Palethorpe
2021-08-31 10:09   ` xuyang2018.jy

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.