Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1648410rdb; Sun, 8 Oct 2023 19:16:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeKSoAGmBebD43AbYAGA8qO2SjyYqRIEYOCvzrd+amT6nugymb/E/n1+API2lml/Df5m2z X-Received: by 2002:a05:6358:1ca:b0:134:de8b:17f0 with SMTP id e10-20020a05635801ca00b00134de8b17f0mr14281102rwa.19.1696817816672; Sun, 08 Oct 2023 19:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696817816; cv=none; d=google.com; s=arc-20160816; b=HCk3mYgbNSzHZm9t1JRB+8QEp1a+O8uQfeaPyHIfJUn69AZpfzQ1MMSAp1bB2zIaXp 6oyTeea+AJTauBi26L0oIBXsKnmO6WVjqgso7Hu4Lv4bd8ALUZV7LXLl8oLDLODe5Hbh IJgmGUriKRzZie5mo5R77JNgzBRFqXjV9WiAT8wW9La7hsn6jqOU2DdN9a6hvYx7RBaV Uj4gK3PRBEhwSfDDagSYMycaiyUcb11kih+Dd3e6QlIO1XCvsPUaxKAF3HyiZz0fa2D7 fTJXeLbT7gHFEn4/1YYfzCkOoBdYcKjyXycwIyjF4+87Cw6zD4Ole16YnP/1QSqvFhzB cd/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=+ikwgjd5P87YDm6DAAABio5shAHyVQAKb6s8sL0xDbs=; fh=w5PQy690PZFo4dLhiNVDx+oF6TJjX3I4FXTRGGM5kNc=; b=I++WjzKVfbToLzbn/4/EznQ5XQbHe/sSu+bNuFmBl4yPh4aXApQ0gpFlUr35M/4gEb yq27yYctfJkoFtTq9xQPFv8EwdARTjVD5+bEZbAAelqiWkUivLdnKqkgqXOQYPiPq20e 2IWFjFW+xBKSrdyftJ2K0mXUV1hMQ8JhLDi1Hpl3pag1PO57DhnGf5lJpE/5arsxhDOs v3C6qcyie5b0fM0f0DrEj5CA6GDPUSLTOpP0bv8k6CL0TYsX73LG7bZZJn1BUglcifFW w0w3xclkYYymt4TemWv/y9HKhPCcL2HDP/83Ud95wiewltlEcPK3t0AciStxdUKmbgn4 We4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Yk5olfns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d2-20020a170902cec200b001c3a05b0b67si9477168plg.566.2023.10.08.19.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 19:16:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=Yk5olfns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3828F80A9920; Sun, 8 Oct 2023 19:16:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344903AbjJICQs (ORCPT + 99 others); Sun, 8 Oct 2023 22:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbjJICQs (ORCPT ); Sun, 8 Oct 2023 22:16:48 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71AB0A6; Sun, 8 Oct 2023 19:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+ikwgjd5P87YDm6DAAABio5shAHyVQAKb6s8sL0xDbs=; b=Yk5olfnstsZOt42gMU2pwbE+/P I73K9LJLvR4iEtJ/s5y6n4IQjaKIkM8cmRmZN5emSmm3iLZuSMvt2iV9C8CLbYqM0FrsfrFN8619w AxI4KUiKUrEXYmS1L+cn9CZ6K5vmv/rxoT3/ieUylhZOaN5ETEOkPAilQWB07G85GqGLj2IHdDyyX N7plTsm2uGwCra52CsvjmOJL5rZB0HiPquWOcLEbSnLrgaUIfTJHULMNC42LwL5EGtGkCw2LNQG78 QtOHRQ6BkgSmfpTFKZ3h9aU1HUIcby3pj5GDHLq0sbSrH/GJUb7ygJ2jbrKPkPt/l4BlbIv19GpnO ZGJcC55Q==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1qpfp6-00H4BX-1x; Mon, 09 Oct 2023 02:16:44 +0000 Date: Mon, 9 Oct 2023 03:16:44 +0100 From: Al Viro To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, seanjc@google.com Subject: Re: [PATCH gmem FIXUP] kvm: guestmem: do not use a file system Message-ID: <20231009021644.GC800259@ZenIV> References: <20230928180651.1525674-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230928180651.1525674-1-pbonzini@redhat.com> Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 08 Oct 2023 19:16:55 -0700 (PDT) On Thu, Sep 28, 2023 at 02:06:51PM -0400, Paolo Bonzini wrote: > Use a run-of-the-mill anonymous inode, there is nothing useful > being provided by kvm_gmem_fs. > - inode = alloc_anon_inode(mnt->mnt_sb); > - if (IS_ERR(inode)) > - return PTR_ERR(inode); > + fd = get_unused_fd_flags(0); > + if (fd < 0) > + return fd; > > - err = security_inode_init_security_anon(inode, &qname, NULL); > - if (err) > - goto err_inode; > + gmem = kzalloc(sizeof(*gmem), GFP_KERNEL); > + if (!gmem) { > + err = -ENOMEM; > + goto err_fd; > + } > + > + file = anon_inode_getfile(anon_name, &kvm_gmem_fops, gmem, > + O_RDWR); > + inode = file->f_inode; > + WARN_ON(file->f_mapping != inode->i_mapping); > > inode->i_private = (void *)(unsigned long)flags; > inode->i_op = &kvm_gmem_iops; That's very badly broken. The whole point of anon_inode_getfile() is that *ALL* resulting files share the same inode. You are not allowed to modify the damn thing.