From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Xionggui Chen <evers_chen@163.com>, akpm@linux-foundation.org
Cc: shuah@kernel.org, ljs@kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Xionggui Chen <chenxionggui@lanxincomputing.com>
Subject: Re: [PATCH v2] selftests/mm: handle implicit read permissions in madv_populate
Date: Tue, 17 Nov 2026 09:58:38 +0100 [thread overview]
Message-ID: <486cd251-f7eb-4162-a1c7-92f04f480a6f@kernel.org> (raw)
In-Reply-To: <20261117070606.3752-1-evers_chen@163.com>
On 11/17/26 08:06, Xionggui Chen wrote:
> From: Xionggui Chen <chenxionggui@lanxincomputing.com>
>
> The madv_populate selftest assumes that mmap(PROT_WRITE) creates a VMA
> without VM_READ and expects MADV_POPULATE_READ to fail with EINVAL.
>
> On RISC-V, commit 6c7559f22b6f ("riscv/mm: ensure PROT_WRITE leads to
> VM_READ | VM_WRITE") makes the kernel set VM_READ for mappings requested
> with PROT_WRITE. MADV_POPULATE_READ checks this VMA permission, so it
> succeeds and the test fails incorrectly.
>
> Adjust the expected result for RISC-V using an architecture-specific
> conditional, while preserving the existing behavior on other
> architectures.
>
> On RISC-V with Linux 7.2.0, the original test fails 1 out of 16 tests,
> while the updated test passes all 16 tests.
Thanks, please don't send new revisions in reply to previous revisions next time.
>
> Link: https://lore.kernel.org/20261112031811.56500-1-evers_chen@163.com
> Fixes: e5bfac53e310 ("selftests/vm: add test for MADV_POPULATE_(READ|WRITE)")
> Signed-off-by: Xionggui Chen <chenxionggui@lanxincomputing.com>
> ---
> Changes in v2:
> - Use an architecture-specific conditional for RISC-V.
> - Remove /proc/self/maps parsing.
> - Remove the additional PROT_NONE test.
>
> tools/testing/selftests/mm/madv_populate.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c
> index 7fce5d0b622b..fa26ca2d8cf6 100644
> --- a/tools/testing/selftests/mm/madv_populate.c
> +++ b/tools/testing/selftests/mm/madv_populate.c
> @@ -81,8 +81,13 @@ static void test_prot_write(void)
> ksft_exit_fail_msg("mmap failed\n");
>
> ret = madvise(addr, SIZE, MADV_POPULATE_READ);
> +#ifdef __riscv
> + ksft_test_result(ret == 0,
> + "MADV_POPULATE_READ with PROT_WRITE\n");
> +#else
> ksft_test_result(ret == -1 && errno == EINVAL,
> "MADV_POPULATE_READ with PROT_WRITE\n");
> +#endif
>
> ret = madvise(addr, SIZE, MADV_POPULATE_WRITE);
> ksft_test_result(!ret, "MADV_POPULATE_WRITE with PROT_WRITE\n");
>
No that's a simple fix :)
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
next prev parent reply other threads:[~2026-11-17 8:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 3:18 [PATCH] selftests/mm: Handle " Xionggui Chen
2026-11-12 19:32 ` Andrew Morton
2026-11-13 3:15 ` cxg
2026-11-13 19:02 ` David Hildenbrand (Arm)
2026-11-16 7:00 ` cxg
2026-11-17 5:59 ` Andrew Morton
2026-11-17 7:06 ` [PATCH v2] selftests/mm: handle " Xionggui Chen
2026-11-17 8:58 ` David Hildenbrand (Arm) [this message]
2026-11-17 9:34 ` cxg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=486cd251-f7eb-4162-a1c7-92f04f480a6f@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chenxionggui@lanxincomputing.com \
--cc=evers_chen@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®