Skip to contentSkip to conversation

selftests/empty_mntns: fix unknown_flags_rejected using a valid clone3 flag

PATCH New Nathan Gao 1 participant 1 message Sep 16

Subsystems (2)
lore
Share & tools
lore

Nathan Gao

author
#0 lore raw

PATCH 1/1 selftests/empty_mntns: fix unknown_flags_rejected using a valid clone3 flag

unknown_flags_rejected passes a supposedly unknown flag to clone3() and expects EINVAL. The flag it uses, 0x800000000ULL, is bit 35, which is CLONE_NNP. CLONE_NNP was added in commit 24baca56fafc ("clone: add CLONE_NNP"), which got merged about the same time as this test, so the bit was still unused when the test was written. The clone3() call now succeeds and the test fails.

Use bit 63 instead. The topmost bit is the last one that can be allocated, unlike any low unused bit which can more easily become valid silently.

Fixes 5b8ffd63fbd9 ("selftests/filesystems: add clone3 tests for empty mount namespaces")
---
 .../selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/filesystems/empty_mntns/clone3_empty_mntns_test.c +1 -1
index 6370086f886df..72c20130a627f 100644
@@ -869,7 +869,7 @@ TEST(unknown_flags_rejected)
 
 	if (pid == 0) {
 		struct __clone_args args = {
-			.flags		= 0x800000000ULL,
+			.flags		= (1ULL << 63),
 			.exit_signal	= SIGCHLD,
 		};
 		pid_t ret;

base-commit: 9b87fdc9af2fbfcdb5c24a64139685ef80f6573f

Signature · 1 line
2.50.1