fix(compile): bump libsui to 0.16.3 to fix segfault under gVisor/Cloud Run - #35701
Merged
Merged
Conversation
…d Run `deno compile` binaries crash at startup when run directly under gVisor (Google Cloud Run): `rtld_setup_main_map: Assertion l_libname failed` (or a plain SIGSEGV for stripped binaries). Running through the interpreter explicitly (`ld-linux-x86-64.so.2 ./app`) works. libsui relocated the program header table into a new PT_LOAD whose file-offset-to-vaddr bias differed from the first PT_LOAD, so a loader that computes `AT_PHDR = load_bias + first_load_bias + e_phoff` (gVisor) landed far off the real table and read garbage program headers. libsui 0.16.3 pins the new segment's vaddr to preserve that bias. The native npm addon in the original report is incidental; a trivial program reproduces it. Verified by reproducing under gVisor (runsc): the compiled repro crashes before the bump and runs after. Fixes denoland#35700
littledivy
force-pushed
the
fix/compile-gvisor-at-phdr
branch
from
July 2, 2026 06:56
9f60a9e to
81ef6f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #35700.
Problem
A
deno compilebinary with a native npm addon crashes at startup on Google Cloud Run (debian:bookworm-slim, run directly as PID 1):(a plain
Uncaught signal: 11for the reduced repro). Invoking through the loader explicitly —CMD ["/lib64/ld-linux-x86-64.so.2", "/app/main"]— works.Root cause
Cloud Run runs under gVisor. libsui's in-place
Elf::appendrelocates the program header table into a newPT_LOADpast EOF, packed just above the highest existing vaddr — giving that segment a different file-offset→vaddr bias than the firstPT_LOAD(~23 MB for the deno base). gVisor computesAT_PHDR = load_bias + (first_load.p_vaddr - first_load.p_offset) + e_phoff, so it lands tens of MB off the real table, reads garbage program headers, and dies beforemain. The Linux kernel recomputesAT_PHDRfrom the segment table, so it only breaks in the sandbox. The native addon is incidental — a trivialconsole.logbinary reproduces it.Fix
libsui 0.16.3 (denoland/sui#78) pins the relocated segment's vaddr to
new_phoff + first_load_bias, preserving the first load's bias so the naiveAT_PHDRcomputation is correct.Verification
Reproduced under gVisor (
runsc) on Linux x86_64:@node-rs/bcryptrepro built with the current libsui crashes with the exact assertion; built with 0.16.3 it runs (gVisor exit=0)..bss, and section-header-stripped inputs, and that it composes with the eu-strip fix (an eu-stripped binary also runs under gVisor).The fix carries an
AT_PHDR-invariant regression test in libsui.