Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2114863pxb; Fri, 8 Oct 2021 00:47:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGqBrUurhRxb2M1GqpSri2bG6akK6CeWOjXIRS2oGyFv+q/xyHbRTSio+OIl1iQ9A092ov X-Received: by 2002:a17:906:3891:: with SMTP id q17mr2375920ejd.220.1633679256084; Fri, 08 Oct 2021 00:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633679256; cv=none; d=google.com; s=arc-20160816; b=hvOQATy4tVCHSsDSUnRViBnbRAAIo2HxR1wqNgMmtYvP8nrSiB7VzYXtTS0xFZbTK5 J+DXWAHx4DSGdRHQQbajkxCZsPbKITjGkI39/AGdzz/k6fmdBRPwh5zjPpT3A6zXjax9 AQq/3RyREEFO1D0lsIzajgZ7zt+XPIHoHNAXnmTE9NYf870ODX5etDZC29fT6gT1VaMw zni3l8W+amOdtfl5Wbilu+PwvI4lhv4qBpo7dXPh6MaplQjNYjZJNF1l6RYmUjMPU3BQ P3SRkdYGSz7zSMCuI3ZkdvEjy/T74Ni2MzOYGgokCiGh1vaiDVIVs6SIrCuryaixKzfP 4gGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject :organization:from:references:cc:to:dkim-signature; bh=u7mEpKXIXki4+AfZLhYahWvke1tUWfWxeSdFeF0Y8RQ=; b=z+D/VcWnYd+hSETzOXv8Y4N/CQWgohvBE0sWuJv1BSSTcOw0UOT5PzkttF08Fc9OfH tYuPLErAqMa75nP+2mc/wncwgYYSvM/nPaIlCCqIHBtr+z1kxx8pjRO2Vpby52t4sAaC 4Fz5nq+byhfRWKz4xa2MQ86U+UjjoRlT7Gro/GEn/h8L06RiW5nZzYrPA4hosY0HVr3y mbAAb5Kmn9WUZnXsN6B9L6h9LH4nsXPkPTgF78AOE8nAZFOvMo4BhPwJGBAiHKKNVnDP WcCl9EBslPjCMTHcCFrCxZGoZT7vUb81D6qEtyX2SwtG0o88pQfTklKd8Qn7CqHiCIG7 fiEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="EjIuBF/m"; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lb9si2462745ejc.232.2021.10.08.00.47.08; Fri, 08 Oct 2021 00:47:36 -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=@redhat.com header.s=mimecast20190719 header.b="EjIuBF/m"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbhJHHqC (ORCPT + 99 others); Fri, 8 Oct 2021 03:46:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42840 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbhJHHqA (ORCPT ); Fri, 8 Oct 2021 03:46:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633679045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u7mEpKXIXki4+AfZLhYahWvke1tUWfWxeSdFeF0Y8RQ=; b=EjIuBF/m7p67TShfNm1PpNZaPF1rPelqQjlOWQuOYx1LfGozDxPt8wVED9DbwLanwo7DR1 roY4DN3dm5tqALmuwhfEULceDM5SMoNT8yaUTPLi0D9+4FxD9HDhw0ZRUYb0XiLASv2AMz YlbsyQO5V+JiGC04o5AhaWh0A1Z0kv0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-591-8ZaqRnOrOuyIC0HhzOGvbQ-1; Fri, 08 Oct 2021 03:44:04 -0400 X-MC-Unique: 8ZaqRnOrOuyIC0HhzOGvbQ-1 Received: by mail-wr1-f71.google.com with SMTP id k16-20020a5d6290000000b00160753b430fso6643739wru.11 for ; Fri, 08 Oct 2021 00:44:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=u7mEpKXIXki4+AfZLhYahWvke1tUWfWxeSdFeF0Y8RQ=; b=plrz5EshPGxJonu85v0/O1hNr8AyXn+QhSP6n3fExkNCYrzFxElN2Zf1axxcRE+App CKEI4GXnhURHR+9bSogd+XOEuJ9HZ4Vc00FSTrTgnc47agj0VmonpXZFVsPkkEcFSuwZ uq7MVAivYzPRuqBWbBZBwe+AXTyLQs2k910QK0LMdi5BVIc0907g1AW6y2cwPTZo2Yjz CQ9MXbiTiQhP9+orr+4MEbGOzw+dKQIgQbPrVUPzbTyJDu/jZaAwoSXm3Cyn4WQ0soN3 avu341S4Y8TiLUx/jOUZx76KgsJR4i6obAJpE6kRfnMH3tOKqDuWFb9/tjp8ajfyT84h DOxw== X-Gm-Message-State: AOAM533X2GgXouYfhMI/bU3bItpsxvxCzsr+IAYHDI1NmAyHZCM3qqj3 6v5x32WntvnLokQwv5EAOVrJbLqlZbua/wivObDAbgT95SpL1+WzLpP2x2FRnt260NhKpFL7sOu 6CnULvr38sPf+oIetaN1LPmpc X-Received: by 2002:a1c:22d7:: with SMTP id i206mr1764319wmi.122.1633679042870; Fri, 08 Oct 2021 00:44:02 -0700 (PDT) X-Received: by 2002:a1c:22d7:: with SMTP id i206mr1764260wmi.122.1633679042645; Fri, 08 Oct 2021 00:44:02 -0700 (PDT) Received: from [192.168.3.132] (p5b0c676e.dip0.t-ipconnect.de. [91.12.103.110]) by smtp.gmail.com with ESMTPSA id u5sm1676921wrg.57.2021.10.08.00.44.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Oct 2021 00:44:01 -0700 (PDT) To: Rasmus Villemoes , John Hubbard , Suren Baghdasaryan , Kees Cook Cc: Michal Hocko , Pavel Machek , 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, =?UTF-8?B?Q2hpbndlbiBDaGFuZyAo5by16Yym5paHKQ==?= , 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 References: <20211006175821.GA1941@duo.ucw.cz> <92cbfe3b-f3d1-a8e1-7eb9-bab735e782f6@rasmusvillemoes.dk> <20211007101527.GA26288@duo.ucw.cz> <202110071111.DF87B4EE3@keescook> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting Message-ID: Date: Fri, 8 Oct 2021 09:43:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08.10.21 09:25, Rasmus Villemoes wrote: > On 07/10/2021 21.02, John Hubbard wrote: >> On 10/7/21 11:50, Suren Baghdasaryan wrote: >> ... > >>>>> The desire is for one of these two parties to be a human who can get >>>>> the data and use it as is without additional conversions. >>>>> /proc/$pid/maps could report FD numbers instead of pathnames, which >>>>> could be converted to pathnames in userspace. However we do not do >>>>> that because pathnames are more convenient for humans to identify a >>>>> specific resource. Same logic applies here IMHO. >>>> >>>> Yes, please. It really seems like the folks that are interested in this >>>> feature want strings. (I certainly do.) For those not interested in the >>>> feature, it sounds like a CONFIG to keep it away would be sufficient. >>>> Can we just move forward with that? >>> >>> Would love to if others are ok with this. >>> >> >> If this doesn't get accepted, then another way forward would to continue >> the ideas above to their logical conclusion, and create a new file system: >> vma-fs. > > Or: Why can't the library/application that wants a VMA backed by memory > to have some associated name not just > > fd = open("/run/named-vmas/foobar#24", O_CLOEXEC|O_RDWR|O_EXCL|O_CREAT); > unlink("/run/named-vmas/foobar#24"); > ftruncate(fd, ...); > mmap(fd); > > where /run/named-vmas is a tmpfs (probably with some per-user/per-app > subdirs). That requires no changes in the kernel at all. Yes, it lacks > the automatic cleanup of using real anon mmap in case there's a crash > between open and unlink, but in an environment like Android that should > be solvable. I'm going to point out that we already do have names for memfds. "The name supplied in name is used as a filename and will be displayed as the target of the corresponding symbolic link in the directory /proc/self/fd/." It's also displayed in /proc/self/maps. So theoretically, without any kernel changes one might be able to achieve something as proposed in this patch via memfd_create(). There is one issue to be fixed: MAP_PRIVATE on memfd results in a double memory consumption on any access via the mapping last time I checked (one page for pagecache, one page for private mapping). -- Thanks, David / dhildenb