--- /dev/null
+From 6d79ff97d634cf5317492f7e80ede5b8e07bf51a Mon Sep 17 00:00:00 2001
+From: Andrei Tatar <andrei@unikraft.io>
+Date: Wed, 10 May 2023 15:21:30 +0300
+Subject: [PATCH] Save RIP from previous stack frame
+
+__unw_getcontext assumes the throwing function's return address is at
+the top of the stack; however, this does not hold in unikraft, instead
+we must go one stack frame earlier to get the right address.
+
+Co-authored-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
+Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
+Signed-off-by: Andrei Tatar <andrei@unikraft.io>
+---
+ libunwind/src/UnwindRegistersSave.S | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libunwind/src/UnwindRegistersSave.S b/libunwind/src/UnwindRegistersSave.S
+index b39489235..49067c021 100644
+--- a/src/UnwindRegistersSave.S
++++ b/src/UnwindRegistersSave.S
+@@ -90,7 +90,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext)
+ movq %r13,104(PTR)
+ movq %r14,112(PTR)
+ movq %r15,120(PTR)
+- movq (%rsp),TMP
++ movq 8(%rbp),TMP
+ movq TMP,128(PTR) # store return address as rip
+ # skip rflags
+ # skip cs
+--
+2.40.1
+