-
Notifications
You must be signed in to change notification settings - Fork 469
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
Linker can't find C library, ignores .rpath? #489
Labels
Comments
Bounty |
ekilmer
pushed a commit
that referenced
this issue
May 4, 2022
## newstat - Currently `sys_newstat`'s implementation is based on `sys_stat64` - This is inaccurate because `sys_stat64` is expected to return a `struct stat64` back to userland [ref1](https://elixir.bootlin.com/linux/v5.17.5/source/fs/stat.c#L521) [ref2](https://elixir.bootlin.com/linux/v5.17.5/source/arch/x86/include/uapi/asm/stat.h#L42) - Instead, `sys_newstat` is supposed to return a `struct stat` [ref1](https://elixir.bootlin.com/linux/v5.17.5/source/fs/stat.c#L380) [ref2](https://elixir.bootlin.com/linux/v5.17.5/source/arch/x86/include/uapi/asm/stat.h#L83) - This causes issues because the two structs have different definitions, and in practice causes errors in the loader. For example "LD_LIBRARY_PATH" environment variable does not work. I suspect #489 might be related as well but I have yet to test. - To fix this we can reuse the `sys_newfstat` implementation, which returns the correct `struct stat` structure to userland ## newfstat - Currently `sys_newfstat` returns a structure based on the x86_64 version of `struct stat` [ref1](https://elixir.bootlin.com/linux/v5.17.5/source/arch/x86/include/uapi/asm/stat.h#L83) - This does not account for the different `struct stat` definition on 32-bit x86 [ref1](https://elixir.bootlin.com/linux/v5.17.5/source/arch/x86/include/uapi/asm/stat.h#L10) (Notice the `#ifdef`)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OS / Environment
Docker: Ubuntu 16.04
Installed C libraries:
Manticore version
Version: 0.1.4
Python version
Python 2.7.12
Dependencies
capstone==3.0.5rc2
manticore==0.1.4
ply==3.10
pyelftools==0.24
unicorn==1.0.1
Summary of the problem
Running natively with
LD_DEBUG=libs
results in:Running with
manticore --env LD_DEBUG=all
results in:test_00000000.stdout:
As you can see, it ignores all but the first path in .rpath and doesn't find the right C library.
Readelf sections:
Strace shows that it loads the right interpreter (ld-linux.so.2 links to ld-2.25.so):
The text was updated successfully, but these errors were encountered: