linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Pu Lehui <pulehui@huaweicloud.com>,
	mhiramat@kernel.org, oleg@redhat.com, peterz@infradead.org,
	akpm@linux-foundation.org, Liam.Howlett@oracle.com,
	vbabka@suse.cz, jannh@google.com, pfalcato@suse.de,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, pulehui@huawei.com
Subject: Re: [PATCH v1 1/4] mm: Fix uprobe pte be overwritten when expanding vma
Date: Mon, 2 Jun 2025 14:26:21 +0200	[thread overview]
Message-ID: <6dd3af08-b3be-4a68-af3d-1fc1b79f4279@redhat.com> (raw)
In-Reply-To: <009fe1d5-9d98-45f1-89f0-04e2ee8f0ade@lucifer.local>

On 02.06.25 13:55, Lorenzo Stoakes wrote:
> On Fri, May 30, 2025 at 08:51:14PM +0200, David Hildenbrand wrote:
>>>    	if (vp->remove) {
>>> @@ -1823,6 +1829,14 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
>>>    		faulted_in_anon_vma = false;
>>>    	}
>>> +	/*
>>> +	 * If the VMA we are copying might contain a uprobe PTE, ensure
>>> +	 * that we do not establish one upon merge. Otherwise, when mremap()
>>> +	 * moves page tables, it will orphan the newly created PTE.
>>> +	 */
>>> +	if (vma->vm_file)
>>> +		vmg.skip_vma_uprobe = true;
>>> +
>>
>> Assuming we extend the VMA on the way (not merge), would we handle that
>> properly?
>>
>> Or is that not possible on this code path or already broken either way?
> 
> I'm not sure in what context you mean expand, vma_merge_new_range() calls
> vma_expand() so we call an expand a merge here, and this flag will be
> obeyed.

Essentially, an mremap() that grows an existing mapping while moving it.

Assume we have

[ VMA 0 ] [ VMA X]

And want to grow VMA 0 by 1 page.

We cannot grow in-place, so we'll have to copy VMA 0 to another VMA, and 
while at it, expand it by 1 page.

expand_vma()->move_vma()->copy_vma_and_data()->copy_vma()


But maybe I'm getting lost in the code. (e.g., expand_vma() vs. 
vma_expand() ... confusing :) )

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-06-02 12:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29 15:56 [PATCH v1 0/4] " Pu Lehui
2025-05-29 15:56 ` [PATCH v1 1/4] mm: " Pu Lehui
2025-05-30  9:28   ` Lorenzo Stoakes
2025-05-30 18:51   ` David Hildenbrand
2025-06-02 11:55     ` Lorenzo Stoakes
2025-06-02 12:26       ` David Hildenbrand [this message]
2025-06-02 13:26         ` Lorenzo Stoakes
2025-06-02 16:28           ` David Hildenbrand
2025-06-02 17:01             ` Lorenzo Stoakes
2025-06-03 12:16               ` David Hildenbrand
2025-06-04  1:51                 ` Andrew Morton
2025-05-29 15:56 ` [PATCH v1 2/4] mm: Expose abnormal new_pte during move_ptes Pu Lehui
2025-05-29 19:19   ` Andrew Morton
2025-05-30  1:24     ` Pu Lehui
2025-05-30  3:47       ` Andrew Morton
2025-05-30 10:21   ` Lorenzo Stoakes
2025-05-30 16:44     ` Oleg Nesterov
2025-05-29 15:56 ` [PATCH v1 3/4] selftests/mm: Extract read_sysfs and write_sysfs into vm_util Pu Lehui
2025-05-30 11:48   ` Lorenzo Stoakes
2025-06-03  7:17     ` Pu Lehui
2025-06-04  2:36       ` Andrew Morton
2025-06-04  8:21         ` Pu Lehui
2025-05-29 15:56 ` [PATCH v1 4/4] selftests/mm: Add test about uprobe pte be orphan during vma merge Pu Lehui
2025-05-30 11:32   ` Lorenzo Stoakes
2025-06-03  7:08     ` Pu Lehui
2025-06-03  9:56       ` Lorenzo Stoakes
2025-06-10 10:37   ` Aishwarya
2025-06-10 11:27     ` Pedro Falcato
2025-06-10 11:34       ` Mark Brown

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=6dd3af08-b3be-4a68-af3d-1fc1b79f4279@redhat.com \
    --to=david@redhat.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhiramat@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pfalcato@suse.de \
    --cc=pulehui@huawei.com \
    --cc=pulehui@huaweicloud.com \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /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