linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>, Zi Yan <ziy@nvidia.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	"Liam R . Howlett" <Liam.Howlett@oracle.com>,
	Nico Pache <npache@redhat.com>,
	Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
	Barry Song <baohua@kernel.org>, Jann Horn <jannh@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Lance Yang <ioworker0@gmail.com>, SeongJae Park <sj@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>
Subject: Re: [PATCH v2 5/5] mm/madvise: eliminate very confusing manipulation of prev VMA
Date: Tue, 24 Jun 2025 19:57:09 +0200	[thread overview]
Message-ID: <89491be7-a480-4692-a6cf-ec54e02eb684@suse.cz> (raw)
In-Reply-To: <dca94cde-8afb-4eab-8e57-3f508624d670@lucifer.local>

On 6/24/25 15:16, Lorenzo Stoakes wrote:
> Hi Andrew,
> 
> stress-ng picked up a very subtle bug here. Please apply this fix-patch to
> correct it!
> 
> Cheers, Lorenzo
> 
> ----8<----
> From a04de12e1deb50e708392b0e716612f26c6b386a Mon Sep 17 00:00:00 2001
> From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Date: Tue, 24 Jun 2025 14:14:19 +0100
> Subject: [PATCH] mm/madvise: fix very subtle bug
> 
> With thanks to stress-ng --madvise :)
> 
> vma may have been updated (in the modify call in madvise_update_vma()), so
> we can't assign prev = vma, we must first reassign vma to
> madv_behavior->vma to account for this, before setting prev = vma.

So glad we eliminated very confusing manipulation of prev VMA :) sigh...

LGTM (not worth much it seems...)

> ---
>  mm/madvise.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/madvise.c b/mm/madvise.c
> index 4491bf080f55..c467ee42596f 100644
> --- a/mm/madvise.c
> +++ b/mm/madvise.c
> @@ -1665,8 +1665,8 @@ int madvise_walk_vmas(struct madvise_behavior *madv_behavior)
>  			vma = NULL;
>  			madv_behavior->lock_dropped = false;
>  		} else {
> -			prev = vma;
>  			vma = madv_behavior->vma;
> +			prev = vma;
>  		}
> 
>  		if (vma && range->end < vma->vm_end)
> --
> 2.50.0



  reply	other threads:[~2025-06-24 17:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 15:33 [PATCH v2 0/5] madvise cleanup Lorenzo Stoakes
2025-06-20 15:33 ` [PATCH v2 1/5] mm/madvise: remove the visitor pattern and thread anon_vma state Lorenzo Stoakes
2025-06-20 16:57   ` Zi Yan
2025-06-20 17:12   ` SeongJae Park
2025-06-23 22:38   ` Barry Song
2025-06-25  7:43   ` David Hildenbrand
2025-06-20 15:33 ` [PATCH v2 2/5] mm/madvise: thread mm_struct through madvise_behavior Lorenzo Stoakes
2025-06-20 16:59   ` Zi Yan
2025-06-20 17:25   ` SeongJae Park
2025-06-23 22:42   ` Barry Song
2025-06-20 15:33 ` [PATCH v2 3/5] mm/madvise: thread VMA range state " Lorenzo Stoakes
2025-06-20 17:02   ` Zi Yan
2025-06-20 17:33   ` SeongJae Park
2025-06-24  1:05   ` Barry Song
2025-06-20 15:33 ` [PATCH v2 4/5] mm/madvise: thread all madvise state through madv_behavior Lorenzo Stoakes
2025-06-20 17:56   ` SeongJae Park
2025-06-20 18:01     ` Lorenzo Stoakes
2025-06-20 18:12       ` SeongJae Park
2025-06-20 15:33 ` [PATCH v2 5/5] mm/madvise: eliminate very confusing manipulation of prev VMA Lorenzo Stoakes
2025-06-20 17:13   ` Zi Yan
2025-06-20 18:10   ` SeongJae Park
2025-06-24 13:16   ` Lorenzo Stoakes
2025-06-24 17:57     ` Vlastimil Babka [this message]
2025-06-24 18:01       ` Lorenzo Stoakes
2025-06-20 17:21 ` [PATCH v2 0/5] madvise cleanup SeongJae Park
2025-06-20 17:33   ` Lorenzo Stoakes

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=89491be7-a480-4692-a6cf-ec54e02eb684@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=dev.jain@arm.com \
    --cc=ioworker0@gmail.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=npache@redhat.com \
    --cc=ryan.roberts@arm.com \
    --cc=sj@kernel.org \
    --cc=surenb@google.com \
    --cc=ziy@nvidia.com \
    /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;
as well as URLs for NNTP newsgroup(s).