Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proc: fix dynamic library loading with musl loader #3621

Merged
merged 1 commit into from Jan 10, 2024

Conversation

aarzilli
Copy link
Member

@aarzilli aarzilli commented Jan 2, 2024

With the glibc loader the link map entry for the static executable has
an empty name field and address equal to 0x0. This case was already
handled by the check in bininfo.go AddImage for names to be valid
paths.

With the musl loader however the first entry, corresponding to the
static executable, has a valid path with address equal to 0x0, since we
record a real address for the image corresponding to the static
executable this results in having two entries for the executable when
musl is used to link go programs.

Change the code scanning the debug link map so that the first entry is
skipped if it has address equal to zero.

Fixes #3617

With the glibc loader the link map entry for the static executable has
an empty name field and address equal to 0x0. This case was already
handled by the check in bininfo.go AddImage for names to be valid
paths.
With the musl loader however the first entry, corresponding to the
static executable, has a valid path with address equal to 0x0, since we
record a real address for the image corresponding to the static
executable this results in having two entries for the executable when
musl is used to link go programs.

Change the code scanning the debug link map so that the first entry is
skipped if it has address equal to zero.

Fixes go-delve#3617
Copy link
Member

@derekparker derekparker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@derekparker derekparker merged commit 8838065 into go-delve:master Jan 10, 2024
1 of 2 checks passed
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.

Delve is incompatible with musl system loader
2 participants