Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1935357rdb; Mon, 9 Oct 2023 07:33:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeFx29RXYTBuCklY+DLGJKgLukpMaT3Da3OkGQ+1uAKC0NGmczYOlQsU1Jgleqqbl9uZ8N X-Received: by 2002:a17:90a:fe92:b0:26d:3d86:9a8e with SMTP id co18-20020a17090afe9200b0026d3d869a8emr13233979pjb.25.1696861990263; Mon, 09 Oct 2023 07:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696861990; cv=none; d=google.com; s=arc-20160816; b=Zmpl6bLBa9XXdcqa/BwIw2Qo1c80gFkzlkiUwV9Jbk6OS6YGItTuX8Xno4dkjs7eN5 0BY+qwEbXt6m1HOQQpp9jkD6XdayRXSnwixQZelnjks/nclSIJeThrFNnO5C4zxGMn0T RnPIVoflk43aSDeRVJszNfH28fk3Q3lNe+ziZGxUrTS2tWWePCJM+jpCIsUDzKgTjAR+ g4fqxL3E51SUaWD6l+k36g3d5sUBPyArG6kqfvy/xVwSYgsdOJX5V9Fp9/2kpTDvM+Zg MxXMHYxXeViTOfv3/0fiGaC+Lv1R8yVidLKuEIwyZ4L13ctgeeTVwBwOIrQM3iXVeVif uiHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=c58kk/+pxIX/wrMYI0UdcO/2SV8ZUW4S1dCgLTiDEi4=; fh=6r7tsuSNtEA1kc6u9rolnGSwa9O/8zGR77V4wjPW5XA=; b=osQ8nO0I6FUxC6GS4/fKN7AZn1LJZOFtHe0Z0kGA1CU4f8hTyrmnkjAtYr1tCsu4W7 NNcn92TbXpP36FtYFv1ru+HVF4K92d2Io24FmHSk03iURpAgMt6R4X5T8vFpKQh4QCAO 50uf0NpvO8GOddQNhfSof+FoZkhgAfa6xuD++joyot96M2skCtVL1jydm6RFnK9bstJw pNhUEPjygv4Ky/a87rjstMggg7erapNj2eRsgtmFGQJniPlaz5GQiohifxH1I8e0gJSC qFimCvj5KA8sKAEAigaV73zhq6Wq0/0fs8fCEiNLX3ZhjMICdDlJM9LiFnSFW53DQYWA pUgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=oIXGuLWN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x5-20020a17090a8a8500b0026f75d932a8si9378632pjn.185.2023.10.09.07.33.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 07:33:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=oIXGuLWN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2A2288046BCF; Mon, 9 Oct 2023 07:33:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230484AbjJIOcu (ORCPT + 99 others); Mon, 9 Oct 2023 10:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbjJIOct (ORCPT ); Mon, 9 Oct 2023 10:32:49 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD72CA1 for ; Mon, 9 Oct 2023 07:32:48 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-5803b6fadceso2867413a12.0 for ; Mon, 09 Oct 2023 07:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696861968; x=1697466768; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=c58kk/+pxIX/wrMYI0UdcO/2SV8ZUW4S1dCgLTiDEi4=; b=oIXGuLWNgIALv7bwptDx4vgtBF02AS/hY4Me/jy7GCA/z4H+w9yy8phvJDHzpOk1qN GjyAfs07Jsi2f/du72jYu7/le4I75MtuohSXdf/8pcgqiBXGvl4/BXW+/ghFYxs2rf/u gA7lAKqxPFLx0WMPhM5zSDY1G7EmOix/JSO03dW7zPgCdrLZMs1kK2vmf2zUTrl9As9F aBe00hSwM9LhLQiwofc15PObcfn+pfUdfpmKrDKixdsTi7o7X7a60B/Nic+oZIbtYzRf YcsxvnXoeTBDzhDEFsEOIX2mJmMFE5cWlwHP4+wF0rYUTIbw+Emh6fT/NzjRCFZ0ii1o dYNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696861968; x=1697466768; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=c58kk/+pxIX/wrMYI0UdcO/2SV8ZUW4S1dCgLTiDEi4=; b=SEbBZkYL+6A/2ZHZxVGy91sIP4nVAarxqvPISw4pM4qWZ0RLe2Bu+L3/E21tRAAKc2 YRsuDvxhkxiFRY6VbNpId+RKEbeBfc3ho/kNDKuqbxogMSdDtsp+FQYClrw+h5hdKVrC PsFx/q/ZLPNuP9bJc7Vyv6CRTUENPB+RoTfDXiTCN7QPZBs5lKIm3o/rBOQrUEDRpCvw 1Eb5TrY3P2KdTwmWDfA3my5i97e4WkMiVlaSLCwLb1cOR+0pDxbVdN1aFas1j1y0yXoL WKF622oxdJnFQDHjCJpUTfIkKUS7+Nnywz7KJ2KLF/pESSCxmnqvHyQFpvATaiwYXZP1 q+Wg== X-Gm-Message-State: AOJu0YzJ3K2GmbLNVO/BUaYDl9WChqxFXRDrCPAWLDCK3VxvhB2z/TRw LEqin3MXEJjzjkW48rxZxDviIcEBMww= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90a:4802:b0:274:6746:7ed with SMTP id a2-20020a17090a480200b00274674607edmr264620pjh.4.1696861968170; Mon, 09 Oct 2023 07:32:48 -0700 (PDT) Date: Mon, 9 Oct 2023 07:32:48 -0700 In-Reply-To: <20231009022248.GD800259@ZenIV> Mime-Version: 1.0 References: <20230928180651.1525674-1-pbonzini@redhat.com> <169595365500.1386813.6579237770749312873.b4-ty@google.com> <20231009022248.GD800259@ZenIV> Message-ID: Subject: Re: [PATCH gmem FIXUP] kvm: guestmem: do not use a file system From: Sean Christopherson To: Al Viro Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 07:33:05 -0700 (PDT) On Mon, Oct 09, 2023, Al Viro wrote: > On Thu, Sep 28, 2023 at 07:22:16PM -0700, Sean Christopherson wrote: > > On Thu, 28 Sep 2023 14:06:51 -0400, Paolo Bonzini wrote: > > > Use a run-of-the-mill anonymous inode, there is nothing useful > > > being provided by kvm_gmem_fs. > > > > > > > > > > Applied to kvm-x86 guest_memfd, thanks! > > > > [1/1] kvm: guestmem: do not use a file system > > https://github.com/kvm-x86/linux/commit/0f7e60a5f42a > > Please, revert; this is completely broken. anon_inode_getfile() > yields a file with the same ->f_inode every time it is called. > > Again, ->f_inode of those things is shared to hell and back, > very much by design. You can't modify its ->i_op or anything > other field, for that matter. No information can be stored > in that thing - you are only allowed to use the object you've > passed via 'priv' argument. 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);