feat(cef): LD_PRELOAD mallinfo shim to fix MemoryInfra SIGILL#508
Merged
feat(cef): LD_PRELOAD mallinfo shim to fix MemoryInfra SIGILL#508
Conversation
…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>
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.
Summary
mallinfo(); when the CEF arena exceeds 2 GiB the int fields overflow, Chromiumchecked_cast<size_t>fails, and Chromium CHECKs → SIGILL.mallinfo()with a zero-filled struct. No overflow, no crash, and zero impact on GStreamer/GLib/Rust (nothing in our stack callsmallinfo).Test plan
build-gstcefsrc.ymlsucceeds for both linux-amd64 and linux-arm64gstcefsrc-144.0.11-linux-*.tar.gzcontainslib/cef/libmallinfo_shim.sostrom-fullruns withLD_PRELOADset; cefsrc flows run without SIGILL beyond 2 GiB arena usage