Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1802916pxb; Thu, 7 Oct 2021 15:46:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwObw0cysXjtvYwc006cT6w82PPyLZSM/ZGuZ6nLlVuCk1svsUy5/j2D1RhiCMjgwHu4LcU X-Received: by 2002:a17:90a:8c84:: with SMTP id b4mr8354313pjo.240.1633646801512; Thu, 07 Oct 2021 15:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633646801; cv=none; d=google.com; s=arc-20160816; b=cMCzEutdcmRoAAhlB8+/BG6ENUF3vjYOsycLoyYzbIdxzTDHnEfw2H2UFix09aRxpu 3s1BqDvcPf4i9wG21SjZZL63yZTdPXVFfszhn0Tp55p8FiIoibsTfWWzuSJS/rfucT5h smhJ9v7fwLz7DMivcaIKPzXT9/Tc7DdKJZ+QqFGGuqV6xnumPXh2IyA7csEEaqOGWOcF a9vo+9Iwc/XSuS7SrKCWyvHHW2mT1IiNFtj1arh/vZcTWI5ZB2d18dPZAu+CjQ6ZUXCJ 2jaqtZXCIS2GYvvIh6i7LRWQj6lAnz+w5vRrprRcG6Lrxh8X4KTG171/DWSkZ4DTkhCS df4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zLOXetc7YBsFaoXhbAiQwjFQGKVuF+LsdrpZkpJ+Yn8=; b=EhnxHEw8Wk1R+bmZunzdw08LzBR+3UnfDA+fJ4NKo3HsLYrRO3/wU7EbPJGEjMpjeA dn4VmahdRg/nVR1yVSmIEU7B9/5NtvUU+Dtn46QvjKvy9BLHqP6WiJtCBgyAWUulmikQ wXxhEqP6LHZbhoResMFygXRn9XiNk2C/L0d/8wIyur5ZoLUf2zzPR3ucA7PGg40e2/8H oe+OGJTNDfCgRJWLbAJCr3nWfVDmzer6uTBthDKdMDuZr5V2uqrYlQunH+sKgfiIjCMC L8JYIRHcKM6PlSEhollxZ1kTB6EUxCl1LKoQZHW2psUFJepmwy5w6XUz90C8IoeyyoIB aQqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=I7CD544n; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j64si753821pgd.127.2021.10.07.15.46.28; Thu, 07 Oct 2021 15:46:41 -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=@google.com header.s=20210112 header.b=I7CD544n; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241215AbhJGVeN (ORCPT + 99 others); Thu, 7 Oct 2021 17:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238226AbhJGVeM (ORCPT ); Thu, 7 Oct 2021 17:34:12 -0400 Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC17C061755 for ; Thu, 7 Oct 2021 14:32:18 -0700 (PDT) Received: by mail-yb1-xb31.google.com with SMTP id i84so16441102ybc.12 for ; Thu, 07 Oct 2021 14:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zLOXetc7YBsFaoXhbAiQwjFQGKVuF+LsdrpZkpJ+Yn8=; b=I7CD544nPG2Zflz/Gmzk0gLTZ7/XyNqM8T4Eficx6meLX3T7YHuRuP9RVKBBvNs/P2 mhyB+AAsIFAsz1EGzZuY3ezfjym+9cyyXdAXexeO5MF5zTh5JVDgUEdfeHi14X2IJ8l7 5lDTy2C1wHckIghEmN/nVKQeMWg6GqUrXa4AQrOs55U0gAhE+XcLoCfbJkQfpfZRI1Nu dsLeERidXU0RJ4NSQYbaySX/CsVAG6TVC615Am35UMCjL6hrFjEx70Z27rFSJu7+qRzM OfblfwbTiIipcqehK3HiWYnpFL3J6FGlnwT9QlijReFRI62FoG06AFMdZdDpoUIWIAZu 7sYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zLOXetc7YBsFaoXhbAiQwjFQGKVuF+LsdrpZkpJ+Yn8=; b=Pu/Klnfmra6NI2BlXrBRYT+PdVt65MJbCJfgz8VS40D+PAdmZlvHp8uiKNHh+ubD/L ueb+1lLMHhGidf445pRPnBbtqVUC2gWJPQEBe/mNk4N6kHQQ/F8ORuyi26NsDL5QEQrs iiW2bLK8Bd1NJfVrVvP3nAUCLeoyGsthCLw2BTKTGiZ1yWkUQlI0NME1DphG9BlhDI0H MxKxa6+ojEHJgJum2OOLO90lodjvUEd49oixHHD5jz+ZMMPHGYySPYiTarSZJp3tkSdc NUtIdEsO0Dd1O+WEw/n/QwNVJJPx+0dUSNiPNunZZh97RBPcjXXXvYbz0RAPO7lR927d EXvg== X-Gm-Message-State: AOAM530a3y4eeAzaJhzboTTrgxigojSi+GTfdfX68IgSv7hiXa0kP0zM 6C87CC/NpgDGAK2/AE68W4AajyhzbcmJX3z14RIuHA== X-Received: by 2002:a25:3:: with SMTP id 3mr7689141yba.418.1633642337263; Thu, 07 Oct 2021 14:32:17 -0700 (PDT) MIME-Version: 1.0 References: <20211006175821.GA1941@duo.ucw.cz> <92cbfe3b-f3d1-a8e1-7eb9-bab735e782f6@rasmusvillemoes.dk> <20211007101527.GA26288@duo.ucw.cz> <202110071111.DF87B4EE3@keescook> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 7 Oct 2021 14:32:06 -0700 Message-ID: Subject: Re: [PATCH v10 3/3] mm: add anonymous vma name refcounting To: John Hubbard Cc: Kees Cook , Michal Hocko , Pavel Machek , Rasmus Villemoes , David Hildenbrand , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 7, 2021 at 12:03 PM 'John Hubbard' via kernel-team wrote: > > On 10/7/21 11:50, Suren Baghdasaryan wrote: > ... > >>>>>>>>>> I believe Pavel meant something as simple as > >>>>>>>>>> $ YOUR_FILE=$YOUR_IDS_DIR/my_string_name > >>>>>>>>>> $ touch $YOUR_FILE > >>>>>>>>>> $ stat -c %i $YOUR_FILE > >>>>>>> > >>>>>>> Ah, ok, now I understand the proposal. Thanks for the clarification! > >>>>>>> So, this would use filesystem as a directory for inode->name mappings. > >>>>>>> One rough edge for me is that the consumer would still need to parse > >>>>>>> /proc/$pid/maps and convert [anon:inode] into [anon:name] instead of > >>>>>>> just dumping the content for the user. Would it be acceptable if we > >>>>>>> require the ID provided by prctl() to always be a valid inode and > >>>>>>> show_map_vma() would do the inode-to-filename conversion when > >>>>>>> generating maps/smaps files? I know that inode->dentry is not > >>>>>>> one-to-one mapping but we can simply output the first dentry name. > >>>>>>> WDYT? > >>>>>> > >>>>>> No. You do not want to dictate any particular way of the mapping. The > >>>>>> above is just one way to do that without developing any actual mapping > >>>>>> yourself. You just use a filesystem for that. Kernel doesn't and > >>>>>> shouldn't understand the meaning of those numbers. It has no business in > >>>>>> that. > >>>>>> > >>>>>> In a way this would be pushing policy into the kernel. > >>>>> > >>>>> I can see your point. Any other ideas on how to prevent tools from > >>>>> doing this id-to-name conversion themselves? > >>>> > >>>> I really fail to understand why you really want to prevent them from that. > >>>> Really, the whole thing is just a cookie that kernel maintains for memory > >>>> mappings so that two parties can understand what the meaning of that > >>>> mapping is from a higher level. They both have to agree on the naming > >>>> but the kernel shouldn't dictate any specific convention because the > >>>> kernel _doesn't_ _care_. These things are not really anything actionable > >>>> for the kernel. It is just a metadata. > >>> > >>> 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. Like debug-fs and other special file systems, similar policy and > motivation. Also protected by a CONFIG option. TBH, I would prefer to have the current simple solution protected with a CONFIG option. > > Actually this seems at least as natural as the procfs approach, especially > given the nature of these strings, which feel more like dir+file names, than > simple strings. > > thanks, > -- > John Hubbard > NVIDIA > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >