< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page
rev 51977 : [mq]: 8211350-no-jprt


1605   }
1606   void* loaded_library() { return _lib; }
1607 };
1608 
1609 void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
1610   void * result = NULL;
1611   bool load_attempted = false;
1612 
1613   // Check whether the library to load might change execution rights
1614   // of the stack. If they are changed, the protection of the stack
1615   // guard pages will be lost. We need a safepoint to fix this.
1616   //
1617   // See Linux man page execstack(8) for more info.
1618   if (os::uses_stack_guard_pages() && !os::Linux::_stack_is_executable) {
1619     if (!ElfFile::specifies_noexecstack(filename)) {
1620       if (!is_init_completed()) {
1621         os::Linux::_stack_is_executable = true;
1622         // This is OK - No Java threads have been created yet, and hence no
1623         // stack guard pages to fix.
1624         //
1625         // This should happen only when you are building JDK7 using a very
1626         // old version of JDK6 (e.g., with JPRT) and running test_gamma.
1627         //
1628         // Dynamic loader will make all stacks executable after
1629         // this function returns, and will not do that again.
1630         assert(Threads::number_of_threads() == 0, "no Java threads should exist yet.");
1631       } else {
1632         warning("You have loaded library %s which might have disabled stack guard. "
1633                 "The VM will try to fix the stack guard now.\n"
1634                 "It's highly recommended that you fix the library with "
1635                 "'execstack -c <libfile>', or link it with '-z noexecstack'.",
1636                 filename);
1637 
1638         assert(Thread::current()->is_Java_thread(), "must be Java thread");
1639         JavaThread *jt = JavaThread::current();
1640         if (jt->thread_state() != _thread_in_native) {
1641           // This happens when a compiler thread tries to load a hsdis-<arch>.so file
1642           // that requires ExecStack. Cannot enter safe point. Let's give up.
1643           warning("Unable to fix stack guard. Giving up.");
1644         } else {
1645           if (!LoadExecStackDllInVMThread) {
1646             // This is for the case where the DLL has an static
1647             // constructor function that executes JNI code. We cannot




1605   }
1606   void* loaded_library() { return _lib; }
1607 };
1608 
1609 void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
1610   void * result = NULL;
1611   bool load_attempted = false;
1612 
1613   // Check whether the library to load might change execution rights
1614   // of the stack. If they are changed, the protection of the stack
1615   // guard pages will be lost. We need a safepoint to fix this.
1616   //
1617   // See Linux man page execstack(8) for more info.
1618   if (os::uses_stack_guard_pages() && !os::Linux::_stack_is_executable) {
1619     if (!ElfFile::specifies_noexecstack(filename)) {
1620       if (!is_init_completed()) {
1621         os::Linux::_stack_is_executable = true;
1622         // This is OK - No Java threads have been created yet, and hence no
1623         // stack guard pages to fix.
1624         //



1625         // Dynamic loader will make all stacks executable after
1626         // this function returns, and will not do that again.
1627         assert(Threads::number_of_threads() == 0, "no Java threads should exist yet.");
1628       } else {
1629         warning("You have loaded library %s which might have disabled stack guard. "
1630                 "The VM will try to fix the stack guard now.\n"
1631                 "It's highly recommended that you fix the library with "
1632                 "'execstack -c <libfile>', or link it with '-z noexecstack'.",
1633                 filename);
1634 
1635         assert(Thread::current()->is_Java_thread(), "must be Java thread");
1636         JavaThread *jt = JavaThread::current();
1637         if (jt->thread_state() != _thread_in_native) {
1638           // This happens when a compiler thread tries to load a hsdis-<arch>.so file
1639           // that requires ExecStack. Cannot enter safe point. Let's give up.
1640           warning("Unable to fix stack guard. Giving up.");
1641         } else {
1642           if (!LoadExecStackDllInVMThread) {
1643             // This is for the case where the DLL has an static
1644             // constructor function that executes JNI code. We cannot


< prev index next >