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

overlay_gl: linux: only assume absolute dynamic entries on glibc. #3230

Merged
merged 1 commit into from Nov 26, 2017

Conversation

@mvf
Copy link
Contributor

commented Sep 3, 2017

This fixes a crash in libmumble's library constructor when built against
the musl libc.

The code that locates libc's dlsym(3) relied on addresses in dynamic
entries in the link map returned by dlopen(3) to always be absolute.
This seems to be specific to glibc though, so add a glibc feature test.

overlay_gl: linux: only assume absolute dynamic entries on glibc.
This fixes a crash in libmumble's library constructor when built against
the musl libc.

The code that locates libc's dlsym(3) relied on addresses in dynamic
entries in the link map returned by dlopen(3) to always be absolute.
This seems to be specific to glibc though, so add a glibc feature test.
@mkrautz

This comment has been minimized.

Copy link
Member

commented Sep 3, 2017

At a cursory glance, this seems correct. Seems like it should be this way for glibc, too -- but I can't test at the moment.

@mvf

This comment has been minimized.

Copy link
Contributor Author

commented Sep 5, 2017

Thanks for taking a look. Unfortunately, adding lm->l_addr and dyn->d_un.d_ptr doesn't work on glibc since there the latter is an address instead of an offset. A crude example, with dlsym at 0xdecafbad:

lm->l_addr dyn->d_un.d_ptr
musl, uClibc, BSD, ... 0xdecaf000 0x00000bad
glibc 0xdecaf000 0xdecafbad

I can't think of a way to solve this without an #ifdef. Maybe the issue could be sidestepped by rewriting the code in terms of dl_iterate_phdr(3), but I didn't want to risk breaking a working code path.

@mkrautz

This comment has been minimized.

Copy link
Member

commented Nov 26, 2017

Sorry for letting this sit for so long. Code LGTM.

@mkrautz mkrautz merged commit 24e437c into mumble-voip:master Nov 26, 2017

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@mvf mvf deleted the mvf:overlay_gl-linux branch Mar 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.