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 374ED606A33B for ; Sat, 5 Dec 2026 10:39:23 +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=2gf9BZI7; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=o4ljZ2my 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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=4Lp7ZW8J64ICiVpLClumxoxf3Zg+dHdAwNNecQocHO8=; b=2gf9BZI7Mj40im Xcfzfg3DohUX5/9lKV5poo3QKrIC1hv04562snVMfanm2A3fGxJhEltqTmVB8mVQzhz5OxZ5cilkP 7W2TeetI9Rx4HZVdYJAGXYCLdqVovtCNOFEsVSVq/UjCe4KSqI/zBtjC874/rbLyUQyDcfdbV15nz L0nTXxomMNaW80pfFb6/gTLIfoNvZikNJ8KuYdYFfKlnylmpeUjBuGptb0e84wUjW8OAmxQE6jiJv IsZ3VyaqH8m5XYtJgoknqbAz9fVqB8DctBP7FULsh6pY49JXC3oGYb5XUjYldMqjKlwosnC0n0Ntq ofgd8V+uSkfmrxA9Bxig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZnAj-00000002HSz-1AAF; Sat, 05 Dec 2026 10:39:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZnAe-00000002HRi-244o for linux-arm-kernel@lists.infradead.org; Sat, 05 Dec 2026 10:39:15 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 67A271655; Sat, 5 Dec 2026 02:39:08 -0800 (PST) Received: from entos-yitian-01.Arm.com (unknown [10.168.196.233]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 382B33F632; Sat, 5 Dec 2026 02:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796467151; bh=gJQ8p+i2KKlxw/ot5zevr33Usf3bB+aHRTMWC5igFNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o4ljZ2mySy7vO+em/sdGdsLYEtDIfdC4SmMPMrj2sk0PSxa8hElooekSPL+pwdvn3 onki9A+vV+58k11j5p7nhu1uDNkD12tIIA3+zEWcEAu7V7c/ZZhkuC+Bi9v12Vkuip qcyUgtMXVxxfWTv+auLbOAi//DFrUJPu6ZmzATgs= From: Jia He To: Marc Zyngier , Oliver Upton Cc: Jia He , Fuad Tabba , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Paolo Bonzini , Sean Christopherson , Shuah Khan , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Sashiko , Yuan Yao Subject: [PATCH v5 2/3] KVM: arm64: nv: Inject an SEA when the VNCR walk cannot set the AF Date: Sat, 5 Dec 2026 10:38:43 +0000 Message-Id: <20261205103844.3405166-3-justin.he@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261205103844.3405166-1-justin.he@arm.com> References: <20261205103844.3405166-1-justin.he@arm.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261205_023912_774530_225354E7 X-CRM114-Status: UNSURE ( 8.49 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.4 (----) 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=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 With TCR_EL2.HA set and AF clear, the VNCR stage-1 walk tries to update the leaf descriptor. If the table is in a read-only memslot, __kvm_at_swap_desc() returns -EPERM and walk_s1() records an SEA on the table walk. The VNCR walk uses the EL2&0 regime, so nested stage-2 permissions do not enter into this case. kvm_handle_vncr_abort() ignores -EPERM and re-enters the guest, which takes the same abort again. Handle -EPERM and inject the recorded SEA. On Neoverse-N2 the unpatched case took about 1.3 million exits in five seconds. With the fix the guest received a level-3 table-walk SEA. Reported-by: Sashiko Closes: https://lore.kernel.org/all/sashiko-outbox-230439@kernel.org/ Fixes: bff8aa213dee ("KVM: arm64: Implement HW access flag management in stage-1 SW PTW") Reviewed-by: Yuan Yao Signed-off-by: Jia He --- arch/arm64/kvm/nested.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index ff78d2784db5..867bcdd69382 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -1718,6 +1718,7 @@ int kvm_handle_vncr_abort(struct kvm_vcpu *vcpu) case -EINVAL: case -ENOENT: case -EACCES: + case -EPERM: /* * Translation failed, inject the corresponding * exception back to EL2. -- 2.34.1