snappy-java icon indicating copy to clipboard operation
snappy-java copied to clipboard

failed to map segment from shared object when /tmp is mounted with noexec

Open gssbzn opened this issue 5 years ago • 2 comments
trafficstars

Currently if you mount the /tmp folder with the noexec option you get

/tmp/snappy-1.1.4-6321baa3-1a72-41b6-bbbc-2b1a642bc8c8-libsnappyjava.so: /tmp/snappy-1.1.4-6321baa3-1a72-41b6-bbbc-2b1a642bc8c8-libsnappyjava.so: failed to map segment from shared object: Operation not permitted
--
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)

This is true even with the sample code from the README

package test;

import java.io.IOException;
import org.xerial.snappy.Snappy;

/**
 * Snappy example
 *
 */
public class App
{
    public static void main( String[] args ) throws IOException {
        String input = "Hello snappy-java! Snappy-java is a JNI-based wrapper of "
                + "Snappy, a fast compresser/decompresser.";
        byte[] compressed = Snappy.compress(input.getBytes("UTF-8"));
        byte[] uncompressed = Snappy.uncompress(compressed);

        String result = new String(uncompressed, "UTF-8");
        System.out.println(result);
    }
}

Is this expected and should be documented? Or is there something that can be done to prevent requiring the exec option for tmp

gssbzn avatar Jan 31 '20 10:01 gssbzn

You can use org.xerial.snappy.tempdir option to define another temp folder. Link

@aleksei-iliushchenko-zocdoc yes, that's what we did at the end just wanted to confirm that in fact this is expected and that if you want to use noexec in the default falder then you should use your own tmp dir with exec permissions

gssbzn avatar Mar 16 '20 20:03 gssbzn