8183262: noexecstack check in os::dll_load on Linux is too expensive

Convert ElfFile::specifies_noexecstack() to static method which read file header and check executable stack flag.

Reviewed-by: iklam, stuefe
This commit is contained in:
Vladimir Kozlov 2017-07-05 11:03:19 -07:00
parent 907093af23
commit eb20e62194
4 changed files with 39 additions and 24 deletions

View file

@ -1639,8 +1639,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
//
// See Linux man page execstack(8) for more info.
if (os::uses_stack_guard_pages() && !os::Linux::_stack_is_executable) {
ElfFile ef(filename);
if (!ef.specifies_noexecstack()) {
if (!ElfFile::specifies_noexecstack(filename)) {
if (!is_init_completed()) {
os::Linux::_stack_is_executable = true;
// This is OK - No Java threads have been created yet, and hence no