Lines Matching +full:ns +full:- +full:firmware

1 // SPDX-License-Identifier: GPL-2.0
2 /* Test triggering of loading of firmware from different mount
3 * namespaces. Expect firmware to be always loaded from the mount
31 umount("/lib/firmware"); in die()
57 if (write(fd, fw, sizeof(fw) -1) != sizeof(fw) -1) in setup_fw()
68 if (mount("test", "/lib/firmware", "tmpfs", MS_RDONLY, NULL) == -1) in test_fw_in_ns()
69 die("blocking firmware in parent ns failed\n"); in test_fw_in_ns()
72 if (child == -1) { in test_fw_in_ns()
81 if (pid == -1) { in test_fw_in_ns()
93 umount("/lib/firmware"); in test_fw_in_ns()
101 if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL) == -1) in test_fw_in_ns()
102 die("remount root in child ns failed\n"); in test_fw_in_ns()
105 if (mount("test", "/lib/firmware", "tmpfs", MS_RDONLY, NULL) == -1) in test_fw_in_ns()
106 die("blocking firmware in child ns failed\n"); in test_fw_in_ns()
108 umount("/lib/firmware"); in test_fw_in_ns()
117 const char *fw_name = "test-firmware.bin"; in main()
122 /* Mount tmpfs to /lib/firmware so we don't have to assume in main()
124 if (mount("test", "/lib/firmware", "tmpfs", 0, NULL) == -1) in main()
125 die("mounting tmpfs to /lib/firmware failed\n"); in main()
128 if (asprintf(&fw_path, "/lib/firmware/%s", fw_name) < 0) in main()
134 /* Positive case: firmware in PID1 mount namespace */ in main()
135 printf("Testing with firmware in parent namespace (assumed to be same file system as PID1)\n"); in main()
137 die("error: failed to access firmware\n"); in main()
139 /* Negative case: firmware in child mount namespace, expected to fail */ in main()
140 printf("Testing with firmware in child namespace\n"); in main()
142 die("error: firmware access did not fail\n"); in main()
146 umount("/lib/firmware"); in main()