Skip to contentSkip to conversation

selftests/proc: make proc-maps-race work with READ_IMPLIES_EXEC

PATCH Superseded Karl Mehltretter 1 participant 1 message Jul 20

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/proc: make proc-maps-race work with READ_IMPLIES_EXEC

On READ_IMPLIES_EXEC systems, the readable test VMA already has PROT_EXEC. The replacement mapping therefore does not create a split.

Use PROT_NONE instead; it cannot merge with the readable neighbors.

Tested on QEMU versatilepb with ARM926, and on
realview-eb-mpcore with ARM11MPCore.

Fixes beb69e817246 ("selftests/proc: add /proc/pid/maps tearing from vma split test")
Assisted-by Codex:GPT-5
Cc Shuah Khan <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Andrew Morton <[email protected]>
---
 tools/testing/selftests/proc/proc-maps-race.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/proc/proc-maps-race.c +2 -1
index 1026d8c400e1..415eccb70468 100644
@@ -490,7 +490,8 @@ static bool query_addr_at(int maps_fd, void *addr,
 
 static inline bool split_vma(FIXTURE_DATA(proc_maps_race) *self)
 {
-	return mmap(self->mod_info->addr, self->page_size, self->mod_info->prot | PROT_EXEC,
+	/* PROT_NONE differs from both readable neighbors. */
+	return mmap(self->mod_info->addr, self->page_size, PROT_NONE,
 		    MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0) != MAP_FAILED;
 }
 
Signature · 1 line
2.53.0