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

error while loading shared libraries: dlopen: invalid caller #5

Open
pdoge opened this issue Sep 4, 2020 · 6 comments
Open

error while loading shared libraries: dlopen: invalid caller #5

pdoge opened this issue Sep 4, 2020 · 6 comments

Comments

@pdoge
Copy link

pdoge commented Sep 4, 2020

hey
I tested this code and got this error.

error while loading shared libraries: dlopen: invalid caller

My environment:
centos7 64bit + ld-2.17.so + glibc-2.17-260.el7_6.6.x86_64 + kernel 3.10.0-957.27.2.el7.x86_64
image

image

I think this error comes from __check_caller in glibc

What should I do so that I can successfully test, or the experimental environment of the person who successfully tested. thinks

@DavidBuchanan314
Copy link
Owner

DavidBuchanan314 commented Sep 4, 2020

Until now, I've been leaving the caller_dlopen argument undefined. On newer libcs (since this patch: https://patchwork.ozlabs.org/project/glibc/patch/[email protected]/ ) , this doesn't matter. But yours apparently still has the check.

To work around this, we need to set caller_dlopen to a "correct" value. In this case, I think we can just use the address of the _dl_open function itself.

@DavidBuchanan314
Copy link
Owner

@pdoge I think I've fixed this in the latest commit, can you please re-test?

@pdoge
Copy link
Author

pdoge commented Sep 5, 2020

@DavidBuchanan314 I just used your latest inject code for testing and the same error occurred

image
image

@pdoge
Copy link
Author

pdoge commented Sep 6, 2020

I overwrite the _dl_check_caller function in ld-2.17.so by memory injection, so that dlopen: invalid caller no longer appears. Thank you for sharing the process memory injection ideas. I learned a lot

@pdoge pdoge closed this as completed Sep 6, 2020
@DavidBuchanan314
Copy link
Owner

I am reopening this issue because at some point, I would like to create a workaround in the tool itself, that doesn't require patching libc etc.

@wxingda
Copy link

wxingda commented Mar 22, 2021

I got the same problem

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

3 participants