Java Signal Chaining
    • PDF

    Java Signal Chaining

    • PDF

    Article summary

    Signal Chaining when using Java

    The Glasswall library uses signal handling in order to prevent crashes from occurring, but this can interfere with the JVM when Glasswall is run from Java. For this to work correctly signal chaining will need to be set up in order to prevent errors in Glasswall from propagating into the JVM. During set up you will need the location of the libjsig.so library. Examples of where this can commonly be found:

    • /usr/lib/jvm/jre/lib/libjsig.so
    • /usr/lib/jvm/jre/lib/amd64/libjsig.so
    • /usr/lib/jvm/java/lib/libjsig.so

    but this depends on your system and where Java is installed. In our examples we use /usr/lib/jvm/java/lib/libjsig.so as the location.

    ##### Signal Chaining without set up
    Due to certain environmental factors, the Glasswall library may work without issues when the libjsig library is not set up. This is not guaranteed, and we highly recommend that the set up is carried out.

    ##### Release 16.3 and earlier

    For releases 16.3 and earlier you would need to set up the LD_PRELOAD environment variable to point to the location of your libjsig.so library. More information can be found at Signal Chaining.

    An example of the LD_PRELOAD might look something like this export LD_PRELOAD=/usr/lib/jvm/java/lib/libjsig.so or ENV LD_PRELOAD=/usr/lib/jvm/java/lib/libjsig.so in your Docker file. This will depend on the actual path to the libjsig.so library.

    ##### Release 16.4 and later

    For releases 16.4 and later the Java wrapper for the Editor library has a direct dependency on the libjsig library. This requires a little bit of set up to ensure that the linker can find the library and resolve the dependency. The paths will change depending on the location of the library. A few example of set up are documented below:

    ###### Example 1 - Symbolic link to libjsig library

    A symbolic link can be created either in /usr/lib or /usr/lib64 depending on your system to point to the libjsig library.

    For example, running the following commands in a terminal with admin access:

    ln -s -T /usr/lib/jvm/java/lib/libjsig.so /usr/lib64/libjsig.so
    ldconfig
    

    ln will create the symbolic link and ldconfig will update the library cache so that the dependency can be resolved.

    ###### Example 2 - Using LD_LIBRARY_PATH environment variable

    The LD_LIBRARY_PATH environment variable can be set up to point to the directory containing the libjsig library.

    For example, the set up might look something like this export LD_LIBRARY_PATH=/usr/lib/jvm/java/lib or ENV LD_LIBRARY_PATH=/usr/lib/jvm/java/lib in your Docker file.

    All the libraries within the directory will then be available to the linker.

    ###### Example 3 - New configuration in /etc/ld.so.conf.d/

    A new configuration can be created in /etc/ld.so.conf.d that would contain the directory of the libjsig library.

    For example, running the following commands in a terminal with admin access:

    echo "/usr/lib/jvm/java/lib/" | tee -a /etc/ld.so.conf.d/jvm.conf
    ldconfig
    

    The first command creates the configuration file with the content /usr/lib/jvm/java/lib/. When the ldconfig command is called, the library cache will be updated to include all the libraries in the directory specified in the config file.


    Was this article helpful?