1.1 --- a/src/share/vm/utilities/elfFile.cpp Tue Mar 05 08:50:59 2013 +0100 1.2 +++ b/src/share/vm/utilities/elfFile.cpp Tue Mar 05 13:55:56 2013 -0800 1.3 @@ -197,4 +197,28 @@ 1.4 return NULL; 1.5 } 1.6 1.7 +#ifdef LINUX 1.8 +bool ElfFile::specifies_noexecstack() { 1.9 + Elf_Phdr phdr; 1.10 + if (!m_file) return true; 1.11 + 1.12 + if (!fseek(m_file, m_elfHdr.e_phoff, SEEK_SET)) { 1.13 + for (int index = 0; index < m_elfHdr.e_phnum; index ++) { 1.14 + if (fread((void*)&phdr, sizeof(Elf_Phdr), 1, m_file) != 1) { 1.15 + m_status = NullDecoder::file_invalid; 1.16 + return false; 1.17 + } 1.18 + if (phdr.p_type == PT_GNU_STACK) { 1.19 + if (phdr.p_flags == (PF_R | PF_W)) { 1.20 + return true; 1.21 + } else { 1.22 + return false; 1.23 + } 1.24 + } 1.25 + } 1.26 + } 1.27 + return false; 1.28 +} 1.29 +#endif 1.30 + 1.31 #endif // _WINDOWS