diff --git a/Libraries/LibELF/Validation.cpp b/Libraries/LibELF/Validation.cpp index 8445acf223..8f36eb8394 100644 --- a/Libraries/LibELF/Validation.cpp +++ b/Libraries/LibELF/Validation.cpp @@ -197,6 +197,11 @@ bool validate_program_headers(const Elf32_Ehdr& elf_header, size_t file_size, u8 return false; } break; + case PT_GNU_STACK: + if (program_header.p_flags & PF_X) { + dbgprintf("Possible shenanigans! Validating an ELF with executable stack.\n"); + } + break; default: // Not handling other program header types in other code so... let's not surprise them dbgprintf("Found program header (%zu) of unrecognized type %x!\n", header_index, program_header.p_type); diff --git a/Libraries/LibELF/exec_elf.h b/Libraries/LibELF/exec_elf.h index a091cce13c..ea7be85e40 100644 --- a/Libraries/LibELF/exec_elf.h +++ b/Libraries/LibELF/exec_elf.h @@ -469,6 +469,7 @@ typedef struct { #define PT_GNU_EH_FRAME 0x6474e550 /* Exception handling info */ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ +#define PT_GNU_STACK 0x6474e551 /* Stack permissions info */ #define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* fill with random data */ #define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* program performs W^X violations */