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
Signed-off-by: Karl Mehltretter <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
 tools/testing/selftests/proc/proc-maps-race.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/proc/proc-maps-race.c 
b/tools/testing/selftests/proc/proc-maps-race.c
index 1026d8c400e1..415eccb70468 100644
--- a/tools/testing/selftests/proc/proc-maps-race.c
+++ b/tools/testing/selftests/proc/proc-maps-race.c
@@ -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;
 }
 
-- 
2.53.0

Reply via email to