Re: [PATCH] selftests/mm: Handle implicit read permissions in madv_populate
From: David Hildenbrand (Arm)
Date: Fri Nov 13 2026 - 14:48:33 EST
On 11/12/26 04:18, Xionggui Chen wrote:
> From: Xionggui Chen <chenxionggui@xxxxxxxxxxxxxxxxxxx>
>
> The madv_populate selftest assumes that a mapping created with
> PROT_WRITE cannot be read, and expects MADV_POPULATE_READ to fail
> with EINVAL.
>
> However, some architectures, including RISC-V, may implicitly grant
> read permission to PROT_WRITE mappings. On such architectures,
> MADV_POPULATE_READ succeeds, causing the test to fail incorrectly.
>
> Check the actual VMA permissions through /proc/self/maps and adjust
> the expected result accordingly.
>
> Add a PROT_NONE test to verify that MADV_POPULATE_READ still fails
> with EINVAL for mappings without read permission.
>
> On RISC-V with Linux 7.2.0, the original test fails 1 out of 16
> tests, while the updated test passes all 17 tests.
I would have said, if RISCV is the odd one, special case it and call it a day?
That would keep the changes to test_prot_write() to a minimum.
--
Cheers,
David