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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 241B5C433EF for ; Thu, 30 Sep 2021 23:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CB52619E7 for ; Thu, 30 Sep 2021 23:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349158AbhI3X0u (ORCPT ); Thu, 30 Sep 2021 19:26:50 -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-Google-Smtp-Source: ABdhPJylqjkv4pN89l4jFNBRqBmfAjaekWIwj3On6XS7U+IYWAgJXHbj5PZrkmGMBxnVbJZPind/Dg== 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