Skip to content

Prevent segfault when dladdr return values are NULL#324

Open
dinodeep wants to merge 5 commits intoStanfordLegion:mainfrom
dinodeep:dinodeep/dladdr-segfault-bug
Open

Prevent segfault when dladdr return values are NULL#324
dinodeep wants to merge 5 commits intoStanfordLegion:mainfrom
dinodeep:dinodeep/dladdr-segfault-bug

Conversation

@dinodeep
Copy link
Copy Markdown

@dinodeep dinodeep commented Oct 1, 2025

When dladdr(ptr, &inf) returns, it's possible that it will return a non-zero return value (indicating success) when it finds a shared object containing ptr. However, if there isn't a symbol associated with the ptr from the shared object, then dladdr will set dli_sname and dli_saddr fields to null which Realm currently reads from without checking for NULL.

This PR ensures that NULL is checked for and provides an appropriate error message if that is the case.

Quote from dladdr linux man page

On success, these functions return a nonzero value. If the address specified in addr could be matched to a shared object, but not to a symbol in the shared object, then the info->dli_sname and info->dli_saddr fields are set to NULL.

@muraj muraj added the bug Something isn't working label Oct 1, 2025
@dinodeep dinodeep requested a review from muraj October 1, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants