Skip to contentSkip to conversation

KVM: arm64: Move __hyp_set_vectors out of .hyp.text

PATCH Applied Quentin Perret 3 participants 4 messages Jan 28, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm64: Move __hyp_set_vectors out of .hyp.text

The .hyp.text section is supposed to be reserved for the nVHE EL2 code. However, there is currently one occurrence of EL1 executing code located in .hyp.text when calling __hyp_{re}set_vectors(), which happen to sit next to the EL2 stub vectors. While not a problem yet, such patterns will cause issues when removing the host kernel from the TCB, so a cleaner split would be preferable.

Fix this by delimiting the end of the .hyp.text section in hyp-stub.S.

---
 arch/arm64/kernel/hyp-stub.S | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/hyp-stub.S +2 -0
index 160f5881a0b7..8a60f9c586bb 100644
@@ -85,6 +85,8 @@ SYM_CODE_END(\label)
 	invalid_vector	el1_fiq_invalid
 	invalid_vector	el1_error_invalid
 
+	.popsection
+
 /*
  * __hyp_set_vectors: Call this after boot to set the initial hypervisor
  * vectors as part of hypervisor installation.  On an SMP system, this should
Signature · 6 lines
2.30.0.280.ga3ce27912f-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 26 lines · Quentin Perret

The .hyp.text section is supposed to be reserved for the nVHE EL2 code. However, there is currently one occurrence of EL1 executing code located in .hyp.text when calling __hyp_{re}set_vectors(), which happen to sit next to the EL2 stub vectors. While not a problem yet, such patterns will cause issues when removing the host kernel from the TCB, so a cleaner split would be preferable.

Fix this by delimiting the end of the .hyp.text section in hyp-stub.S.

---
 arch/arm64/kernel/hyp-stub.S | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/hyp-stub.S +2 -0
index 160f5881a0b7..8a60f9c586bb 100644
@@ -85,6 +85,8 @@ SYM_CODE_END(\label)
 	invalid_vector	el1_fiq_invalid
 	invalid_vector	el1_error_invalid
 
+	.popsection
+
 /*
  * __hyp_set_vectors: Call this after boot to set the initial 
Quoted 3 lines

hypervisor
* vectors as part of hypervisor installation. On an SMP system, this
should

Thanks for tracking this one down, Quentin.

Catalin, Will: should you want to take this one via the arm64 tree, please add my

Acked-by Marc Zyngier <maz:kernel.org>

Thanks,

        M.
Signature · 5 lines
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
maintainer
#2 lore raw
Quoted 33 lines · Marc Zyngier
Quoted 26 lines · Quentin Perret

The .hyp.text section is supposed to be reserved for the nVHE EL2 code. However, there is currently one occurrence of EL1 executing code located in .hyp.text when calling __hyp_{re}set_vectors(), which happen to sit next to the EL2 stub vectors. While not a problem yet, such patterns will cause issues when removing the host kernel from the TCB, so a cleaner split would be preferable.

Fix this by delimiting the end of the .hyp.text section in hyp-stub.S.

---
 arch/arm64/kernel/hyp-stub.S | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/hyp-stub.S +2 -0
index 160f5881a0b7..8a60f9c586bb 100644
@@ -85,6 +85,8 @@ SYM_CODE_END(\label)
 	invalid_vector	el1_fiq_invalid
 	invalid_vector	el1_error_invalid
 
+	.popsection
+
 /*
  * __hyp_set_vectors: Call this after boot to set the initial
Quoted 3 lines

hypervisor
* vectors as part of hypervisor installation. On an SMP system, this
should

Thanks for tracking this one down, Quentin.

Quoted 4 lines

Catalin, Will: should you want to take this one via the arm64 tree, please add my

Acked-by Marc Zyngier <maz:kernel.org>

Cheers, I'll pick this up for 5.12 with your Ack.

Will
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

maintainer Applied
#3 lore raw
In reply to Quentin Perret
Quoted 8 lines · Quentin Perret

The .hyp.text section is supposed to be reserved for the nVHE EL2 code. However, there is currently one occurrence of EL1 executing code located in .hyp.text when calling __hyp_{re}set_vectors(), which happen to sit next to the EL2 stub vectors. While not a problem yet, such patterns will cause issues when removing the host kernel from the TCB, so a cleaner split would be preferable.

[...]

Applied to arm64 (for-next/misc), thanks!

[1/1] KVM: arm64: Move __hyp_set_vectors out of .hyp.text

      https://git.kernel.org/arm64/c/e30be1455bd3

Cheers,

Signature · 9 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm