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

Provide a way to opt into searching the default image for symbols #147

Open
headius opened this issue May 8, 2020 · 1 comment
Open

Comments

@headius
Copy link
Member

headius commented May 8, 2020

In jruby/jruby#6202 we learned that the jnr-posix bootstrapping does not honor preloaded libraries as from LD_PRELOAD on Linux and DYLD_INSERT_LIBRARIES on MacOS. This prevents patch libraries like libfaketime, which hooks the standard POSIX time functions to alter their output.

A discussion of the issue is provided in wolfcw/libfaketime#255. There is no bug in libfaketime, and the current functionality of jnr-posix is not really incorrect, but it provides no way to "soften" the symbol search to try simply loading the symbol from the current process as if using RTLD_DEFAULT.

The functionality to search the default image will be provided when fixing jnr/jnr-ffi#203.

The additional work required here is to add a way to acquire a native POSIX with or without the default image being included in the symbol search.

@headius headius added this to the 3.0.56 milestone May 8, 2020
headius added a commit to headius/jnr-posix that referenced this issue May 8, 2020
This addresses the issue in jruby/jruby#6202 where patch libraries
loaded via LD_PRELOAD on Linux or DYLD_INSERT_LIBRARIES on MacOS
would not be seen, since we go directly to the system libc and
acquire all symbols from there. The patch utilizes the work in
jnr/jnr-ffi#204 to unconditionally add a default search to the
library bootstrapping.

This is part of work to implement jnr#147.

Note that this does not provide a way to opt-out of searching the
default image due to the static native of how the POSIX LibC
library wrapper gets set up. A larger change will be needed to
allow configuring this behavior.
@headius headius modified the milestones: 3.0.56, 3.0.57 May 11, 2020
@headius
Copy link
Member Author

headius commented May 11, 2020

Moved to 3.0.57 because there's currently no way to configure the POSIX you get, other than asking for native vs non-native.

The root issue in jruby/jruby#6202 will be fixed by modifying jnr-posix to always search the default image, which is a behavior change but more in line with how C programs would work in the absence of dlopen/dlsym reflection.

We'll need more work here to make this an optional behavior of jnr-posix.

We may also want to examine the other jnr libraries and see if they should likewise opt into the default image search.

@headius headius removed this from the 3.0.57 milestone May 27, 2020
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

1 participant