summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-02-12 19:05:27 +0000
committerLubomir Rintel <lkundrak@v3.sk>2018-02-12 20:46:47 +0100
commit6788ced98d7945a1d9a3df7fd5da16aba7d25d21 (patch)
treef0b5241ff70a0464cfd5e041aabcd3426d626575
parentd7c70dd9ecdbc049dcee15d6dd3e2e19486bc784 (diff)
downloadNetworkManager-6788ced98d7945a1d9a3df7fd5da16aba7d25d21.tar.gz
platform/test: drop the /sys/devices dance
The bridge test (and no other either) no longer sets sysfs properties, so this whole madness is no longer needed. That is good, because Linux got somewhat stricter (at least in 4.15) about mounting sysfs and the whole thing wouldn't work with containers where /sys is red-only from the start.
-rw-r--r--src/platform/tests/test-common.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index 40cce96f9d..67e74c13f2 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -1937,47 +1937,12 @@ main (int argc, char **argv)
g_error ("unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)", strerror (errsv), errsv);
}
- /* Below we need a read-only /sys (to signal that we're in an environment
- * we don't have udev and writable /sys/devices so that we still are able
- * to test device classes that modify the device attributes (such as bridges).
- *
- * We use two sysfs instances to achieve this, binding the /device subtree
- * of the writeable one to the read-only one.
- *
- * We abuse a /sys/kernel/debug for our temporary writable sysfs mount,
- * just because it's guarranteed to exist and mounts are allowed there even
- * after the sysfs mount point hardening [linux 0cbee99269]. It's just in
- * our mount namespace, we release it quickly and don't need debugfs anyway...
- * An alrernative would be to create a temporary directory, but that seems
- * like an overkill. */
-
- /* Make the mounts below /sys private to our namespace. Other mounts
- * wouldn't be permitted for good reasons. */
+ /* We need a read-only /sys so that the platform knows there's no udev. */
mount (NULL, "/sys", "sysfs", MS_SLAVE, NULL);
-
- /* Mount the read-only sysfs. */
if (mount ("sys", "/sys", "sysfs", MS_RDONLY, NULL) != 0) {
errsv = errno;
g_error ("mount(\"/sys\") failed with %s (%d)", strerror (errsv), errsv);
}
-
- /* Create the writable /sys/devices tree. */
- if (mount ("sys", "/sys/kernel/debug", "sysfs", 0, NULL) != 0) {
- errsv = errno;
- g_error ("mount(\"/sys/kernel/debug\") failed with %s (%d)", strerror (errsv), errsv);
- }
-
- /* Bind mound the writable device tree to the read-only sysfs. */
- if (mount ("/sys/kernel/debug/devices", "/sys/devices", "sysfs", MS_BIND, NULL) != 0) {
- errsv = errno;
- g_error ("mount(\"/sys\") failed with %s (%d)", strerror (errsv), errsv);
- }
-
- /* Release the temporary mount now that we bound the /devices subtree. */
- if (umount ("/sys/kernel/debug") != 0) {
- errsv = errno;
- g_error ("umount(\"/sys/kernel/debug\") failed with %s (%d)", strerror (errsv), errsv);
- }
}
nmtstp_setup_platform ();