snappy-java
snappy-java copied to clipboard
failed to map segment from shared object when /tmp is mounted with noexec
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
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