From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA211C433F5 for ; Wed, 23 Feb 2022 08:26:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57C7A8D0002; Wed, 23 Feb 2022 03:26:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 52BC08D0001; Wed, 23 Feb 2022 03:26:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F3148D0002; Wed, 23 Feb 2022 03:26:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 2CBCC8D0001 for ; Wed, 23 Feb 2022 03:26:08 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id F09658087C for ; Wed, 23 Feb 2022 08:26:07 +0000 (UTC) X-FDA: 79173361974.10.280C436 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf15.hostedemail.com (Postfix) with ESMTP id 723E6A0002 for ; Wed, 23 Feb 2022 08:26:07 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 1A6F51F3A8; Wed, 23 Feb 2022 08:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1645604766; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ndVfaSSbyuEACVconC2Gsr4OBWhW1wlnM1YJw3WL/m4=; b=rTpqRzq9RYE6GPLlyLdc5ql1ucNt+B9SVfCJ4snbrnfDusW0DKz474W46VNr7Kx89kk8ug pg0Y0gcC05huy6tSCFwNdQLaoWpO6mLotd1RpUHdFzr/P6ZBa329Ik8WmutJ1LrGsVhGKe 3AnZBQldHejfMZu4fZWVZ4JXHrVurP8= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 02F8DA3B8A; Wed, 23 Feb 2022 08:26:03 +0000 (UTC) Date: Wed, 23 Feb 2022 09:26:02 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, ccross@google.com, sumit.semwal@linaro.org, dave.hansen@intel.com, keescook@chromium.org, willy@infradead.org, kirill.shutemov@linux.intel.com, vbabka@suse.cz, hannes@cmpxchg.org, ebiederm@xmission.com, brauner@kernel.org, legion@kernel.org, ran.xiaokai@zte.com.cn, sashal@kernel.org, chris.hyser@oracle.com, dave@stgolabs.net, pcc@google.com, caoxiaofeng@yulong.com, david@redhat.com, gorcunov@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH 2/3] mm: prevent vm_area_struct::anon_name refcount saturation Message-ID: References: <20220222054025.3412898-1-surenb@google.com> <20220222054025.3412898-2-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=rTpqRzq9; spf=pass (imf15.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 723E6A0002 X-Stat-Signature: 8bc5h7pgk9qdo4bnzompx41zocbuhbqc X-HE-Tag: 1645604767-827826 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 22-02-22 19:02:08, Suren Baghdasaryan wrote: > On Tue, Feb 22, 2022 at 7:56 AM Suren Baghdasaryan wrote: > > > > On Tue, Feb 22, 2022 at 1:17 AM Michal Hocko wrote: > > > > > > On Mon 21-02-22 21:40:24, Suren Baghdasaryan wrote: > > > > A deep process chain with many vmas could grow really high. > > > > > > This would really benefit from some numbers. With default > > > sysctl_max_map_count (64k) and default pid_max (32k) the INT_MAX could > > > be theoretically reached but I find it impractical because not all vmas > > > can be anonymous same as all available pids can be consumed for a > > > theoretical attack (if my counting is proper). > > > On the other hand any non-default configuration with any of the values > > > increased could hit this theoretically. > > > > re: This would really benefit from some numbers > > Should I just add the details you provided above into the description? > > Would that suffice? > > Hmm. According to the defaults you posted, with max number of > processes being 32k and max number of vmas per process 64k, the max > number of vmas in the system is 2147450880. That's 32767 less than > REFCOUNT_MAX=INT_MAX (2147483647) and 1073774592 less than > REFCOUNT_SATURATED (3221225472). So with those defaults we should > never hit these limits. Are we adding this protection for systems that > set non-default higher limits or am I miscalculating something? Yeah, I guess this should be the message the changelog should be sending. -- Michal Hocko SUSE Labs