在 java 7 上使用 JNI 运行 java 5/6 会给出堆栈保护警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18889113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 11:56:53  来源:igfitidea点击:

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

javajava-native-interfaceguard

提问by Simon Heffer

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

使用 1.5(或 1.6 与 1.5 可比性模式打开)构建的 java 程序给出以下警告:

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'.

Java HotSpot(TM) 服务器 VM 警告:您已加载库 mynativelib.so,该库可能已禁用堆栈保护。
VM 现在将尝试修复堆栈保护。强烈建议您使用“execstack -c”修复库,或使用“-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.

它似乎不会引起问题,但显然对我们的客户来说看起来有点吓人。我不认为在 7 中构建 java 位会解决这个问题,但我很难看到文档在哪里说如何为 Java 7 构建 JNI 库,这就是警告暗示我应该做不同的事情。

So where should I be looking?

那我应该去哪里找呢?

回答by Data

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

在这里找到答案 禁用堆栈保护警告(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.

这是 Linux 上 Java 7 的 HotSpot 编译器的一个特性,它试图阻止用 C 编写并链接到 Java(所谓的 Java 本地接口 - JNI)的代码,如果它写得不好或恶意的话,就停止整个 VM。

回答by Nicolas Raoul

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

另一种可能性是您尝试运行的 Java+JNI 应用程序是为 Linux 32 位编译的。

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.
  • 如果您有应用程序的源代码,请将其移植到 Linux 64 位
  • 如果没有,请下载该应用程序的 Linux 64 位版本。