Re: [PATCH v2 3/4] tools/testing/vma: eliminate dependency on vma->__vm_flags
From: Lorenzo Stoakes
Date: Fri Nov 21 2025 - 12:30:08 EST
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