From patchwork Fri Oct 27 18:21:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13438942 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 4E0F3C25B6F for ; Fri, 27 Oct 2023 18:23:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E87AC80017; Fri, 27 Oct 2023 14:22:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0F628000C; Fri, 27 Oct 2023 14:22:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C14A780017; Fri, 27 Oct 2023 14:22:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A74A48000C for ; Fri, 27 Oct 2023 14:22:58 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 87346409A8 for ; Fri, 27 Oct 2023 18:22:58 +0000 (UTC) X-FDA: 81392062836.01.FB0F58F Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by imf01.hostedemail.com (Postfix) with ESMTP id B584A40009 for ; Fri, 27 Oct 2023 18:22:56 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YIUAHct2; spf=pass (imf01.hostedemail.com: domain of 3__87ZQYKCCAOA6JF8CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--seanjc.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=3__87ZQYKCCAOA6JF8CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--seanjc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698430976; a=rsa-sha256; cv=none; b=zCKOhTtkohEUhwVNTmzGZfUpaLYcUK6UOyvPIy9CCzXPNPb/JByLqYdRPxm3TNBZgefo20 QW1hnicHrPFslYvFuB1BBYQ1hLKMeGh/q0o9Sevbngrin4XAL7kVuLUa/54zzY8Q7WX9NP Noh/u7x9bFRD/khz3TQVRt0dc70kIg0= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=YIUAHct2; spf=pass (imf01.hostedemail.com: domain of 3__87ZQYKCCAOA6JF8CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--seanjc.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=3__87ZQYKCCAOA6JF8CKKCHA.8KIHEJQT-IIGR68G.KNC@flex--seanjc.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698430976; h=from:from:sender:reply-to: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=pX02ozc7lSRzYa356XIJ+CMNCgv5fZ3NEfG1CClMU1M=; b=gb7TVHEbDf8jz1JI/D8bwh6rDregc2DfExsx9+ijruQtpSsvc3nTjxAWADaNlwAuFpLlse PR88pp+XsgJkrsTLa/B0jN8FG5JspkMkNMEwTSJSJnmkxyliiyKQDDM83hwFi96TSrHGfl jKF4ItsK+CdmO2KDjImhJIaPUL4zMso= Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5a08e5c7debso2037587a12.2 for ; Fri, 27 Oct 2023 11:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698430975; x=1699035775; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=pX02ozc7lSRzYa356XIJ+CMNCgv5fZ3NEfG1CClMU1M=; b=YIUAHct2soTsAC+Ts4w0wWcMItSL61G/cqpZu34ATIDXeN6KIOjEZCOX4PT4qX0V9T dNMe2kio8hxufDsL8dCZAuXUvpGUV7lQ0in0VssNBQUXxPonSuwmIP32uXRiRW2FwDxS q2OV9K9nejJnnOfztAxCBtnEdKIcRXhd15qzFNRUiuY24xlP7U+5Okod8M7akjjaDhJx h4jdSDgsjlPKbJ1WzraBs5V3OGerAw4FEpIm/ZvoWIkCRW7u2MYd7X9FgR3KHbrhlamB s3wlcECgGMAC+UWSJPpBehxu0iVvhiffS0gSDOsuL+UfjFLNPCdMsDMOCO9wlV8w924a kAtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698430975; x=1699035775; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pX02ozc7lSRzYa356XIJ+CMNCgv5fZ3NEfG1CClMU1M=; b=accILOhGXbW42vKGXOm3h3GMkuox2509GpaJInVg787MsgRzXV8oBmafAt2K3XkRPu pmc5rLqxEqdqKPIaK2jJ9X80ZCzTyBUs51O8c0MxsGO4Iwd7Iw4/yUJeY/qQKKoTa3Jn 3QTFTwYclvKALNxiCXsHHfcw/8izFMvVfrpE1HG/CSdLNPzQfK/KqVJA5pbsmWpItRj4 Qto+pp2r+CoDIASJD4sRlLJIRqBHhZkYOCJGqa3HQQUXQQV8cZ+L5IZCEbkiB/xl/OIH 8rjjtk5WFqv7TyEnVTihmh+WoXVXDz9EgnWke0p9a7AZ4iskP/gSyPe6N0WSsa9QXgI4 ZgkQ== X-Gm-Message-State: AOJu0YygTy0ehdSJPUpuGVxlDDeuCgm8aZTlbUZ26J/KPpiE229/tO+Q k7LKd3pZQ6dq4S9pxq+IH3a5xHEYv/8= X-Google-Smtp-Source: AGHT+IEZ2DkPV4b8zDYsItSE8S6PNMt34EGJVQ4YpOaZs5hBhRUHv0wBQpomiC7JG41zMwbv7hAHGw5rsZI= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:f7d6:b0:1cc:23d2:bb94 with SMTP id h22-20020a170902f7d600b001cc23d2bb94mr38516plw.1.1698430975510; Fri, 27 Oct 2023 11:22:55 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 27 Oct 2023 11:21:57 -0700 In-Reply-To: <20231027182217.3615211-1-seanjc@google.com> Mime-Version: 1.0 References: <20231027182217.3615211-1-seanjc@google.com> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog Message-ID: <20231027182217.3615211-16-seanjc@google.com> Subject: [PATCH v13 15/35] fs: Export anon_inode_getfile_secure() for use by KVM From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sean Christopherson , Alexander Viro , Christian Brauner , "Matthew Wilcox (Oracle)" , Andrew Morton Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Xiaoyao Li , Xu Yilun , Chao Peng , Fuad Tabba , Jarkko Sakkinen , Anish Moorthy , David Matlack , Yu Zhang , Isaku Yamahata , " =?utf-8?q?Micka=C3=ABl_Sala?= =?utf-8?q?=C3=BCn?= " , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B584A40009 X-Stat-Signature: 99yciz4b5ic8c384p9woo3cgdkkmbe89 X-Rspam-User: X-HE-Tag: 1698430976-418276 X-HE-Meta: U2FsdGVkX19XeT9Ph+OLbcV3EwVOlc2QK9Ry//Ivf8nGSEpKzOC1spodyW+P+yRMdeWjeFoVxHEC/kVNSgoy/v5MOjd9wjbnNNyuknanb9q/heKo06u0rm63NIolPO/Fgwhq5u+lmIXGQt8lBSRM4/rKkohk44ZIBD6+TylZYES8nbQS8sThRdGZDLzGZNIiceUX722eJk+EMPlf0cJqZcD1glbuUZeFB6ZoYljsnqZ8sopD6j9i3m0lVNoLf51ez6A7F5SlODWmDKbg830aJdg1U4heYXxE7zGhSrcZKlKWwKNNjXtPIzy6sFRQGBzQqq7a7KYE2VPHABIXt4+QUMsqsDri1iog/IhiedRExwEVcL0yBTDDGTIzdCI/YZc9QwneMmRzJzrzRcbyu04nBZ2qajWnFibVxDX7GJzWFI/bTdzZE1uIdvYMqdSG3G+uWQmbotPs0rmdSqdD7QlDm2wREY1utOEsgIKupH6KgLzGroqjsOnPPF1C+Gx66niHzNWcR3dRGX2KTyGoj6OO/FLr5GVa7aK3umfBQpdmYZHdZWL6ryZ0Mr/analfIh6jUknbeJ4FEFcw2KRp3qZlHi/ReY0NMWUqcCPrRsc71d0sl4qEVGAdUp/JQSfZFge/yxpViHaaFO2yCyS1QLIFcdXHbaOL0rFlWGQG1x+ogw+rb6HeUWGimnUjgCLJfYQ00lnKWkdrNYqRFUGTgs8w31LITQcbiI/sn7Q++ePE5M14T6koXtLOHhye0iYKvijy+3QIfcbgZbcDIhzOQLNRRONSqs9jo+R2IQQllOoz9exz/wMvTmyUYtRzEYXwGplEr9kNWI0PntJEjbSQ2FWOQN/PX6SkkrWS9Wau+3Kc0dnS0PwGrXLgnagNKu7vgDh/4SoEjKrjKIfPqXFsMeSP+mqQCXTyPasC8W+VJqiLtlOawLTXEqtqZy2cvEpbAR+1ob+83d0rMODi++dEN35 VZT8aLWe WjX5Tln3heEBuMRYvwi06srnUFeISLVOo3IE90xdcdc1+cHh2zqonVo6pILnnQ4kv8Iq7R3wMr3vGFc4mLNg8/2boYzpvryRoq7c12+Tim6UN1B4heO2hNbXc60TxWubnwB9/FGFxcrn3DNbDGzT8pif+qd+KMJY9EVFwXY1UEjSF2AzjsDUKY06wJ5fQB1LO6ZLV8t1FdjSBXEyQe+P6Pf+Tf14/abyDv316sfhN806ts48drjUux0Tnhn80z33trnsgDkV38aqnC5Yfup/WrT/6C/hApllmKBJ9BkkemAXPeGe95bH/VNKItRvtt8qCM10imy2/rHvJFqdAUZxWesr8TPb1KYgnb6HlM4x/yA6mOdfMvlqSEom2KWy3UlF9P0BcaOZv0lGpclILhVGDFAYUmyFB5lCjmyBpP5Q7OTbDSDGfhMl3WKwA9wZOnsdFL/mghEo8KmPaxWQU6F8VkJ6G+Rtehpdc40m5g2vGsEkgd4J7A4oddk1365Hedd6Ap4q9Gxo8QS1s9cKRG1eJeKVOSXU5y2/X/UmbQGzXsUp4FYAc1nLm8q4bKdF7nR76mQlUq4cOQQy0mhcQc219uJ+I+JZBSwI9ofLLuYz+bh3GfgwqZC7ASCq+JhJNoc3J3MtjfF/IXdLWPExzaNzj+kMnUqZsROkS9EZaB/2tD/sryV62gTAd9sVDdCkYZzx3IyI3B81Cz/Iz+DlFTVdKAs+FWFsCY8k3hdfZSDmpF9eF4cEBgvSxFifSdvLJW9PrTgLK2PisWT3PfADXtGch0JeQz11xFbSnE/mFXgEoIgKBeAXDtpZhhWZFrA== 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: List-Subscribe: List-Unsubscribe: Export anon_inode_getfile_secure() so that it can be used by KVM to create and manage file-based guest memory without need a fullblow filesystem. The "standard" anon_inode_getfd() doesn't work for KVM's use case as KVM needs a unique inode for each file, e.g. to be able to independently manage the size and lifecycle of a given file. Note, KVM doesn't need a "secure" version, just unique inodes, i.e. ignore the name. Signed-off-by: Sean Christopherson Reviewed-by: Paolo Bonzini --- fs/anon_inodes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 24192a7667ed..4190336180ee 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c @@ -176,6 +176,7 @@ struct file *anon_inode_getfile_secure(const char *name, return __anon_inode_getfile(name, fops, priv, flags, context_inode, true); } +EXPORT_SYMBOL_GPL(anon_inode_getfile_secure); static int __anon_inode_getfd(const char *name, const struct file_operations *fops,