Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] KVM: arm64: Ensure level is always initialized when relaxing" failed to apply to 6.12-stable tree
@ 2026-07-20 12:21 gregkh
  2026-07-21 10:05 ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Marc Zyngier
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2026-07-20 12:21 UTC (permalink / raw)
  To: oupton, maz, weilin.chang; +Cc: stable


The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 100baf0184896f859290a684f864b8200d8ac872
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026072033-wrinkle-closure-7d3c@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 100baf0184896f859290a684f864b8200d8ac872 Mon Sep 17 00:00:00 2001
From: Oliver Upton <oupton@kernel.org>
Date: Wed, 1 Jul 2026 16:16:19 -0700
Subject: [PATCH] KVM: arm64: Ensure level is always initialized when relaxing
 perms

stage2_update_leaf_attrs() returns early before writing to @level if the
table walker returned an error. At the same time,
kvm_pgtable_stage2_relax_perms() uses the level as a TLBI TTL hint when the
error was EAGAIN, indicating the vCPU raced with a table update and the TLB
entry it hit is now stale.

Fall back to an unknown TTL if none was provided by the walk.

Cc: stable@vger.kernel.org
Fixes: be097997a273 ("KVM: arm64: Always invalidate TLB for stage-2 permission faults")
Signed-off-by: Oliver Upton <oupton@kernel.org>
Reviewed-by: Wei-Lin Chang <weilin.chang@arm.com>
Link: https://patch.msgid.link/20260701231620.3300204-2-oupton@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>

diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index 0c1defa5fb0f..386a7468136a 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -1356,7 +1356,7 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,
 				   enum kvm_pgtable_prot prot, enum kvm_pgtable_walk_flags flags)
 {
 	kvm_pte_t xn = 0, set = 0, clr = 0;
-	s8 level;
+	s8 level = TLBI_TTL_UNKNOWN;
 	int ret;
 
 	if (prot & KVM_PTE_LEAF_ATTR_HI_SW)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms
  2026-07-20 12:21 FAILED: patch "[PATCH] KVM: arm64: Ensure level is always initialized when relaxing" failed to apply to 6.12-stable tree gregkh
@ 2026-07-21 10:05 ` Marc Zyngier
  2026-07-21 10:05   ` [PATCH 6.12.y 2/2] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms() Marc Zyngier
  2026-07-21 12:53   ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Marc Zyngier @ 2026-07-21 10:05 UTC (permalink / raw)
  To: stable; +Cc: Oliver Upton, Wei-Lin Chang

From: Oliver Upton <oupton@kernel.org>

stage2_update_leaf_attrs() returns early before writing to @level if the
table walker returned an error. At the same time,
kvm_pgtable_stage2_relax_perms() uses the level as a TLBI TTL hint when the
error was EAGAIN, indicating the vCPU raced with a table update and the TLB
entry it hit is now stale.

Fall back to an unknown TTL if none was provided by the walk.

Cc: stable@vger.kernel.org
Fixes: be097997a273 ("KVM: arm64: Always invalidate TLB for stage-2 permission faults")
Signed-off-by: Oliver Upton <oupton@kernel.org>
Reviewed-by: Wei-Lin Chang <weilin.chang@arm.com>
Link: https://patch.msgid.link/20260701231620.3300204-2-oupton@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
(cherry picked from commit 100baf0184896f859290a684f864b8200d8ac872)
Signed-off-by: Marc Zyngier <maz@kernel.org>
(cherry picked from commit f35e314d4512480316454d3e963c513faa68decf)
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 arch/arm64/kvm/hyp/pgtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index deabc21caae37..70274579cd412 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -1314,7 +1314,7 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,
 				   enum kvm_pgtable_prot prot)
 {
 	int ret;
-	s8 level;
+	s8 level = TLBI_TTL_UNKNOWN;
 	kvm_pte_t set = 0, clr = 0;
 
 	if (prot & KVM_PTE_LEAF_ATTR_HI_SW)
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 6.12.y 2/2] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms()
  2026-07-21 10:05 ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Marc Zyngier
@ 2026-07-21 10:05   ` Marc Zyngier
  2026-07-21 12:53   ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2026-07-21 10:05 UTC (permalink / raw)
  To: stable; +Cc: Oliver Upton, Wei-Lin Chang, Mark Brown

Assigning the invalidation level (an s8 value) with TLBI_TTL_UNKNOWN
(a 32bit signed value) is not ideal, to say the least. Instead of
this, only pass TLBI_TTL_UNKNOWN to __kvm_tlb_flush_vmid_ipa_nsh()
when we know for sure that we don't have a provided level.

Fixes: 100baf0184896 ("KVM: arm64: Ensure level is always initialized when relaxing perms")
Reported-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Oliver Upton <oupton@kernel.org>
Link: https://lore.kernel.org/r/akztC7H2IsEKaq4i@sirena.org.uk
Link: https://patch.msgid.link/20260707162935.1900874-1-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
(cherry picked from commit 8d187d4b33c262c0f3e44842553521151d8629e8)
Signed-off-by: Marc Zyngier <maz@kernel.org>
(cherry picked from commit 42dfd119dce06db36d3127ec48e12b0eeb7e8545)
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 arch/arm64/kvm/hyp/pgtable.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
index 70274579cd412..dca66f7571bea 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -1314,7 +1314,7 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,
 				   enum kvm_pgtable_prot prot)
 {
 	int ret;
-	s8 level = TLBI_TTL_UNKNOWN;
+	s8 level;
 	kvm_pte_t set = 0, clr = 0;
 
 	if (prot & KVM_PTE_LEAF_ATTR_HI_SW)
@@ -1333,7 +1333,8 @@ int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,
 				       KVM_PGTABLE_WALK_HANDLE_FAULT |
 				       KVM_PGTABLE_WALK_SHARED);
 	if (!ret || ret == -EAGAIN)
-		kvm_call_hyp(__kvm_tlb_flush_vmid_ipa_nsh, pgt->mmu, addr, level);
+		kvm_call_hyp(__kvm_tlb_flush_vmid_ipa_nsh, pgt->mmu, addr,
+			     (ret == -EAGAIN) ? TLBI_TTL_UNKNOWN : level);
 	return ret;
 }
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms
  2026-07-21 10:05 ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Marc Zyngier
  2026-07-21 10:05   ` [PATCH 6.12.y 2/2] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms() Marc Zyngier
@ 2026-07-21 12:53   ` Greg KH
  2026-07-21 13:01     ` Marc Zyngier
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2026-07-21 12:53 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: stable, Oliver Upton, Wei-Lin Chang

On Tue, Jul 21, 2026 at 11:05:22AM +0100, Marc Zyngier wrote:
> From: Oliver Upton <oupton@kernel.org>
> 
> stage2_update_leaf_attrs() returns early before writing to @level if the
> table walker returned an error. At the same time,
> kvm_pgtable_stage2_relax_perms() uses the level as a TLBI TTL hint when the
> error was EAGAIN, indicating the vCPU raced with a table update and the TLB
> entry it hit is now stale.
> 
> Fall back to an unknown TTL if none was provided by the walk.
> 
> Cc: stable@vger.kernel.org
> Fixes: be097997a273 ("KVM: arm64: Always invalidate TLB for stage-2 permission faults")
> Signed-off-by: Oliver Upton <oupton@kernel.org>
> Reviewed-by: Wei-Lin Chang <weilin.chang@arm.com>
> Link: https://patch.msgid.link/20260701231620.3300204-2-oupton@kernel.org
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> (cherry picked from commit 100baf0184896f859290a684f864b8200d8ac872)
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> (cherry picked from commit f35e314d4512480316454d3e963c513faa68decf)

This id isn't in the tree, something went wrong?

I'll just drop it and use the real one here.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms
  2026-07-21 12:53   ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Greg KH
@ 2026-07-21 13:01     ` Marc Zyngier
  0 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2026-07-21 13:01 UTC (permalink / raw)
  To: Greg KH; +Cc: stable, Oliver Upton, Wei-Lin Chang

On Tue, 21 Jul 2026 13:53:46 +0100,
Greg KH <gregkh@linuxfoundation.org> wrote:
> 
> On Tue, Jul 21, 2026 at 11:05:22AM +0100, Marc Zyngier wrote:
> > From: Oliver Upton <oupton@kernel.org>
> > 
> > stage2_update_leaf_attrs() returns early before writing to @level if the
> > table walker returned an error. At the same time,
> > kvm_pgtable_stage2_relax_perms() uses the level as a TLBI TTL hint when the
> > error was EAGAIN, indicating the vCPU raced with a table update and the TLB
> > entry it hit is now stale.
> > 
> > Fall back to an unknown TTL if none was provided by the walk.
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: be097997a273 ("KVM: arm64: Always invalidate TLB for stage-2 permission faults")
> > Signed-off-by: Oliver Upton <oupton@kernel.org>
> > Reviewed-by: Wei-Lin Chang <weilin.chang@arm.com>
> > Link: https://patch.msgid.link/20260701231620.3300204-2-oupton@kernel.org
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > (cherry picked from commit 100baf0184896f859290a684f864b8200d8ac872)
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > (cherry picked from commit f35e314d4512480316454d3e963c513faa68decf)
> 
> This id isn't in the tree, something went wrong?

Crap. No idea how I managed to have *two* of those. Probably a
cherry-pick -xs between stable trees... :-/

Sorry for the mess.

> I'll just drop it and use the real one here.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-21 13:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 12:21 FAILED: patch "[PATCH] KVM: arm64: Ensure level is always initialized when relaxing" failed to apply to 6.12-stable tree gregkh
2026-07-21 10:05 ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Marc Zyngier
2026-07-21 10:05   ` [PATCH 6.12.y 2/2] KVM: arm64: Fix propagation of TLBI level in kvm_pgtable_stage2_relax_perms() Marc Zyngier
2026-07-21 12:53   ` [PATCH 6.12.y 1/2] KVM: arm64: Ensure level is always initialized when relaxing perms Greg KH
2026-07-21 13:01     ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox