summaryrefslogtreecommitdiff
path: root/include/mach
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2024-03-28 09:40:50 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-03-29 00:32:46 +0100
commitdf19628b2b6665468e698e290dfd1568720ba042 (patch)
treef021003706eb8cd45f95e7be96953a230e246334 /include/mach
parentced537ad297754e08b19536102712c692c949f44 (diff)
elf-load: Respect PT_GNU_STACK
If a bootstrap ELF contains a PT_GNU_STACK phdr, take stack protection from there. Otherwise, default to VM_PROT_ALL.
Diffstat (limited to 'include/mach')
-rw-r--r--include/mach/exec/elf.h1
-rw-r--r--include/mach/exec/exec.h2
2 files changed, 3 insertions, 0 deletions
diff --git a/include/mach/exec/elf.h b/include/mach/exec/elf.h
index 9e4f8f7e..55304496 100644
--- a/include/mach/exec/elf.h
+++ b/include/mach/exec/elf.h
@@ -300,6 +300,7 @@ typedef struct {
#define PT_NOTE 4
#define PT_SHLIB 5
#define PT_PHDR 6
+#define PT_GNU_STACK 0x6474e551
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
diff --git a/include/mach/exec/exec.h b/include/mach/exec/exec.h
index 94b234b0..29fa897d 100644
--- a/include/mach/exec/exec.h
+++ b/include/mach/exec/exec.h
@@ -51,6 +51,8 @@ typedef struct exec_info
/* (ELF) Address of interpreter string for loading shared libraries, null if none. */
vm_offset_t interp;
+ /* Required stack protection. */
+ vm_prot_t stack_prot;
} exec_info_t;
typedef int exec_sectype_t;