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

Figure out how to handle dlsym with RTLD_NEXT #36

Open
mplegendre opened this issue Jun 15, 2017 · 1 comment
Open

Figure out how to handle dlsym with RTLD_NEXT #36

mplegendre opened this issue Jun 15, 2017 · 1 comment

Comments

@mplegendre
Copy link
Member

The RTLD_NEXT parameter to dlsym has at least two issues with gotcha:

  • When the symbol being passed to dlsym isn't wrapped: the behavior of dlsym with RTLD_NEXT changes based on the caller library. Wrapping dlsym will break this. We need to simulate the bottom level call as if coming from the top level caller.

  • Calling dlsym with RTLD_NEXT can return a different "bottom-level symbol" than without. If the symbol is wrapped, should we return the same wrapper function with and without RTLD_NEXT? Should we support different stacks of wrappers?

@DavidPoliakoff
Copy link
Contributor

This comment is to expand on the problem, for my own notes, as this issue is really thorny

An example of this problem is that somebody calls dlsym(RTLD_NEXT, "foo"), where "foo" has been wrapped by Gotcha. Gotcha can rather easily faithfully simulate RTLD_NEXT using the builtin_return_address call we make here. However, it doesn't yet return a wrapped version of that call.

Correct behavior should be returning a function stack with correct wrappers, whose bottom-most ("real") function is the correct RTLD_NEXT-function

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

No branches or pull requests

2 participants