You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segfault on Linux when opening a terminal; stack overflow in pty_utils.isPasswordMode #780
Full transparency: I do not know much Zig, most of the tracing on this came from AI, but I have reproduced and verified the issue/fix herein by hand.
M-x ghostel segfaults Emacs on first render on Linux (aarch64, glibc 2.42,
Emacs 30.2, ghostel 0.60.0) with both the prebuilt release binary and
with a source build (zig 0.17.0, ReleaseFast), and with emacs -Q -nw. It does
not happen in --batch, or with a Debug build.
Cause: isPasswordMode in src/pty_utils.zig declares var tio: sys.termios. On
Linux, std.posix.system.termios is the kernel struct (36 bytes: 4 flag words,
line, 19 control chars). It then calls glibc's tcgetattr, which writes glibc's struct termios (60 bytes: NCCS=32 plus speeds). That overflows the stack by 24
bytes on every call. ReleaseFast overwrites the saved return address (gdb showed a
jump to 0x960000000000). A ReleaseSafe build with symbols trips the stack
protector:
Activity
jolenta-dev commentedon Nov 1, 2026
@emil-e thanks!