All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
	"Jan Harkes" <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, "Andrew Morton" <akpm@linux-foundation.org>,
	"David Rheinsberg" <david@readahead.eu>,
	"Hugh Dickins" <hughd@google.com>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Jann Horn" <jannh@google.com>, "Alex Shi" <alexs@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Pedro Falcato" <pfalcato@suse.de>,
	"David Rientjes" <rientjes@google.com>,
	"Rik van Riel" <riel@redhat.com>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>,
	"Muhammad Usama Anjum" <usama.anjum@arm.com>
Cc: codalist@coda.cs.cmu.edu, linux-mm@kvack.org,
	Andrei Vagin <avagin@gmail.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, Chris Mason <mason@kernel.org>
Subject: Re: [PATCH 4/4] fs/proc/task_mmu: write-protect only with ptrace attach
Date: Mon, 30 Nov 2026 13:29:35 +0100	[thread overview]
Message-ID: <ec30fd2c-0140-4cf6-bc7e-e65dcb7f8896@kernel.org> (raw)
In-Reply-To: <20261127-mlock-madvise-mprotect-ai-fixes-v1-4-e46b2b1eb435@kernel.org>

On 11/27/26 20:45, Lorenzo Stoakes (ARM) wrote:
> The abomination known as PM_SCAN_WP_MATCHING, which makes PAGEMAP_SCAN not
> scan but mutate for eldritch uffd-wp purposes, also lacks a permission
> check when scanning the mm of another process.
> 
> It defaults to PTRACE_MODE_READ, which is insufficient for this accursed
> operation.
> 
> Therefore actually check for permissions correctly, and also make sure the
> mm is as expected when doing so.
> 
> As it stands, a task may currently manipulate page tables of the remote
> process, write-protecting uffd-wp marked pages, allocating page tables and
> splitting THP, and invoking MMU notifiers as needed.
> 
> The check is made at the time of the ioctl against its caller, as
> lock_trace() does for other /proc files, rather than at open.
> 
> A tracker which passes READ but not ATTACH on another process now gets
> EACCES for PM_SCAN_WP_MATCHING, whether it opened the pagemap file itself
> or was handed the descriptor.
> 
> Also update the pagemap documentation to reflect the change.
> 
> Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs")
> Reported-by: Chris Mason <mason@kernel.org>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>

Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David

  parent reply	other threads:[~2026-11-30 12:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 19:45 [PATCH 0/4] mm: AI-generated fixes for coda, madvise, mprotect and PAGEMAP_SCAN Lorenzo Stoakes (ARM)
2026-11-27 19:45 ` [PATCH 1/4] coda: never point a file's f_mapping at a container's mapping Lorenzo Stoakes (ARM)
2026-11-27 20:44   ` Andrew Morton
2026-11-27 22:05     ` Pedro Falcato
2026-11-28  1:10     ` Jan Harkes
2026-11-28  6:23       ` Andrew Morton
2026-11-28 19:40         ` Jan Harkes
2026-11-30 14:09           ` Lorenzo Stoakes (ARM)
2026-11-30 14:20     ` Lorenzo Stoakes (ARM)
2026-11-27 22:01   ` Pedro Falcato
2026-11-30 14:11     ` Lorenzo Stoakes (ARM)
2026-12-01 10:50   ` Lorenzo Stoakes (ARM)
2026-12-01 18:48   ` + coda-never-point-a-files-f_mapping-at-a-containers-mapping.patch added to mm-new branch Andrew Morton
2026-11-27 19:45 ` [PATCH 2/4] mm/madvise: don't declare OOM for MADV_WILLNEED swapin Lorenzo Stoakes (ARM)
2026-11-27 22:14   ` Pedro Falcato
2026-11-30 14:02     ` Lorenzo Stoakes (ARM)
2026-11-30 12:30   ` David Hildenbrand (Arm)
2026-11-30 14:05     ` Lorenzo Stoakes (ARM)
2026-12-01 18:48   ` + mm-madvise-dont-declare-oom-for-madv_willneed-swapin.patch added to mm-new branch Andrew Morton
2026-11-27 19:45 ` [PATCH 3/4] mm/mprotect: fix unpaired notifier start at address 0 Lorenzo Stoakes (ARM)
2026-11-27 22:15   ` Pedro Falcato
2026-11-30 12:28   ` David Hildenbrand (Arm)
2026-12-01 18:48   ` + mm-mprotect-fix-unpaired-notifier-start-at-address-0.patch added to mm-new branch Andrew Morton
2026-11-27 19:45 ` [PATCH 4/4] fs/proc/task_mmu: write-protect only with ptrace attach Lorenzo Stoakes (ARM)
2026-11-27 22:24   ` Pedro Falcato
2026-11-30 12:29   ` David Hildenbrand (Arm) [this message]
2026-12-01 18:48   ` + fs-proc-task_mmu-write-protect-only-with-ptrace-attach.patch added to mm-new branch Andrew Morton

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=ec30fd2c-0140-4cf6-bc7e-e65dcb7f8896@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexs@kernel.org \
    --cc=arnd@arndb.de \
    --cc=avagin@gmail.com \
    --cc=coda@cs.cmu.edu \
    --cc=codalist@coda.cs.cmu.edu \
    --cc=corbet@lwn.net \
    --cc=david@readahead.eu \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jaharkes@cs.cmu.edu \
    --cc=jannh@google.com \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mason@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=pfalcato@suse.de \
    --cc=rdunlap@infradead.org \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=usama.anjum@arm.com \
    --cc=vbabka@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.