Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp737951pxb; Thu, 30 Sep 2021 16:29:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmWJNMLY/jYx5aEn6NjHjKODtAJrW9n1Gkv/8qbpyMv9TuhcBU0dqVuH2RFajcMGigCtS5 X-Received: by 2002:a17:906:7047:: with SMTP id r7mr2372912ejj.342.1633044568873; Thu, 30 Sep 2021 16:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633044568; cv=none; d=google.com; s=arc-20160816; b=bzQ/WDxLJj1G7HURrLfgiOTLdFyoiILsE5P9hGngiBNKZn3XT8NleuJ6tRBvoZsSsg wZ+gsmQZ83qBBJQpmyhyYYnYG2EhwK/jq2NRy7XNZoPYya/cCLN6mNgBmtSE65rx0BK2 lyR8gmxCesHAyJwzDS6yAUhrZw++SfNlXMtYIBzAEqlSs14LrgLNM9o5QXZqm2uVNv0h 6UqDeXCMLr5Xs0jMabeq5jE899tl8+7Jjd4LSLfAsCxcZDy2RuQkginiaa2k3Aai2+yc AjD4mqXW98MsA9z3EJ+71fdE90nSHHO6KnFf7Sw3kgPVX919dID2eW23vDfosrMRtAVl gSLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eh34nKlBtcXIhSkXFiXgZHHEXy1pUVrM2m/QPvjGZhs=; b=Syeo+Abift4vRLMSQD1jtopfovIgelkXXOmQDTpp3dl6aVrgWW7JJZHNuP+ufbT6W2 JR/YVNGONsDBFBdnllljS6JmpIPlFRpjh7SXo+C15W+3oIcx8Dhet1A8E5SjxdWP4y2e 49ERn/BoZFqxOYev2bZjV6khOne3vHkP1+J393AWY/iinipIFRkMVvDijNTQUKzGWAOS tmB2smw7TL5Z+bGe7Tk602aXNwTftsuVaQbohEo0PjeQU8YImJhvyfhzIXfbZJ0aFTNP /LwQ1fX3EjJ82gSTjTqooYrz2Tu1TPOFpaqqUCPb0gc7zBoCbBIVRGyL5sXrH2icN/7V sPhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Hs3DNk4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si1709506edu.126.2021.09.30.16.28.57; Thu, 30 Sep 2021 16:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Hs3DNk4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbhI3X0t (ORCPT + 99 others); Thu, 30 Sep 2021 19:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345470AbhI3X0s (ORCPT ); Thu, 30 Sep 2021 19:26:48 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76B3AC06176C for ; Thu, 30 Sep 2021 16:25:05 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id d4-20020a17090ad98400b0019ece228690so7910351pjv.5 for ; Thu, 30 Sep 2021 16:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eh34nKlBtcXIhSkXFiXgZHHEXy1pUVrM2m/QPvjGZhs=; b=Hs3DNk4Z5KQlgSeNyHreuKuvEU3//1qlQHAU6a7/5w5PaGkR53udvoJVoOdC9VYM+4 oclqUS4GaVHxlcKo64+K6oVPlWjJLs2LIrFdjEdhbknM3o0FBpyNLGRmyykcmR2LSMoz 9dsuPdW3grv3wXZx7jpKUG0rnO+B3L23iItAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eh34nKlBtcXIhSkXFiXgZHHEXy1pUVrM2m/QPvjGZhs=; b=Y1/iAO85OHQzz72ACd3XjvXhrc886y76lVf9uvlwIozdJL8LHqi+zHrSeK2dxLsBgZ mc8Re8qsihQzQs/paG6OTXAUSp5pJYkyDadab8mXIaRfB66VJGTJedQhDu8bhkJ9lgBf 3SkbU+HEmgLpumr2r5iLs8s0GftMIL0hSA1HIU4WCSEthtad0QeqT9smQ9a03K/lD98I K/WfBbQkujo46codPF0KaUXz+Y8jNTShxpx58b/z+OeV2wPG0xYXhqbrGsPPQC2LFpJE V0amGQt0GUTRB9IM++hCP8F1PbIxDB84bHa3hTdmGj1fKzNoCaUCdz7bbRIYswi8ZY4j E1Fw== X-Gm-Message-State: AOAM531ia8/UhjLy8p8ga6YYYKPTMJCa+mnK+ICtuVM3G+eoPtH0rLy5 1tmSCTUUXlHN1wVn5/nKBTpnuw== X-Received: by 2002:a17:902:b205:b0:13d:b0a1:da90 with SMTP id t5-20020a170902b20500b0013db0a1da90mr6640971plr.26.1633044304955; Thu, 30 Sep 2021 16:25:04 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 23sm4600716pfw.97.2021.09.30.16.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 16:25:03 -0700 (PDT) Date: Thu, 30 Sep 2021 16:25:02 -0700 From: Kees Cook To: Suren Baghdasaryan Cc: Matthew Wilcox , Andrew Morton , Colin Cross , Sumit Semwal , Michal Hocko , Dave Hansen , "Kirill A . Shutemov" , Vlastimil Babka , Johannes Weiner , Jonathan Corbet , Al Viro , Randy Dunlap , Kalesh Singh , Peter Xu , rppt@kernel.org, Peter Zijlstra , Catalin Marinas , vincenzo.frascino@arm.com, Chinwen Chang =?utf-8?B?KOW8temMpuaWhyk=?= , Axel Rasmussen , Andrea Arcangeli , Jann Horn , apopple@nvidia.com, John Hubbard , Yu Zhao , Will Deacon , fenghua.yu@intel.com, thunder.leizhen@huawei.com, Hugh Dickins , feng.tang@intel.com, Jason Gunthorpe , Roman Gushchin , Thomas Gleixner , krisman@collabora.com, chris.hyser@oracle.com, Peter Collingbourne , "Eric W. Biederman" , Jens Axboe , legion@kernel.org, Rolf Eike Beer , Cyrill Gorcunov , Muchun Song , Viresh Kumar , Thomas Cedeno , sashal@kernel.org, cxfcosmos@gmail.com, Rasmus Villemoes , LKML , linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm , kernel-team Subject: Re: [PATCH v9 2/3] mm: add a field to store names for private anonymous memory Message-ID: <202109301621.3E03AE14F@keescook> References: <20210902231813.3597709-1-surenb@google.com> <20210902231813.3597709-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 Thu, Sep 30, 2021 at 11:56:12AM -0700, Suren Baghdasaryan wrote: > I thought more about these alternative suggestions for userspace to > record allocations but that would introduce considerable complexity > into userspace. Userspace would have to collect and consolidate this > data by some daemon, all users would have to query it for the data > (IPC or something similar), in case this daemon crashes the data would > need to be somehow recovered. So, in short, it's possible but makes > things much more complex compared to proposed in-kernel > implementation. Agreed: this is something for the kernel to manage. > OTOH, the only downside of the current implementation is the > additional memory required to store anon vma names. I checked the > memory consumption on the latest Android with these patches and > because we share vma names during fork, the actual memory required to > store vma names is no more than 600kB. Even on older phones like Pixel > 3 with 4GB RAM, this is less than 0.015% of total memory. IMHO, this > is an acceptable price to pay. I think that's entirely fine. We don't end up with any GUP games, and everything is refcounted. I think a v10 with the various nits fixed would be a good next step here. What do you think Matthew? -- Kees Cook