src/os/linux/vm/os_linux.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File hotspot Sdiff src/os/linux/vm

src/os/linux/vm/os_linux.cpp

Print this page




1621   VM_LinuxDllLoad(const char *fn, char *ebuf, int ebuflen) :
1622     _filename(fn), _ebuf(ebuf), _ebuflen(ebuflen), _lib(NULL) {}
1623   VMOp_Type type() const { return VMOp_LinuxDllLoad; }
1624   void doit() {
1625     _lib = os::Linux::dll_load_in_vmthread(_filename, _ebuf, _ebuflen);
1626     os::Linux::_stack_is_executable = true;
1627   }
1628   void* loaded_library() { return _lib; }
1629 };
1630 
1631 void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
1632   void * result = NULL;
1633   bool load_attempted = false;
1634 
1635   // Check whether the library to load might change execution rights
1636   // of the stack. If they are changed, the protection of the stack
1637   // guard pages will be lost. We need a safepoint to fix this.
1638   //
1639   // See Linux man page execstack(8) for more info.
1640   if (os::uses_stack_guard_pages() && !os::Linux::_stack_is_executable) {
1641     ElfFile ef(filename);
1642     if (!ef.specifies_noexecstack()) {
1643       if (!is_init_completed()) {
1644         os::Linux::_stack_is_executable = true;
1645         // This is OK - No Java threads have been created yet, and hence no
1646         // stack guard pages to fix.
1647         //
1648         // This should happen only when you are building JDK7 using a very
1649         // old version of JDK6 (e.g., with JPRT) and running test_gamma.
1650         //
1651         // Dynamic loader will make all stacks executable after
1652         // this function returns, and will not do that again.
1653         assert(Threads::first() == NULL, "no Java threads should exist yet.");
1654       } else {
1655         warning("You have loaded library %s which might have disabled stack guard. "
1656                 "The VM will try to fix the stack guard now.\n"
1657                 "It's highly recommended that you fix the library with "
1658                 "'execstack -c <libfile>', or link it with '-z noexecstack'.",
1659                 filename);
1660 
1661         assert(Thread::current()->is_Java_thread(), "must be Java thread");




1621   VM_LinuxDllLoad(const char *fn, char *ebuf, int ebuflen) :
1622     _filename(fn), _ebuf(ebuf), _ebuflen(ebuflen), _lib(NULL) {}
1623   VMOp_Type type() const { return VMOp_LinuxDllLoad; }
1624   void doit() {
1625     _lib = os::Linux::dll_load_in_vmthread(_filename, _ebuf, _ebuflen);
1626     os::Linux::_stack_is_executable = true;
1627   }
1628   void* loaded_library() { return _lib; }
1629 };
1630 
1631 void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
1632   void * result = NULL;
1633   bool load_attempted = false;
1634 
1635   // Check whether the library to load might change execution rights
1636   // of the stack. If they are changed, the protection of the stack
1637   // guard pages will be lost. We need a safepoint to fix this.
1638   //
1639   // See Linux man page execstack(8) for more info.
1640   if (os::uses_stack_guard_pages() && !os::Linux::_stack_is_executable) {
1641     ElfFile ef(filename, false /* load_tables */);
1642     if (!ef.specifies_noexecstack()) {
1643       if (!is_init_completed()) {
1644         os::Linux::_stack_is_executable = true;
1645         // This is OK - No Java threads have been created yet, and hence no
1646         // stack guard pages to fix.
1647         //
1648         // This should happen only when you are building JDK7 using a very
1649         // old version of JDK6 (e.g., with JPRT) and running test_gamma.
1650         //
1651         // Dynamic loader will make all stacks executable after
1652         // this function returns, and will not do that again.
1653         assert(Threads::first() == NULL, "no Java threads should exist yet.");
1654       } else {
1655         warning("You have loaded library %s which might have disabled stack guard. "
1656                 "The VM will try to fix the stack guard now.\n"
1657                 "It's highly recommended that you fix the library with "
1658                 "'execstack -c <libfile>', or link it with '-z noexecstack'.",
1659                 filename);
1660 
1661         assert(Thread::current()->is_Java_thread(), "must be Java thread");


src/os/linux/vm/os_linux.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File