Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2022929pxb; Sun, 5 Sep 2021 06:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxsVMA9Ub0L4UECU1bahQ3Qv8uxrHzvfYajkkB4FJwHPJEbT14wte7H299bq/PI300cNPy X-Received: by 2002:a02:2b14:: with SMTP id h20mr6727979jaa.116.1630849235726; Sun, 05 Sep 2021 06:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630849235; cv=none; d=google.com; s=arc-20160816; b=IGJxsIsIPspF8d2ktAhoQjOXIlj/c4F+IuJ2mJya4qz/mqlx/yN9Z5a3WhZ3hcrcpd t/nPHDh9Me5QSNjODeROjWGbTe/yriuo2gJijkcpyvfzFL4EigkX9RtnIVXXtdoWfxSc kcq2B/lByxVcfmpyYRHQGtNwo5by+BJIhr6uZnqrA9LUyrZI8KGNefxcZdUpJsHJLBPT ejJaR/qbsuNCq0jAHTXrN3PT+QYXSjL8OvrSxiE+IU8H6WVNg6hisV9NdgXnNRXfDyzV vpOfD76H8IKPPgXnuiHj+4ZLYGnKVYkeOz9ij160h58hag0Gjn5Q9B5Fqm7w9gnin5HF l9LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=2YUvJioUupRQxoJLFzZ60jQG2m1J+fPirU8+CT925Zg=; b=J7VFsbca6d7a/EeL4FEltc44zKYAXOt7CeQFnaRCUjLysQtmhr2iWybkaAhmuMAEL6 xebt884kDIHfp8OXDcCx9dJelKoYaGLAS0NKDqRgXCfivdDSVm5M3QlfsUir52uesvr7 h4Fk3LN08GeqF4mT5emJc2pB6a0byXoas8B9EzlSu8K0ji9r4d1DfY4WWXA01WJAEv8x u1bTHAYaCZNQ4iJlKOBjP/ERls86ouaaLovr2RZYmqN82/Xp/GDmKCiCgY2fMeAEfC9m sI3Esv+D49WMj5V/NhqsKbUHhF/jPRNjArJDlGDTsJZJTtifxR3MgTNUkzuxy1oD0SQs ZkFA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r13si5127943jac.86.2021.09.05.06.40.05; Sun, 05 Sep 2021 06:40:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbhIENF3 (ORCPT + 99 others); Sun, 5 Sep 2021 09:05:29 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:55996 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbhIENF2 (ORCPT ); Sun, 5 Sep 2021 09:05:28 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 59FEE1C0B77; Sun, 5 Sep 2021 15:04:23 +0200 (CEST) Date: Sun, 5 Sep 2021 15:04:18 +0200 From: Pavel Machek To: Kees Cook Cc: Suren Baghdasaryan , akpm@linux-foundation.org, ccross@google.com, sumit.semwal@linaro.org, mhocko@suse.com, dave.hansen@intel.com, willy@infradead.org, kirill.shutemov@linux.intel.com, vbabka@suse.cz, hannes@cmpxchg.org, corbet@lwn.net, viro@zeniv.linux.org.uk, rdunlap@infradead.org, kaleshsingh@google.com, peterx@redhat.com, rppt@kernel.org, peterz@infradead.org, catalin.marinas@arm.com, vincenzo.frascino@arm.com, chinwen.chang@mediatek.com, axelrasmussen@google.com, aarcange@redhat.com, jannh@google.com, apopple@nvidia.com, jhubbard@nvidia.com, yuzhao@google.com, will@kernel.org, fenghua.yu@intel.com, thunder.leizhen@huawei.com, hughd@google.com, feng.tang@intel.com, jgg@ziepe.ca, guro@fb.com, tglx@linutronix.de, krisman@collabora.com, chris.hyser@oracle.com, pcc@google.com, ebiederm@xmission.com, axboe@kernel.dk, legion@kernel.org, eb@emlix.com, gorcunov@gmail.com, songmuchun@bytedance.com, viresh.kumar@linaro.org, thomascedeno@google.com, sashal@kernel.org, cxfcosmos@gmail.com, linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, kernel-team@android.com Subject: Re: [PATCH v9 2/3] mm: add a field to store names for private anonymous memory Message-ID: <20210905130418.GA7117@localhost> References: <20210902231813.3597709-1-surenb@google.com> <20210902231813.3597709-2-surenb@google.com> <202109031420.2F17A2C9@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202109031420.2F17A2C9@keescook> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > > the process is still running, so it has to have some sort of > > synchronization with every layer of userspace. Efficiently tracking > > the ranges requires reimplementing something like the kernel vma > > trees, and linking to it from every layer of userspace. It requires > > more memory, more syscalls, more runtime cost, and more complexity to > > separately track regions that the kernel is already tracking. Ok so far. > > This patch adds a field to /proc/pid/maps and /proc/pid/smaps to show a > > userspace-provided name for anonymous vmas. The names of named anonymous > > vmas are shown in /proc/pid/maps and /proc/pid/smaps as [anon:]. > > > > Userspace can set the name for a region of memory by calling > > prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned > > long)name); Would setting a 64-bit integer instead of name be enough? Even if each party would set it randomly, risk of collisions would be very low... and we'd not have to deal with strings in kernel. Pavel --