From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA6A8606A31A for ; Wed, 2 Dec 2026 01:09:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Dl+Obtxy; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=OuuMJcZ5 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:From: Subject:Message-ID:References:Mime-Version:In-Reply-To:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=g/kWKb9oZusK72C6OJcw0UM4QUThZkRWvvE3svgxpso=; b=Dl+Obtxy8A0MKJvbQfns4KoMBI xj30+oKWCO9v9qUjOzpgtNCZhk+B3etY5mz5qvkgEGcwbOiLmFrZupmqfMe5NrfvRGBh5FoUvcrFe eQxiuRnuxwILLF9rrM0PfE3tQCj/ZQeZ/yfm0Uuc0tC0U56r5BnYgsvj3xPCMFDHVkCzHo4KYM5RK 7iCCTOM6xaU+Q11NNsjk1F6eGYgbxpB0lgiaI8OfsLpsUrLzgIT7QcpeufNepytxX2Uuu3c28F2Kp dbBHVXXjbRd6ntFtOBwa4Ah56ctp8RqM76DcxwZfBdKT/Xf7mLubVGaW+8YwNMqC1/h+VVj4TmSuk Q0NSnB/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYqi-00000009qmO-1JdL; Wed, 02 Dec 2026 01:09:32 +0000 Received: from mail-pf1-x447.google.com ([2607:f8b0:4864:20::447]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYqf-00000009qm2-2RRk for linux-arm-kernel@lists.infradead.org; Wed, 02 Dec 2026 01:09:30 +0000 Received: by mail-pf1-x447.google.com with SMTP id d2e1a72fcca58-8b203b0c139so8690069b3a.2 for ; Tue, 01 Dec 2026 17:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796173768; x=1796778568; darn=lists.infradead.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=g/kWKb9oZusK72C6OJcw0UM4QUThZkRWvvE3svgxpso=; b=OuuMJcZ5UP3DQmzt1CI8oiaMGZwap0m40yih5OGHXb/7keTy4d+LxUu7ldZJWdndqa u6KsIe6s6OU37ebD6DpNvY1NXemD6RgBfiVyQriI9NACdexO12wXgrCOIE7KqAO4yXz3 UEeklMk/raE83AXXzGkcUPHmwSXAL5HoebspMp7KH8uUm5X1gSFB7LCMxBapSogPbAj7 X2xQ9NEbGxs4E6xFlbSzrDxZL4KkE1zPvFyl12ZLvyjPw3vpFSOSUg+8ZWQezvzVbOPk Vr92AOkunIWrF2lrgNslAJ7nmzjFagYaFY5Fr2OG1UHXT/ARBOWqma88V+oxIVIAhumN CPWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796173768; x=1796778568; h=content-type: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:content-type; bh=g/kWKb9oZusK72C6OJcw0UM4QUThZkRWvvE3svgxpso=; b=XgjM3UD+GNE6B/u7cgtcz8YsTFShlKCVp+s16KD9/rLzdLO8999/bsO5V0FRsxUtYJ 0brzkdMha6zba1463dqvdUC1GQX2Iz/98WFcfHrzhtgjax+YP2DSVGyY4TMCdYywXI7c 0W2NSMBcTUIl+9mZkjUfqZn774pyPLutfI+az72xO4oQntHgcHntyw4QDAL2vKnEg76m xJ65sPSpRZ3WlGb4GvtDwGx8QzTDfnmszgxEH5kllKyZIuu+RsiQJ1LtaFqrCYefpxqK W4b3Z5Xgs2QNVNa+gSJgLVuPakxjTiOij+MJQZU9TP61ETK01AQFFvfnXSPAGlOnIhto h3WA== X-Forwarded-Encrypted: i=1; AL+hErH0oIUCXkyooAt0HOLqFleQv7p19BbhjFwujp6QO2gMnmzy5vNF1fiWwQvPi8BwYydt8Vw8oWaU9nmGucu6C8XP@lists.infradead.org X-Gm-Message-State: APuU4Z9WVeoOb5w+4dLyvVlMY4ImbXfQMJ8v18ijMA7z44VNxmbD9rtJ /0MoJ6hXBcMMiT+HdlIoi+QC1ncMBNVh+FBNOoxncLwkj3QALedMI6STQ36chtxHJCpf0EUULki 9FN8OQQ== X-Received: from pfbks11.prod.google.com ([2002:a05:6a00:4b8b:b0:8b5:fe4e:af1c]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1acd:b0:881:be70:448e with SMTP id d2e1a72fcca58-8c87d220cffmr39054990b3a.53.1796173767569; Tue, 01 Dec 2026 17:09:27 -0800 (PST) Date: Tue, 1 Dec 2026 17:09:26 -0800 In-Reply-To: <3a3c5681-ff1e-47b6-b942-2d5ce64a8d6d@arm.com> X-Archived-By: Mime-Version: 1.0 References: <20261116164358.142785-1-steven.price@arm.com> <20261116164358.142785-2-steven.price@arm.com> <6bb490cd-ebbe-41d7-adf3-d6eaf0e53478@arm.com> <8a095a42-662a-416d-a5d7-79e10161201c@arm.com> <120ad525-efa5-4129-9d97-fa6fa5db747f@arm.com> <3a3c5681-ff1e-47b6-b942-2d5ce64a8d6d@arm.com> Message-ID: Subject: Re: [PATCH v3 01/11] KVM: arm64: guest_memfd: Check mmap support when preparing memslot From: Sean Christopherson To: Suzuki K Poulose Cc: Steven Price , Fuad Tabba , Ackerley Tng , kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo Pieralisi , Kohei Enju Content-Type: text/plain; charset="us-ascii" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_170929_650234_B65B68EE X-CRM114-Status: GOOD ( 26.81 ) X-Spam-Score: -9.5 (---------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-13.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Mon, Nov 23, 2026, Suzuki K Poulose wrote: > On 19/11/2026 14:54, Sean Christopherson wrote: > > On Thu, Nov 19, 2026, Suzuki K Poulose wrote: > > > I see, thanks Steven. For context: > > > > > > Arm64 currently (without inplace conversion support) only allows GMEM > > > with MMAP flags only and relies on kvm_slot_gmem_only() to detect that > > > the GMEM has MMAP flag. But, when we enable inplace conversion, > > > we can't reliably reject the slots by kvm_slot_gmem_only(), because > > > all GMEM slots are marked GMEM only with inplace conversion. > > > > > > Also, from the API Documentation, > > > > > > "When the KVM MMU performs a PFN lookup to service a guest fault, the fault > > > will always be consumed from guest_memfd, regardless of whether it is a shared > > > or a private fault (unless in-place conversion is disabled and the backing > > > guest_memfd does not have the GUEST_MEMFD_FLAG_MMAP flag set)." > > > > So, in effect, with in-place conversion enabled a KVM_CREATE_GUEST_MEMFD > > > without GUEST_MEMFD_FLAG_MMAP is an error > > > > It's only an error if (a) the userspace address in the memslot points at the > > gmem fd and > > I don't understand this part. With inplace conversion, we mark the slot > as GMEM_ONLY and always resolve shared faults from the gmem (on arm64 > as described by the API). So, isn't it a usage error from the VMM if it > plans to use GUEST_MEMFD_FLAG_MMAP=false with inplace conversion ? Sure, but KVM isn't the usage police. Critically, KVM can't know what the VMM *intends*, KVM only knows what the VMM has actually done. > In other words, do you mean to say, passing a non-gmem fd userspace address > is fine with GUEST_MEMFD_FLAG_MMAP=false ? Yes. arm64 is relatively unique in that it does VMA lookups when handling faults, most other architectures don't care. E.g. x86 cares only what's mapped into the userspace page tables, and doesn't try to enforce anything at a VMA level. > But the API documentation I don't see any contradiction. The blurb you quote above specifically talks about guest faults, and KVM *does* go straight to gmem for those. KVM accesses to guest memory aren't guest faults, so that above blurb doesn't apply. > and the GMEM_ONLY flags contradict the usage. GMEM_ONLY is a KVM-internal thing, and is slightly misnamed. It's really KVM_MMU_CAN_GET_PFNS_FROM_GMEM or something like that. > Now, should we reject that in KVM or not is the secondary question. No, because we risk disallowing legitimate (if unusual) setups that KVM can handle just fine.