Bundle libfakemallinfo.so to work around mallinfo() SIGILL on >2 GiB heaps - COR-1118#82
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
@claude review once |
9466ab2 to
e103a8c
Compare
There was a problem hiding this comment.
Pull request overview
This pull request bundles a small LD_PRELOAD shared library (libfakemallinfo.so) into the published Ubuntu 22.04-based GStreamer images to work around crashes in third-party callers still using glibc’s deprecated mallinfo() once heaps exceed ~2 GiB.
Changes:
- Add a new C source file implementing a
mallinfo()shim returning a zeroedstruct mallinfo. - Build
libfakemallinfo.soduring the existing/compilestep and copy it into/compiled-binariesso it propagates to all image variants via existingCOPY --from=0behavior. - Ensure the build stage has access to the shim source by copying it into the
dev-downloadedstage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Dockerfile-dev-downloaded.in | Copies fake_mallinfo.c into the build stage so /compile can build the shim. |
| docker/build-gstreamer/fake_mallinfo.c | Introduces the mallinfo() interposer implementation. |
| docker/build-gstreamer/compile | Builds and installs libfakemallinfo.so into both the live filesystem and /compiled-binaries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…heaps CEF/Chromium's MemoryInfra calls glibc's deprecated mallinfo(), whose return struct uses `int` fields. Once heap addresses exceed 2 GiB the arithmetic inside glibc overflows and triggers a SIGILL, crashing the process at random. See chromiumembedded/cef#3963 ("linux: Random crash due to MemoryInfra"): chromiumembedded/cef#3963 Build a tiny LD_PRELOAD shim that overrides mallinfo() to return a zeroed struct, and stage it into /compiled-binaries/usr/lib so the existing `COPY --from=0 /compiled-binaries /` steps propagate it into all four published image variants. Consumers opt in by setting LD_PRELOAD=/usr/lib/libfakemallinfo.so for processes that load CEF.
e103a8c to
ba7b3c2
Compare
6cc6736 to
de812cc
Compare
de812cc to
57db7ed
Compare
|
Added some additional docs. good to go |
Bundle libfakemallinfo.so LD_PRELOAD shim in published images
glibc's deprecated mallinfo() returns int fields that overflow once heap addresses exceed 2 GiB, causing SIGILL in callers that still use it. Ship a tiny shared library that returns a zeroed struct mallinfo, ready to be loaded via LD_PRELOAD=libfakemallinfo.so.
Build it from docker/build-gstreamer/fake_mallinfo.c at the top of the existing /compile script and install to both /usr/lib/ (live) and /compiled-binaries/usr/lib/. Routing through /compiled-binaries piggybacks on the existing COPY --from=0 steps, so the .so lands in all four published variants (latest-dev-with-source, latest-dev, latest-prod, latest-prod-dbg) with no changes to dev-dependencies or prod-base.