[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2bb8d6a-d131-4c12-871e-0bca5dbab253@lucifer.local>
Date: Tue, 27 May 2025 16:27:24 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Pu Lehui <pulehui@...weicloud.com>, mhiramat@...nel.org,
peterz@...radead.org, akpm@...ux-foundation.org,
Liam.Howlett@...cle.com, vbabka@...e.cz, jannh@...gle.com,
pfalcato@...e.de, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
pulehui@...wei.com
Subject: Re: [RFC PATCH v2 1/2] mm/mremap: Fix uprobe anon page be
overwritten when expanding vma during mremap
On Tue, May 27, 2025 at 05:17:15PM +0200, Oleg Nesterov wrote:
> On 05/27, Lorenzo Stoakes wrote:
> >
> > I am by the way assuming that uprobes work by installing a special PTE at
> > page offset 0 and only in the case where there is something installed here
> > do we need to worry.
>
> perhaps I misunderstood you but no...
>
> Basically, we have uprobe_register(struct inode *inode, loff_t offset, ...).
> If / when a process mmaps this inode/file and the (new) VMA includes this offset,
> we need to call uprobe_mmap() to install the breakpoint at the virtual address
> which corresponds to this offset.
OK this was based on the explanation given re: zero offset.
So presumably then this is determined by the perf_event_attr.probe_offset field?
OK well we can drop the vm_pgoff predicate and things should still work because,
after the move:
A B
|-----------------------||--------------------------|
| VMA to be merged with || VMA being moved in place |
|-----------------------||--------------------------|
If A contains the relevant breakpoint(s), then they will stay in place, as
move_page_tables() won't overwrite them.
If B contains them, then the new mechanism that prevents uprobe_mmap() from
installing a new one (orphaning the old) will make everything right.
So we simply take my approach, and drop the vm_pgoff condition and everything
should work fine :)
Obviously let me know if you see any flaw in this.
>
> Oleg.
>
Cheers, Lorenzo
Powered by blists - more mailing lists