From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795100069; b=HXedtklEskDuTThlCwhYkLu0XRJdxI0Q7//UMEAGGFpVaAGsnjDcAOFCfTWTomyC71VK OfDXsfz4LPt+UmfbQ3gYVBdmqKe6Bp4jZ31XyKoF8zCrDtOcFtP5pgMMBs6EmWbaAd8HU QwqM/HB+eqyFvCacySahyAidEx0cCV1eQ+Ot5ijRIFG5U+oRtJgovHexIlL+uM4Y9JmVk unlFiA2hDcevn2coHsh+GzIIvvSdQMSoiLmWasXzHv/IowVZNY39JaQz75+vrsu9skOzx rHXK7euoIGnus18ni2PQ5suYIVm2mkST35aJjSibr3oRnlhxWkNOgn1w7EoAVrJp5jA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795100069; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=P2zzf8FFEBL81oIQV+yxC49Gt94XvsXrSt4IwcmCdEQ=; b=Yn/uvhmVR6RIIhNESGhDh7WzGWvMufDVL4AE5yQH86ngBuBMSq0VRqy1tACyfVkeACIq wIjeRmptg5P09RiZ0LaYIW1Lhc9LZd661cY6P5L7MCOb1dhF2ayoxH9potPiTXdWtp3Nh 304i99sq44DNlBnXZ4kCADhT454PGG/nw3DSNhUH2Wl2JXxPOuu/8aaGJgDaCkvBkO5MA kqxnhoHbkA79r+g0EDmVVZ3JpS9bkEGUlEjtPjJlb6mkuSj/KkNiI8zUNG3axB50q9OAW Lz9X7Sp36S49N0c3CJhEHy+vuVKtvvi6DHn1k8tY/xCNXMweCrVy3FVvo84ntZjYMdA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b="jnl7/H8R"; arc=none smtp.remote-ip=209.85.214.200 Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50309606A326 for ; Thu, 19 Nov 2026 14:54:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 50309606A326 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=jnl7/H8R Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2ee2d612733so8166585ad.0 for ; Thu, 19 Nov 2026 06:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1795100069; x=1795704869; darn=vger.kernel.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=P2zzf8FFEBL81oIQV+yxC49Gt94XvsXrSt4IwcmCdEQ=; b=jnl7/H8R1eTBRPe4w3y/4xrMwlzD7pXAE8zRlMYip42/K3AEefn2SREmoAoHvl31Vu F/yWAnRvTXdXHfG7UaF8QJaP3uoylFIzyMQ07FqbUO9hnPQBalqpDkHTDjVREGXPOq2Q NJ3iTqNdel51Z5y+pZYzFFOihS1TyYT6Zqov7sUHBr1kuK6RNBrM+tC0MUkuVWrqXwOJ 7lrJqEOifb6FwNE1XNLAr8Cv/nbRlEZZzvbez8DnTDrlA47guSI02N9whwz0F+hP+xQV 5l0L+xo+quddDMbts/vZfwBB6T6+t6avSiiq3r5IacJLgWiPBLbZs2JLq/ug0f+AWiYt QqfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795100069; x=1795704869; 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=P2zzf8FFEBL81oIQV+yxC49Gt94XvsXrSt4IwcmCdEQ=; b=eY0d43IgVYAxU61doc7ASX9gEHxdzBFbcIz9BXMJtxDQv4ZZ3defaOC2l2mts2GOfX yKbjBjbD0jmYP14BjVLin/PwG7YCJ03ImhYPT8+dkvmiutG7yN67WWRA+RQye0XsL0uP TVgaWr3HqbleNFWDEgpmSCCl30Snm6zjDK47GJbmKLXLIbaErjW+9qDp5ogEP2Vtfe0L wCB+MlR8O+JAK9JScoubkayIy1KcKhOpAM36Aa68RoJnBGz/kwrfPDaSbJMclVQoHCOW VCCZ0TMq16PguVQEeDp6OUY7BigSgMavgThoovj56LteJENNCYqkZRDIWZfGI3yBSb+q UykA== X-Forwarded-Encrypted: i=1; AL+hErGM5HPkwo7r5l8/p1S2XQLFDqi72FEDpMp2tpwY+XLP3jYf9zhzjRMuesvB6g4CXMz2Y0g4geXKdxjf6Sk=@vger.kernel.org X-Gm-Message-State: APuU4Z/6pMtFaHW2HDsSl1XrtDhOAwVUx2anCG5Cy7Oh6+qqOR0E4fxl m5kBioAi1pRIkxkK2wmcFdJW33U8aZOIp+azduYvs2wSUCqBlcg9OYu62WMoJ4MM/QorxQln3Ww HVHFFUw== X-Received: from plbkl12.prod.google.com ([2002:a17:903:74c:b0:2ed:4c9b:1bfc]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:e74c:b0:2ef:f2e0:db0 with SMTP id d9443c01a7336-2f03f18fb43mr715205ad.10.1795100068394; Thu, 19 Nov 2026 06:54:28 -0800 (PST) Date: Thu, 19 Nov 2026 06:54:27 -0800 In-Reply-To: <120ad525-efa5-4129-9d97-fa6fa5db747f@arm.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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> 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" 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 (b) something in KVM tries to actually GUP the memslot using the userspace virtual address. > and thats what this patch is trying to fix in arm64 KVM. The question is: > > 1) Should this be fixed ? How does TDX/SNP support older VMMs with > inplace conversion ? What was the conclusion on this breakage ? There is no "breakage". If userspace doesn't point the userspace address at a valid VMA, that userspace's problem. The only thing the early check would do is prevent weird use cases that may or may not be valid (and for which KVM doesn't care), and error out earlier if KVM guesses right and userspace really did goof. > 2) If it should be, then shouldn't it be done in kvm_gmem_create() ? No. As above, I don't see any reason to have the check at all.