Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2129580rdb; Mon, 9 Oct 2023 13:42:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElWsVcMXF9rUKeNBl1zYyJHDrurRDoBPJ3cWkfSJD1O56Z88bPHnJJorEXiVkQSfdt6YMm X-Received: by 2002:a05:6358:5e0b:b0:143:5d3f:f397 with SMTP id q11-20020a0563585e0b00b001435d3ff397mr15430238rwn.16.1696884123205; Mon, 09 Oct 2023 13:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696884123; cv=none; d=google.com; s=arc-20160816; b=WsoWxTHN3f2cSNKSJAVf9y5PCnqMD46RWDy1sGIm4q72wB7+ktV3f/UXwRKzGo8wEc d2k56eVCcPaEAXk0lRKb/7qAJ0wWx5023L8szz7Ec/3c4J9VGnUPr8a59uu1bHy6oqGX w3IibLFztjCRhtCSTtLgdCLOimUSjRqxgEP1rojvpMD5PaT5p4jZAFf8p113IjlVdltk 0vmKnrhNQHM3AjLyzm1SF8UfmBMuCAMme74n0DoecbnERRYqddHoFlkXCaTDkQ8taFRI 9t6wmhrD3kJ9mei/8dZMl3x1yHqSDBCM0V0fokfeaJG+wRtFV8WR0Ojw5MxtRhYsclUZ xD+A== 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=HjONdBtljo/a1MPj3EhqmGSMzzsfAb0oqtURFjn7dm8=; fh=7A2vjXu/ewATeTgBdu7iBmgBP0mnBjez2UGBNdh/IPI=; b=L0Ad2a2vz22GshYNy26C0auubRHhDZllQYUf4V0O+ZGFiNEVBSddzfji4GV7k4BCd+ W+erraKh0mZMVvDBRZRP7+8+MiMr1bLOnQKE4H4Ag+c4oIfC4NE8MtqktQG2Vu031R9S Kn2PkKAKw1nRhbTC4HolqRZOCCHEVf/BUMSOKnYT8p4Mx0BwBWwC2VIHOS4e3dO30oLs yKXgUKSo8tyDyT1TlMFNzy/SbhVj9Crf3t+/f3AFmo/5Mvia639N0MbTieZqanQncr5R woUPyhO5vEalq5HKuNfzOHglbXLTX2Q0b+qa0cFgpyOBBS0g2kC1AYGAqLTN1kFVcsgg Tb5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=GRDLoxGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g69-20020a636b48000000b00573f703a239si10538959pgc.414.2023.10.09.13.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 13:42:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=GRDLoxGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 6017A807D40E; Mon, 9 Oct 2023 13:40:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377971AbjJIUkm (ORCPT + 99 others); Mon, 9 Oct 2023 16:40:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377954AbjJIUkl (ORCPT ); Mon, 9 Oct 2023 16:40:41 -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 6DFD792; Mon, 9 Oct 2023 13:40:39 -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=HjONdBtljo/a1MPj3EhqmGSMzzsfAb0oqtURFjn7dm8=; b=GRDLoxGSItIgTce45CP56Y7xht gZuThDkzyn02LkUNf5bRoDUsgySnUJ9KuWstv/f7+AluRi5rzGqYv0ONlp8WJBZInf7WCdvI261o3 1Lw6JPRqVaR0pncQhvk8bP3XQgRK9J+2ZlvrlnmzTIQqOg1lBDOMeM3w1sf5XxbSo+38MtAJAVcWH a+5c23kE2261YK5xUvnn4lpavACTM9QdU07kVNX5SJ5l5BFJhS4XN2H35+1fLwG4QJHAJYqHkDEQR ImQLTUwGicgthBa1XvWZ4rRlzkuNBZIwGSL5+Z7zzCloax93On7YjwAPoOmsibsEphoTE+veTn0kT 8FvsiWGw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1qpx3N-00HIst-2h; Mon, 09 Oct 2023 20:40:37 +0000 Date: Mon, 9 Oct 2023 21:40:37 +0100 From: Al Viro To: Sean Christopherson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini Subject: Re: [PATCH gmem FIXUP] kvm: guestmem: do not use a file system Message-ID: <20231009204037.GK800259@ZenIV> References: <20230928180651.1525674-1-pbonzini@redhat.com> <169595365500.1386813.6579237770749312873.b4-ty@google.com> <20231009022248.GD800259@ZenIV> <20231009200608.GJ800259@ZenIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=2.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 13:40:58 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 09, 2023 at 01:20:06PM -0700, Sean Christopherson wrote: > On Mon, Oct 09, 2023, Al Viro wrote: > > On Mon, Oct 09, 2023 at 07:32:48AM -0700, Sean Christopherson wrote: > > > > > Yeah, we found that out the hard way. Is using the "secure" variant to get a > > > per-file inode a sane approach, or is that abuse that's going to bite us too? > > > > > > /* > > > * Use the so called "secure" variant, which creates a unique inode > > > * instead of reusing a single inode. Each guest_memfd instance needs > > > * its own inode to track the size, flags, etc. > > > */ > > > file = anon_inode_getfile_secure(anon_name, &kvm_gmem_fops, gmem, > > > O_RDWR, NULL); > > > > Umm... Is there any chance that your call site will ever be in a module? > > If not, you are probably OK with that variant. > > Yes, this code can be compiled as a module. I assume there issues with the inode > outliving the module? The entire file, actually... If you are using that mechanism in a module, you need to initialize kvm_gmem_fops.owner to THIS_MODULE; AFAICS, you don't have that done.