old qemu (before april 2020) have a bug in the layout of struct ucontext, so we get invalid values under qemu-userspace emulation when inspecting the signal context. Try to recognize this and graciously error out instead of segfaulting in the backtracer routines.
Unified · Split
| @@ -843,8 +843,10 @@ static int rt_get_caller_pc(addr_t *paddr, rt_context *rc, int level) · 842 unmodified lines | ||
| 843 | 843 | *paddr = rc->ip; |
| 844 | 844 | } else { |
| 845 | 845 | addr_t *fp = (addr_t*)rc->fp; |
| 846 | − while (--level) | |
| 846 | + while (--level && fp >= (addr_t*)0x1000) | |
| 847 | 847 | fp = (addr_t *)fp[-2]; |
| 848 | + if (fp < (addr_t*)0x1000) | |
| 849 | + return -1; | |
| 848 | 850 | *paddr = fp[-1]; |
| 849 | 851 | } |
| 850 | 852 | return 0; |