From: Marco Schlumpp Date: Mon, 2 Jan 2023 10:22:18 +0000 (+0100) Subject: plat/kvm/x86: Stop unwinding at _libkvmplat_entry2 X-Git-Tag: RELEASE-0.13.0~74 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ce2e3dae5f8d876e38dcdcf0c3a83850cfb98dc8;p=unikraft%2Funikraft.git plat/kvm/x86: Stop unwinding at _libkvmplat_entry2 The _libkvmplat_entry2 function is called using assembler code that switches stacks. Therefore, a debugger can't unwind its frame. This inserts a CFI that marks the previous instruction pointer as undefined. Signed-off-by: Marco Schlumpp Reviewed-by: Simon Kuenzer Approved-by: Simon Kuenzer Tested-by: Unikraft CI GitHub-Closes: #700 --- diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c index c725656e2..e24df5ebc 100644 --- a/plat/kvm/x86/setup.c +++ b/plat/kvm/x86/setup.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -287,6 +288,13 @@ static inline int cmdline_init(struct ukplat_bootinfo *bi) static void __noreturn _ukplat_entry2(void) { + /* It's not possible to unwind past this function, because the stack + * pointer was overwritten in lcpu_arch_jump_to. Therefore, mark the + * previous instruction pointer as undefined, so that debuggers or + * profilers stop unwinding here. + */ + ukarch_cfi_unwind_end(); + ukplat_entry_argp(NULL, cmdline, cmdline_len); ukplat_lcpu_halt();