Re: [PATCH] mm: nommu: add sysctl_max_map_count() check for do_mmap()

From: Hajime Tazaki

Date: Sun Jul 05 2026 - 20:19:14 EST



On Mon, 06 Jul 2026 07:15:12 +0900,
Andrew Morton wrote:
>
> On Thu, 2 Jul 2026 10:28:30 +0900 Hajime Tazaki <thehajime@xxxxxxxxx> wrote:
>
> > The sysctl variable vm.max_map_count (sysctl_max_map_count) is not
> > expose under !MMU case but used it wit the default vaule
> > DEFAULT_MAX_MAP_COUNT as a limit of count. This is currently used when
> > a vma entry is split into two chunks (split_vma()) but not used when
> > allocated (do_mmap()). As a result, even if users request a large
> > number of allocate memory, it will keep allocating until OOM happens.
> >
> > This commit introduces a check at the begining of do_mmap in nommu.c to
> > prevent this situation.
> >
> > This is detected with a LTP (Linux Test Project) test, which linked
> > below.
>
> AI review flagged a couple of issues in the current code, one quite
> serious:
>
> https://sashiko.dev/#/patchset/20260702012830.667205-1-thehajime@xxxxxxxxx

I will follow up with another patch for the issue detected here.

btw, I found (and sashiko also detected) several typos for this
particular patch. Can I send v2 patch with the additional fix, or do
you prefer that I'll only send the additional patch ?

anyway, thanks for your time to look at this.

-- Hajime