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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89E9EC433EF for ; Wed, 23 Feb 2022 08:26:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237992AbiBWI0h (ORCPT ); Wed, 23 Feb 2022 03:26:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233108AbiBWI0e (ORCPT ); Wed, 23 Feb 2022 03:26:34 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8348666F9D for ; Wed, 23 Feb 2022 00:26:07 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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