< prev index next >

src/share/vm/prims/whitebox.cpp

Print this page
rev 13541 : 8187045: [linux] Not all libraries in the VM are linked with -z,noexecstack.

*** 71,80 **** --- 71,84 ---- #include "services/mallocSiteTable.hpp" #include "services/memTracker.hpp" #include "utilities/nativeCallStack.hpp" #endif // INCLUDE_NMT + #ifdef LINUX + #include "utilities/elfFile.hpp" + #endif + #define SIZE_T_MAX_VALUE ((size_t) -1) bool WhiteBox::_used = false; volatile bool WhiteBox::compilation_locked = false;
*** 1821,1830 **** --- 1825,1848 ---- WB_ENTRY(void, WB_RemoveCompilerDirective(JNIEnv* env, jobject o, jint count)) DirectivesStack::pop(count); WB_END + // Checks that the library libfile has the noexecstack bit set. + WB_ENTRY(jboolean, WB_CheckLibSpecifiesNoexecstack(JNIEnv* env, jobject o, jstring libfile)) + jboolean ret = false; + #ifdef LINUX + // Can't be in VM when we call JNI. + ThreadToNativeFromVM ttnfv(thread); + const char* lf = env->GetStringUTFChars(libfile, NULL); + CHECK_JNI_EXCEPTION_(env, 0); + ret = (jboolean) ElfFile::specifies_noexecstack(lf); + env->ReleaseStringUTFChars(libfile, lf); + #endif + return ret; + WB_END + #define CC (char*) static JNINativeMethod methods[] = { {CC"getObjectAddress0", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress }, {CC"getObjectSize0", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize },
*** 2025,2034 **** --- 2043,2054 ---- {CC"supportsConcurrentGCPhaseControl", CC"()Z", (void*)&WB_SupportsConcurrentGCPhaseControl}, {CC"getConcurrentGCPhases", CC"()[Ljava/lang/String;", (void*)&WB_GetConcurrentGCPhases}, {CC"requestConcurrentGCPhase0", CC"(Ljava/lang/String;)Z", (void*)&WB_RequestConcurrentGCPhase}, + {CC"checkLibSpecifiesNoexecstack", CC"(Ljava/lang/String;)Z", + (void*)&WB_CheckLibSpecifiesNoexecstack}, }; #undef CC JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
< prev index next >