mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: cxg <evers_chen@163.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, chenxionggui@lanxincomputing.com
Subject: Re: [PATCH] selftests/mm: Handle implicit read permissions in madv_populate
Date: Mon, 16 Nov 2026 15:00:56 +0800	[thread overview]
Message-ID: <206b5151-c527-4b7b-8694-dd9c6cfd916f@163.com> (raw)
In-Reply-To: <64e1c24f-08fb-437e-80c1-e5b486d15200@kernel.org>

Thanks for the suggestion.

Agreed. Since this behavior is specific to RISC-V, a simple 
architecture-specific check is sufficient.

I've simplified the patch to use |#ifdef __riscv|in |test_prot_write()|, 
removing the |/proc/self/maps|parsing and the additional PROT_NONE test.

The updated test passes all 16 tests on RISC-V with Linux 7.2.0.

Since the original patch is already in Andrew's mm tree, would you 
prefer a v2 or an incremental fix?

Thanks,
Xionggui


On 11/14/26 03:02, David Hildenbrand (Arm) wrote:
> On 11/12/26 04:18, Xionggui Chen wrote:
>> From: Xionggui Chen <chenxionggui@lanxincomputing.com>
>>
>> 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.
>
>


      reply	other threads:[~2026-11-16  7:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  3:18 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 [this message]

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=206b5151-c527-4b7b-8694-dd9c6cfd916f@163.com \
    --to=evers_chen@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=chenxionggui@lanxincomputing.com \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@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®