Blame SOURCES/0054-tests-explicitly-enable-user-namespaces-for-TEST-13-.patch

a3e2b5
From e8ead61e1c0a919a97df64b14dbd572ef7c830d2 Mon Sep 17 00:00:00 2001
a3e2b5
From: Frantisek Sumsal <frantisek@sumsal.cz>
a3e2b5
Date: Sat, 15 Dec 2018 20:22:31 +0100
a3e2b5
Subject: [PATCH] tests: explicitly enable user namespaces for
a3e2b5
 TEST-13-NSPAWN-SMOKE
a3e2b5
a3e2b5
Cherry-picked from: 67f5c0c776ce9449ad21e9854665573a05141fd4
a3e2b5
---
a3e2b5
 test/TEST-13-NSPAWN-SMOKE/test.sh | 7 ++++++-
a3e2b5
 1 file changed, 6 insertions(+), 1 deletion(-)
a3e2b5
a3e2b5
diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh
a3e2b5
index 6a0cb42eaf..c0789b5d20 100755
a3e2b5
--- a/test/TEST-13-NSPAWN-SMOKE/test.sh
a3e2b5
+++ b/test/TEST-13-NSPAWN-SMOKE/test.sh
a3e2b5
@@ -18,7 +18,7 @@ test_setup() {
a3e2b5
         eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
a3e2b5
 
a3e2b5
         setup_basic_environment
a3e2b5
-        dracut_install busybox chmod rmdir unshare ip
a3e2b5
+        dracut_install busybox chmod rmdir unshare ip sysctl
a3e2b5
 
a3e2b5
         cp create-busybox-container $initdir/
a3e2b5
 
a3e2b5
@@ -63,6 +63,11 @@ if [[ -f /proc/1/ns/cgroup ]]; then
a3e2b5
 fi
a3e2b5
 
a3e2b5
 is_user_ns_supported=no
a3e2b5
+# On some systems (e.g. CentOS 7) the default limit for user namespaces
a3e2b5
+# is set to 0, which causes the following unshare syscall to fail, even
a3e2b5
+# with enabled user namespaces support. By setting this value explicitly
a3e2b5
+# we can ensure the user namespaces support to be detected correctly.
a3e2b5
+sysctl -w user.max_user_namespaces=10000
a3e2b5
 if unshare -U sh -c :; then
a3e2b5
     is_user_ns_supported=yes
a3e2b5
 fi