Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2725003pxb; Fri, 8 Oct 2021 13:58:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy8/s+k2T2VJRLo5GuOblN6E7pYgMWAYx6bUegtb/ip2KvFIT1V8Mo5U4yJwbHkZl5+hjF X-Received: by 2002:a63:ef01:: with SMTP id u1mr6499240pgh.336.1633726739430; Fri, 08 Oct 2021 13:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633726739; cv=none; d=google.com; s=arc-20160816; b=EqdrJ2bSL2Gb6YU5FKt0asxYNQ4oHkR0dT+H60jjAW0ziHi9CjnEao9UM9L8aVFolk M0M3m5C+dZut/c5uRHkchpZvPWAtSzh35g04undTiUH/A/awHEYUggOTWDBoZrIl/8TX zDsRe0ZAbLKTATbC3vHsWa2g4kJgEHQoSQ3CUPP8TNCR/ktnDxKjXXPA8efKCcz8h0Hs uwA2HvY6PEUhkp1YiD4N+ZZUiTwjnxvupwcG5Ue6Yk4Xf/RDFQS5RGW11CiT5qDj9/e+ uEt5xf4zCzRoqYlG2DwlXWUJa83Qna5EKvYXc2RM4hjdGmGuf8U6QLEtooU08nsD6OCG aqUQ== 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=IjJJiWQU/XhRbwSW4a6J5pEI82Dwvbf4Msp/9IsGztA=; b=px8V7CXTWU3LVuuQ7FARev7rGlkf8t+MJCRTXYuAiTvEWziM/zjE67yZaMMWWU3D5i 0SYXxwNCi+6MYezLhJaCsjbqEflNbWMsU6PQMsyHsWpaaq+z11i/11142jA07i3OjozG ALHzgnE+pByENgYzts5jgFrthsTvWKSi1nKpXejMMTmWG3Covmob4hL0Q6ZnU+JdghGe i/MEbb0Ivgx3FGS8rxpOQbLbtYHmZ7G27c4jZ0xPKR6LhRPE8suVZmNrUXpNlWiHgK36 /t2CSNiKwSbQiLQI35Yc3T7fEHNC+K3nJIcV4F4FK+9ci2jgE1fJRc8kv+CSjo8rTHMW 39Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="fuF/48s/"; 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 q2si540440pfj.271.2021.10.08.13.58.47; Fri, 08 Oct 2021 13:58:59 -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="fuF/48s/"; 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 S243241AbhJHU77 (ORCPT + 99 others); Fri, 8 Oct 2021 16:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231587AbhJHU77 (ORCPT ); Fri, 8 Oct 2021 16:59:59 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5097EC061755 for ; Fri, 8 Oct 2021 13:58:03 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id r201so4232124pgr.4 for ; Fri, 08 Oct 2021 13:58:03 -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=IjJJiWQU/XhRbwSW4a6J5pEI82Dwvbf4Msp/9IsGztA=; b=fuF/48s/XKLjw/WxekTae8fxsnWdv9YZmnzgUBVcpUj7wDFyoAh9dbVeWHwfDtkKDu RiFV0cdkUHd/WrfAjkgqUH34GYwNOU8Km6wcNGt+b1nCWLn47S0Ft8Xq1zZt+StdVMvU jBfM3LscUBzEFw2GiqY3yuUIwXQjskDaNCMz4= 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=IjJJiWQU/XhRbwSW4a6J5pEI82Dwvbf4Msp/9IsGztA=; b=PreCpDVkQcVWOM/xwrZ44y+w//1dtVqlsChBkrLk/Orjy9CzE+GDItoD0DXQntgnoL 9Is+BHVX4TeqdClFihevLGth75MgEJB+msmoxvtl00sTWeZDoTvKsEcEfip3XKiXaLft 3UDpK2hKAwQzQg2XXAPzkB147UoY0CtRM50bLwPv2yUehigqwqRrqXcdMuNCgjRhUYk1 2SRIPSlNh1Cy9jnUDfaLKeHVJ5do1aiW5K6RTE/iAw+iz3PNZjhLbrO+TRPExTtSgKtn hx36cLt1oAmfFvf2vbuIXL8w2VPrC05Ke3tWP48wY0Azg8hlKQBOjTHnzHVi3A7HTjG9 3Rqw== X-Gm-Message-State: AOAM533p0+PodJDVDzHCdjaGledrwU5lvxjeFi5LxyN9XzeQGa8xGzIB xqqWmNuJIgjW+ibeDfE0NjdZjw== X-Received: by 2002:a05:6a00:1481:b0:43d:275b:7ba4 with SMTP id v1-20020a056a00148100b0043d275b7ba4mr12439099pfu.63.1633726682678; Fri, 08 Oct 2021 13:58:02 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e9sm134233pjl.41.2021.10.08.13.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 13:58:02 -0700 (PDT) Date: Fri, 8 Oct 2021 13:58:01 -0700 From: Kees Cook To: Michal Hocko Cc: Suren Baghdasaryan , Pavel Machek , Rasmus Villemoes , David Hildenbrand , John Hubbard , Andrew Morton , Colin Cross , Sumit Semwal , Dave Hansen , Matthew Wilcox , "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, 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 , 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, LKML , linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm , kernel-team Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: <202110081344.FE6A7A82@keescook> References: <92cbfe3b-f3d1-a8e1-7eb9-bab735e782f6@rasmusvillemoes.dk> <20211007101527.GA26288@duo.ucw.cz> <202110071111.DF87B4EE3@keescook> 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 Fri, Oct 08, 2021 at 08:34:47AM +0200, Michal Hocko wrote: > I am sorry but there were no strong arguments mentioned for strings so > far. Effectively string require a more complex and more resource hungry > solution. The only advantage is that strings are nicer to read for > humans. How I see it: - Strings are already present in the "maps" output, so this doesn't create a burden on userspace to grow new parsers. - Strings for "anon" specifically have no required format (this is good) it's informational like the task_struct::comm and can (roughly) anything. There's no naming convention for memfds, AF_UNIX, etc. Why is one needed here? That seems like a completely unreasonable requirement. - Strings need to be in kernel space because cross-process GUP has been a constant source of security flaws. > There hasn't been any plan presented for actual naming convention or how > those names would be used in practice. Except for a more advanced > resource management and that sounds like something that can work with > ids just fine. There doesn't need to be and there shouldn't be. Why aren't memfds names an id? Because, to quote the man-page, "... serves only for debugging purposes. Names do not affect the behavior of the file descriptor, and as such multiple files can have the same name without any side effects." And they aren't filtered _at all_ either. I think the anonymous vma name series has gone out of its way to be safe and sane while still providing the ease-of-use that it was designed to provide. > Initially I was not really feeling strongly one way or other but more we > are discussing the topic the more I see that strings have a very weak > justification behind. I just don't see any _down_ side to gaining this. There's only resource utilization when it's used, and the complexity is minimal. -- Kees Cook