Re: [PATCH v7 12/21] mm/vma: Track start and end for munmap in vma_munmap_struct
From: Geert Uytterhoeven
Date: Mon Aug 26 2024 - 10:01:34 EST
Hi Liam,
On Thu, Aug 22, 2024 at 9:27 PM Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> wrote:
> From: "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>
>
> Set the start and end address for munmap when the prev and next are
> gathered. This is needed to avoid incorrect addresses being used during
> the vms_complete_munmap_vmas() function if the prev/next vma are
> expanded.
>
> Add a new helper vms_complete_pte_clear(), which is needed later and
> will avoid growing the argument list to unmap_region() beyond the 9 it
> already has.
>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
Thanks for your patch, which is now commit ca39aca8db2d78ff ("mm/vma:
track start and end for munmap in vma_munmap_struct") in next-20240826.
> --- a/mm/vma.h
> +++ b/mm/vma.h
> @@ -38,6 +38,8 @@ struct vma_munmap_struct {
> struct list_head *uf; /* Userfaultfd list_head */
> unsigned long start; /* Aligned start addr (inclusive) */
> unsigned long end; /* Aligned end addr (exclusive) */
> + unsigned long unmap_start; /* Unmap PTE start */
> + unsigned long unmap_end; /* Unmap PTE end */
> int vma_count; /* Number of vmas that will be removed */
> unsigned long nr_pages; /* Number of pages being removed */
> unsigned long locked_vm; /* Number of locked pages */
> @@ -108,6 +110,8 @@ static inline void init_vma_munmap(struct vma_munmap_struct *vms,
> vms->vma_count = 0;
> vms->nr_pages = vms->locked_vm = vms->nr_accounted = 0;
> vms->exec_vm = vms->stack_vm = vms->data_vm = 0;
> + vms->unmap_start = FIRST_USER_ADDRESS;
> + vms->unmap_end = USER_PGTABLES_CEILING;
noreply@xxxxxxxxxxxxxx reported build failures for m5272c3_defconfig
http://kisskb.ellerman.id.au/kisskb/buildresult/15224802/
$ make ARCH=m68k m5272c3_defconfig mm/filemap.o
In file included from mm/internal.h:22,
from mm/filemap.c:52:
mm/vma.h: In function ‘init_vma_munmap’:
mm/vma.h:113:21: error: ‘FIRST_USER_ADDRESS’ undeclared (first use in
this function)
113 | vms->unmap_start = FIRST_USER_ADDRESS;
| ^~~~~~~~~~~~~~~~~~
mm/vma.h:113:21: note: each undeclared identifier is reported only
once for each function it appears in
mm/vma.h:114:19: error: ‘USER_PGTABLES_CEILING’ undeclared (first use
in this function)
114 | vms->unmap_end = USER_PGTABLES_CEILING;
| ^~~~~~~~~~~~~~~~~~~~~
Both are defined in include/linux/pgtable.h inside #ifdef CONFIG_MMU,
so they are not available on nommu.
> }
>
> int vms_gather_munmap_vmas(struct vma_munmap_struct *vms,
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds