Skip to content

feat(cef): LD_PRELOAD mallinfo shim to fix MemoryInfra SIGILL#508

Merged
srperens merged 1 commit intomainfrom
feat/mallinfo-shim
Apr 17, 2026
Merged

feat(cef): LD_PRELOAD mallinfo shim to fix MemoryInfra SIGILL#508
srperens merged 1 commit intomainfrom
feat/mallinfo-shim

Conversation

@srperens
Copy link
Copy Markdown
Collaborator

Summary

  • Root cause identified via CEF issue #3963: libcef.so calls glibc's legacy int-based mallinfo(); when the CEF arena exceeds 2 GiB the int fields overflow, Chromium checked_cast<size_t> fails, and Chromium CHECKs → SIGILL.
  • Fix: LD_PRELOAD a ~30-line shim that replaces mallinfo() with a zero-filled struct. No overflow, no crash, and zero impact on GStreamer/GLib/Rust (nothing in our stack calls mallinfo).
  • Restores CEF to 144.0.11 (latest) and gstcefsrc to current master — the earlier downgrade to CEF 122 is no longer needed.

Test plan

  • build-gstcefsrc.yml succeeds for both linux-amd64 and linux-arm64
  • Release artifact gstcefsrc-144.0.11-linux-*.tar.gz contains lib/cef/libmallinfo_shim.so
  • strom-full runs with LD_PRELOAD set; cefsrc flows run without SIGILL beyond 2 GiB arena usage

…e CEF 144

The MemoryInfra SIGILL is an int overflow in libcef.so's call to glibc's
legacy int-based mallinfo(). Spotify's official CEF builds compile against
a Debian bullseye sysroot (glibc 2.31) which lacks mallinfo2, so the int
API is baked in. When the CEF process arena exceeds 2 GiB, the int fields
overflow to negative, Chromium checked_cast<size_t> them, the narrowing
check fails, and Chromium CHECKs -> SIGILL.

This is the real root cause, identified in CEF issue #3963 and upstream
Chromium bug 401168177. It is not a Chrome-runtime regression — Chrome
runtime just makes it more visible through more long-lived allocations.

Fix: LD_PRELOAD a small shim that interposes mallinfo() and returns zeros.
Chromium narrows 0 to size_t without overflow; the memory dump records
zero bytes for the CEF process (we don't use MemoryInfra in production).
Workaround confirmed by another user on #3963.

- docker/gstcefsrc/mallinfo_shim.c: new shim source (~30 lines of C).
- docker/gstcefsrc/Dockerfile: compile shim to libmallinfo_shim.so during
  build, ship in output tarball. Restore CEF 144.0.11 and pin gstcefsrc
  master HEAD (b63340852f) — the shim removes the reason to downgrade.
- .github/workflows/build-gstcefsrc.yml: update defaults to CEF 144 and
  current gstcefsrc master.
- docker/strom-full/entrypoint.sh: LD_PRELOAD the shim before exec.
- docs/CEF_SIGILL_CRASH.md: document the real bug and the shim-based fix;
  explain why downgrading is no longer needed.

Safety: the shim only replaces the mallinfo() symbol; all allocator
entry points (malloc/free/calloc/realloc) are untouched. GStreamer,
GLib, Rust's allocator, and our own code do not call mallinfo(). The
only consumer in our process tree is Chromium's MemoryInfra thread —
which is exactly what we want to silence.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@srperens srperens merged commit 807181f into main Apr 17, 2026
@srperens srperens deleted the feat/mallinfo-shim branch April 17, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant