Avoid NULL pointer deref when libsandbox is in LD_PRELOAD#800
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #800 +/- ##
==========================================
+ Coverage 66.11% 66.22% +0.11%
==========================================
Files 94 94
Lines 14494 14494
Branches 2534 2534
==========================================
+ Hits 9582 9598 +16
+ Misses 4912 4896 -16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
I'm kind of baffled by the test failures; I cannot reproduce them. I pushed a revert to see if this is some issue with the Github CI environment, but if you have a better idea of what is wrong please let me know. |
Owner
|
The failure might be just flakiness. I've re run failed tests. I had no time to check that earlier. Change looks OK, so I do not expect any issues with that PR. |
9c19cc4 to
6133185
Compare
If libsandbox[1] is in the LD_PRELOAD, it calls dlopen() inside a constructor function. If this constructor happens to run before the init() function in libaloader.c, dlopen_orig will still be NULL and the program will crash with a segfault. Avoid this by calling dlsym() inside the dlopen() wrapper itself when necessary. [1] https://github.com/gentoo/sandbox Bug: https://bugs.gentoo.org/973030
6133185 to
9f3e53d
Compare
arkq
approved these changes
May 12, 2026
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.
libsandbox[1] calls dlopen() inside a constructor function. If this constructor happens to run before the init() function in libaloader.c, dlopen_orig will still be NULL and the program will crash with a segfault.
Avoid this by calling dlsym() inside the dlopen() wrapper itself when necessary.
[1] https://github.com/gentoo/sandbox
Bug: https://bugs.gentoo.org/973030