Originally reported at https://lists.sr.ht/~sircmpwn/hare-users/%3CCADa827F-ogRFG5pGo5byn8FLAui-xtMhHUUX8j9MKbjYYCEOnA@mail.gmail.com%3E
Turns out that it happens independently of -lx11
, whenever a C library is pulled in.
The segfault happens during stack frame walking, when attempting to walk past the outermost frame. My guess is that we assume too much about what the outermost frame says about its (nonexistent) parent, and that assumption is not correct when the outermost frame is set up by libc.
The problem is that the outermost frame is not a frame pointer at all because it enters code which was generated without frame pointers, to the fp register is just used as a temporary. If it were zero it would signal the termination of the stack frame, but since it's a temporary it's just garbage, so we dereference garbage and crash.
Drew DeVault referenced this ticket in commit f2b6348.
Drew DeVault referenced this ticket in commit 72ad406.
Drew DeVault referenced this ticket in commit 72ad406.