Re: [PATCH v3 3/4] mm: prevent KSM from breaking VMA merging for new VMAs
From: Lorenzo Stoakes
Date: Mon Jun 23 2025 - 05:17:38 EST
On Sun, Jun 22, 2025 at 12:39:31PM -0700, Andrew Morton wrote:
> On Fri, 20 Jun 2025 13:48:09 +0100 Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx> wrote:
>
> > Hi Andrew,
> >
> > Sending a fix-patch for this commit due to a reported syzbot issue which
> > highlighted a bug in the implementation.
> >
> > I discuss the syzbot report at [0].
> >
> > [0]: https://lore.kernel.org/all/a55beb72-4288-4356-9642-76ab35a2a07c@lucifer.local/
> >
> > There's a very minor conflict around the map->vm_flags vs. map->flags change,
> > easily resolvable, but if you need a respin let me know.
>
> I actually saw 4 conflicts, fixed various things up and...
>
> > @@ -2487,6 +2496,11 @@ static int __mmap_new_vma(struct mmap_state *map, struct vm_area_struct **vmap)
> > if (error)
> > goto free_iter_vma;
> >
> > + if (!map->check_ksm_early) {
> > + update_ksm_flags(map);
> > + vm_flags_init(vma, map->vm_flags);
> > + }
> > +
>
> Guessing map->flags was intended here, I made that change then unmade
> it in the later mm-update-core-kernel-code-to-use-vm_flags_t-consistently.patch.
>
> I'll do a full rebuild at a couple of bisection points, please check
> that all landed OK.
>
Thanks, appreciate it, apologies for the inconveniece! It all looks good to me
from my side.
Cheers, Lorenzo