Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running java 5/6 with JNI on java 7 gives stack guard warning

A java program built with 1.5 (or 1.6 with 1.5 comparability mode on) gives this warning:

Java HotSpot(TM) Server VM warning: You have loaded library mynativelib.so which might have disabled stack guard.
The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'.

It doesn't seem to cause a problem but obviously would look a bit scary to our customers. I don't think building the java bits in 7 would fix this issue but I'm struggling to see where the docs say how to build JNI libs for Java 7, which is what the warning implies I should be doing differently.

So where should I be looking?

like image 426
Simon Heffer Avatar asked Sep 19 '13 07:09

Simon Heffer


2 Answers

Found the answer here disabled stack guard warning (ACF9, JVM 1.7, Linux)

He said

This is a feature in Java 7’s HotSpot compiler on Linux which tries to stop code written in C and linked into Java (the so-called Java Native Interface - JNI) from halting the whole VM if it’s written badly or maliciously.

like image 71
Data Avatar answered Sep 21 '22 17:09

Data


Another possibility is that the Java+JNI application that you are trying to run was compiled for Linux 32bit.

In such a case, two solutions:

  • If you have the source code of the application, port it to Linux 64bit
  • If not, download the Linux 64bit version of the application.
like image 31
Nicolas Raoul Avatar answered Sep 20 '22 17:09

Nicolas Raoul