jnr / jnr-posix

Java Posix layer
Other
241 stars 91 forks source link

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

Open headius opened 4 years ago

headius commented 4 years ago

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 https://github.com/wolfcw/libfaketime/issues/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 commented 4 years ago

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.