From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53C7E36495F for ; Sun, 5 Jul 2026 22:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783289714; cv=none; b=s/DY43XNpjUJESAw7eP0R/r2zHdcWRuENDYuRaCsMBr5/7PVENQPEovAMM35S0oCGGqONdSaoerJEX7+vsekBWP3gekxwX/6jWSPB5VQUn3SIAr2YKx7TfjcnQV9arYJedrK8NjQfJ0gTTP6W8ecr+iu7q5lGIYUI/JH5/2RM3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783289714; c=relaxed/simple; bh=I0pXH6sSjMNr6fr+co3Fh/sgFoLd8lbaOD8o1eEtoto=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=CXapIDhWN/dd4c1M71evzuWunIVqzDFDxelIFwcOEA1GF0/z7LuuQyGKRiatEV5MFPdhoLZjCuPrx8iUzgn36xBuuHjT5hFymA7HiJzXThM+ll5FiJ/zWYSLKAdtm16idl7ZtXgImaN/TmeqXGsl0c9ZT0FCbiW5dQmWPos7rIA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=Dd3TD8ef; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Dd3TD8ef" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A74EC1F000E9; Sun, 5 Jul 2026 22:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1783289712; bh=nXuLCJldxAxxF5W+GFvVR6nldqpJGGJTsZJb+RBW/5w=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Dd3TD8efaxwxZY6lOjY7jb6GwMR02CtgoeG20uFUH27MueOEGV8Zgy/bHt2K2ISOW 2O05TiyLAmwwdsYdc4DyW1YIDD/VSRH0S4/SaKLo0ExNUjuTMu4noPQvdH9UE6ciFX N/+Q1kR4A55CLKJzSYlNnrwiIQ9b50SCD3aeJ+vw= Date: Sun, 5 Jul 2026 15:15:12 -0700 From: Andrew Morton To: Hajime Tazaki Cc: liam@infradead.org, ljs@kernel.org, vbabka@kernel.org, jannh@google.com, pfalcato@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: nommu: add sysctl_max_map_count() check for do_mmap() Message-Id: <20260705151512.5edabd9bb5d11cb6f1c6309f@linux-foundation.org> In-Reply-To: <20260702012830.667205-1-thehajime@gmail.com> References: <20260702012830.667205-1-thehajime@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 2 Jul 2026 10:28:30 +0900 Hajime Tazaki 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@gmail.com