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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98439C636CC for ; Thu, 16 Feb 2023 10:01:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 307EE6B0071; Thu, 16 Feb 2023 05:01:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B67E6B0074; Thu, 16 Feb 2023 05:01:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1584B6B0078; Thu, 16 Feb 2023 05:01:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 06CBD6B0071 for ; Thu, 16 Feb 2023 05:01:58 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B33CD140B82 for ; Thu, 16 Feb 2023 10:01:57 +0000 (UTC) X-FDA: 80472713874.08.F5304B6 Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by imf09.hostedemail.com (Postfix) with ESMTP id 8CE0F140029 for ; Thu, 16 Feb 2023 10:01:55 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm2 header.b=asp+w4tF; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=tjURGj5O; spf=pass (imf09.hostedemail.com: domain of kirill@shutemov.name designates 66.111.4.229 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676541715; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mUwZ0jLBJxHz2jqLQpzE2WZti2villst4pazhry1LDk=; b=b6CzNO3KyFtIi7YBLU24Hc0UNJIhaQalyPc1ON3bJn0H9C8dZOsPKATXizURP7nipeyFRi m0C2dJTdJY/MR0EanyHQiRhMN23HRGKev4kzPbq7ogs3bnYoTr+dEGSkM3Fq8oU0leFnU0 ghLfJmARUh0Di+6BIqmoQkp8znRY/KU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm2 header.b=asp+w4tF; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=tjURGj5O; spf=pass (imf09.hostedemail.com: domain of kirill@shutemov.name designates 66.111.4.229 as permitted sender) smtp.mailfrom=kirill@shutemov.name; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676541715; a=rsa-sha256; cv=none; b=7WOiLzCog8/A7qoXiO2ANA2naPAv/c8hqDN3FcU/YnEfzrS8nYrxcVJh3QcCrA0lEI9fe8 2J5Z8JVQ4J/FTb2pqrISPf/jL/1Yc26sJwfXPLF2e8aP0K2Y7BJtEl2QSJu48LOfXr/v96 IOWeMVtlycqIj4xOOjEMOdViu0dDCt4= Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id EF2C4581F74; Thu, 16 Feb 2023 05:01:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 16 Feb 2023 05:01:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1676541714; x=1676548914; bh=mU wZ0jLBJxHz2jqLQpzE2WZti2villst4pazhry1LDk=; b=asp+w4tFm/0L+ogLMm Aah1xvH4AC5j6a6LcApo6uCb3V6IY8r2ikkDaJR2FB7shHkGsgS8TyPVHysvz1wl w7G3DJVe3kyuaXTizspLXlv3dJBwdw64oluQvhEnmtO4wfuyeISDBd6koC5smlpl c93B3qTaOlQ4qQH+023WPx+j/T99sQC2oSsiiLdLbmjIl2Ea27cka8xxchVgLeve 2iThLMVvWxeyJ8/+TtsHp414ynVa9p8Ek5ApwrgL7rZwSTPWcV36dqF+GqYO8/Dy 1WBs+dM4cIQcKpj/xukVy46UYiPY04WL8AW6VZXgpBrsVwNylSig3yXUWWzBeko4 D/Rg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1676541714; x=1676548914; bh=mUwZ0jLBJxHz2jqLQpzE2WZti2vi llst4pazhry1LDk=; b=tjURGj5OYhitZIFJH3pTuYCsW7QnYHGo+Bne0z8nqsMe 1vE03qoSKLsFpwrfX45Li0aYqbWQm4stNaS+vt48/4lKLIjocyVldJiCveFBfosz z1zO21pN4R/OzCph8SEKEFFabqMyT2/AI11YU8k8hPU4nDeuJnfB8orvpWtkHJyT 9mZGqb+AKEOq7igi7qO71E1BN9IKsiUYj0+uGfblt1DBv9l3HV4NB/LxejoHDK8a Re5iX+uoxlS4q0MeYcJEFDpzZxspfZMJAZuyRJEeItqZ6bNa39wmmelk/84cmodq jRXd7aIoo1nGJiyBaZUIp7vf0F5yoSOrbVFLya1HVg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeijedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdttddttddtvdenucfhrhhomhepfdfmihhr ihhllhcutedrucfuhhhuthgvmhhovhdfuceokhhirhhilhhlsehshhhuthgvmhhovhdrnh grmhgvqeenucggtffrrghtthgvrhhnpefhieeghfdtfeehtdeftdehgfehuddtvdeuheet tddtheejueekjeegueeivdektdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehkihhrihhllhesshhhuhhtvghmohhvrdhnrghmvg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Feb 2023 05:01:52 -0500 (EST) Received: by box.shutemov.name (Postfix, from userid 1000) id 93F7210CCE1; Thu, 16 Feb 2023 13:01:50 +0300 (+03) Date: Thu, 16 Feb 2023 13:01:50 +0300 From: "Kirill A. Shutemov" To: Ackerley Tng Cc: kvm@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, qemu-devel@nongnu.org, chao.p.peng@linux.intel.com, aarcange@redhat.com, ak@linux.intel.com, akpm@linux-foundation.org, arnd@arndb.de, bfields@fieldses.org, bp@alien8.de, corbet@lwn.net, dave.hansen@intel.com, david@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, hpa@zytor.com, hughd@google.com, jlayton@kernel.org, jmattson@google.com, joro@8bytes.org, jun.nakajima@intel.com, kirill.shutemov@linux.intel.com, linmiaohe@huawei.com, luto@kernel.org, mail@maciej.szmigiero.name, mhocko@suse.com, michael.roth@amd.com, mingo@redhat.com, naoya.horiguchi@nec.com, pbonzini@redhat.com, qperret@google.com, rppt@kernel.org, seanjc@google.com, shuah@kernel.org, steven.price@arm.com, tabba@google.com, tglx@linutronix.de, vannapurve@google.com, vbabka@suse.cz, vkuznets@redhat.com, wanpengli@tencent.com, wei.w.wang@intel.com, x86@kernel.org, yu.c.zhang@linux.intel.com Subject: Re: [RFC PATCH 1/2] mm: restrictedmem: Allow userspace to specify mount_path for memfd_restricted Message-ID: <20230216100150.yv2ehwrdcfzbdhcq@box.shutemov.name> References: <176081a4817e492965a864a8bc8bacb7d2c05078.1676507663.git.ackerleytng@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <176081a4817e492965a864a8bc8bacb7d2c05078.1676507663.git.ackerleytng@google.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8CE0F140029 X-Stat-Signature: n31e75gz83uiipmq9ut3pnzdi5kcq51k X-HE-Tag: 1676541715-862805 X-HE-Meta: U2FsdGVkX1881PUnkH1x+UDqOQYk5Dq7424yjpcHraYUUDIeZR18riL6dr0z7CFBTFu7+wIQ/oH7OuDYYGoD/0D94n4MwCYH1kVCHjxbDl2qfBQ64+tJXarW6o3kTwSSG8VyxDOd+Qu/M4vjSiA7zWWn5Ymv9Jeqr455FOzOzkLkSWyvV/WMgWNRTR1lYi6afVOwuHnWkYG578eoaIwlWPB2v6dbp0bI7qYM4dQ/OdTwi2SOlndRNCbsaMayRxXpgAvgl3bM2zzxSF7uYvGGcDnn/8/TrRCIIarijJEa8ZLkDFY799nc2E68D6J9km7xKoOCUb3ax9y7n/TEVNgW5ZY8inut4+Rg+pNwSshD5c+2V6kgcekokG7s0topVCaH3CI94Xqr6DApBE4W7X30cGjTeMi6Y/LjpWpHb403+FKAfaFbmgO7fpmfrUh6ImR0xH4XwHzKqnyFSk3Koy7RJogQ221WPceH7DbC0jPy0Ihnny6oM64627b+6DyZNatnjIh5nMhdFmlmwpsF51sFsGG8xPpDbRJPXEZOhyB0/y6S/TIvXQvYSgWE2r/udffiLzrF3GH2uO2HbAlK2nFiVgg21u9JKqc0IMf8gJk7v2gBoyaWUqhoH+923Zfc/3s5xGaEFT8tzTsycff8PLr/TC9xzUWe5xueJDV0+DK7I2vri6xjf+7JGdhK/Jmfdd3yMhKOecgI6bAr9L2PBAw4zE99pIXa0x7VjAWAEeXjynbHWBPy474h9PzueNrjKiITmoKwccDmQnT6hVz8mUOUZzkIF8/jG8lsZId7+ne1KtLzE1WCx7/2tf0zB9LClPlbwNAkRWKJ2nM2P2ta1LseSsl6L/8goXqJZBUeyYW0aryJvLWBm9SH4kwX9b8r37389nNCHKPIjFOLr2FPKJbiLXnXivr5OP8a3GvnubRIgQjkO1kNRlfw+/g8R/we09vx82g2YsHgQgauj9ZfYkp YAx9cBOD V3q+JH5STnelwjH+QeuGz7mgczMGvMN/TkaPnSublLpmO0ZmKASepAipBInF/WrSv9t1O0o0rNeGlDL1251TaUGqP9jE00BAWQ+BEVe1bdC1H7uZ5PmhnoScutMd0FuUzrKp4C3Ystkvm2WrkYBVo5DaRUewpAOiQaFe87NNSa+izJBT/Ss8bvkrCIg488rlLOyUoM9U/JWbFSldvRRWjFMtTylDam0Xi2fxZPryz6C2zs+S5tXbyQaaf4Qx/QRGE7FXr74hjMrQ/jvFfcJSiUxGEnBkVenzk7C+pA7NjGUrt5yZhMow9AuBdA2XMKwpr2fJ+fg3o/zQOZpibg1ruxXIXOm7BminHbvnx9f9QiLySa7X4paUXsWJm+Nflflefl2BD X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 16, 2023 at 12:41:16AM +0000, Ackerley Tng wrote: > By default, the backing shmem file for a restrictedmem fd is created > on shmem's kernel space mount. > > With this patch, an optional tmpfs mount can be specified, which will > be used as the mountpoint for backing the shmem file associated with a > restrictedmem fd. > > This change is modeled after how sys_open() can create an unnamed > temporary file in a given directory with O_TMPFILE. > > This will help restrictedmem fds inherit the properties of the > provided tmpfs mounts, for example, hugepage allocation hints, NUMA > binding hints, etc. > > Signed-off-by: Ackerley Tng > --- > include/linux/syscalls.h | 2 +- > include/uapi/linux/restrictedmem.h | 8 ++++ > mm/restrictedmem.c | 63 +++++++++++++++++++++++++++--- > 3 files changed, 66 insertions(+), 7 deletions(-) > create mode 100644 include/uapi/linux/restrictedmem.h > > diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h > index f9e9e0c820c5..4b8efe9a8680 100644 > --- a/include/linux/syscalls.h > +++ b/include/linux/syscalls.h > @@ -1056,7 +1056,7 @@ asmlinkage long sys_memfd_secret(unsigned int flags); > asmlinkage long sys_set_mempolicy_home_node(unsigned long start, unsigned long len, > unsigned long home_node, > unsigned long flags); > -asmlinkage long sys_memfd_restricted(unsigned int flags); > +asmlinkage long sys_memfd_restricted(unsigned int flags, const char __user *mount_path); > > /* > * Architecture-specific system calls I'm not sure what the right practice now: do we provide string that contains mount path or fd that represents the filesystem (returned from fsmount(2) or open_tree(2)). fd seems more flexible: it allows to specify unbind mounts. -- Kiryl Shutsemau / Kirill A. Shutemov