[RFC PATCH v4 37/37] arm64: kvm: Annotate stack state for guest enter/exit code

From: Chen Zhongjin
Date: Fri Apr 29 2022 - 05:47:10 EST


From: Julien Thierry <jthierry@xxxxxxxxxx>

Symbol __guest_enter is called from C code, with a valid stack pointer.

Symbol __guest_exit is reached when resuming EL2 execution, and the
previous stack pointer gets restored.

Add adequate unwind hints.

Signed-off-by: Julien Thierry <jthierry@xxxxxxxxxx>
---
arch/arm64/kvm/hyp/entry.S | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index 045d4481c820..0c621b8389e2 100644
--- a/arch/arm64/kvm/hyp/entry.S
+++ b/arch/arm64/kvm/hyp/entry.S
@@ -15,6 +15,7 @@
#include <asm/kvm_mmu.h>
#include <asm/kvm_mte.h>
#include <asm/kvm_ptrauth.h>
+#include <asm/unwind_hints.h>

.text

@@ -22,6 +23,7 @@
* u64 __guest_enter(struct kvm_vcpu *vcpu);
*/
SYM_CODE_START(__guest_enter)
+ UNWIND_HINT_FUNC
// x0: vcpu
// x1-x17: clobbered by macros
// x29: guest context
@@ -110,6 +112,7 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL)
// x1: vcpu
// x2-x29,lr: vcpu regs
// vcpu x0-x1 on the stack
+ UNWIND_HINT_FUNC sp_offset=16

add x1, x1, #VCPU_CONTEXT

--
2.17.1