Re: [PATCH v2 3/4] tools/testing/vma: eliminate dependency on vma->__vm_flags
From: Lorenzo Stoakes
Date: Mon Nov 24 2025 - 07:49:09 EST
Hi Andrew,
It seems that the ordering of things has messed us up a bit here!
So this patch (3/4) currently introduces an issue where vm_flags_reset() is
missing from the VMA userland tests.
Then 4/4, now with the vma_internal.h fixes in place, puts vm_flags_reset()
back in place (this was my mistake in the series originally!).
But then this fix-patch, now applied as the latest patch from me in mm-new,
breaks the tests again by duplicating this function :)
So, I'm not sure if too late for rebases - if not, then just squash this
into 3/4.
If it is - then just drop this patch altogether and we'll live with this
being broken for a single commit!
Cheers, Lorenzo
On Fri, Nov 21, 2025 at 05:28:15PM +0000, Lorenzo Stoakes wrote:
> Hi Andrew,
>
> Some small silly issue here, for some reason I seemed to have vm_flags_reset()
> available from the VMA tests when I tested but err, that doesn't seem to be the
> case at all.
>
> Again I realise this is in mm-stable so this might be fiddly so we might have to
> live with minor bisect pain :(
>
> Cheers, Lorenzo
>
> ----8<----
> From afe5af105e7d64e39a4280c7fc8b34ad67cf0db0 Mon Sep 17 00:00:00 2001
> From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Date: Fri, 21 Nov 2025 17:25:18 +0000
> Subject: [PATCH] tools/testing/vma: add missing stub
>
> The vm_flags_reset() function is not available in the userland VMA tests,
> so add a stub which const-casts vma->vm_flags and avoids the upcoming
> removal of the vma->__vm_flags field.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> ---
> tools/testing/vma/vma_internal.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h
> index 37fd479d49ce..f90a9b3c1880 100644
> --- a/tools/testing/vma/vma_internal.h
> +++ b/tools/testing/vma/vma_internal.h
> @@ -1760,4 +1760,11 @@ static inline int do_munmap(struct mm_struct *, unsigned long, size_t,
> return 0;
> }
>
> +static inline void vm_flags_reset(struct vm_area_struct *vma, vm_flags_t flags)
> +{
> + vm_flags_t *dst = (vm_flags_t *)(&vma->vm_flags);
> +
> + *dst = flags;
> +}
> +
> #endif /* __MM_VMA_INTERNAL_H */
> --
> 2.51.2