| 1 |
williamh |
1.1 |
Index: src/cmd/6l/asm.c
|
| 2 |
|
|
===================================================================
|
| 3 |
|
|
--- a/src/cmd/6l/asm.c
|
| 4 |
|
|
+++ b/src/cmd/6l/asm.c
|
| 5 |
|
|
@@ -1082,6 +1082,11 @@
|
| 6 |
|
|
ph->type = PT_GNU_STACK;
|
| 7 |
|
|
ph->flags = PF_W+PF_R;
|
| 8 |
|
|
ph->align = 8;
|
| 9 |
|
|
+
|
| 10 |
|
|
+ ph = newElfPhdr();
|
| 11 |
|
|
+ ph->type = PT_PAX_FLAGS;
|
| 12 |
|
|
+ ph->flags = 0x2a00; // mprotect, randexec, emutramp disabled
|
| 13 |
|
|
+ ph->align = 8;
|
| 14 |
|
|
|
| 15 |
|
|
sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
|
| 16 |
|
|
sh->type = SHT_STRTAB;
|
| 17 |
|
|
Index: src/cmd/8l/asm.c
|
| 18 |
|
|
===================================================================
|
| 19 |
|
|
--- a/src/cmd/8l/asm.c
|
| 20 |
|
|
+++ b/src/cmd/8l/asm.c
|
| 21 |
|
|
@@ -1127,6 +1127,11 @@
|
| 22 |
|
|
ph->flags = PF_W+PF_R;
|
| 23 |
|
|
ph->align = 4;
|
| 24 |
|
|
|
| 25 |
|
|
+ ph = newElfPhdr();
|
| 26 |
|
|
+ ph->type = PT_PAX_FLAGS;
|
| 27 |
|
|
+ ph->flags = 0x2a00; // mprotect, randexec, emutramp disabled
|
| 28 |
|
|
+ ph->align = 8;
|
| 29 |
|
|
+
|
| 30 |
|
|
sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
|
| 31 |
|
|
sh->type = SHT_STRTAB;
|
| 32 |
|
|
sh->addralign = 1;
|
| 33 |
|
|
Index: src/cmd/ld/elf.h
|
| 34 |
|
|
===================================================================
|
| 35 |
|
|
--- a/src/cmd/ld/elf.h
|
| 36 |
|
|
+++ b/src/cmd/ld/elf.h
|
| 37 |
|
|
@@ -251,6 +251,7 @@
|
| 38 |
|
|
#define PT_LOPROC 0x70000000 /* First processor-specific type. */
|
| 39 |
|
|
#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */
|
| 40 |
|
|
#define PT_GNU_STACK 0x6474e551
|
| 41 |
|
|
+#define PT_PAX_FLAGS 0x65041580
|
| 42 |
|
|
|
| 43 |
|
|
/* Values for p_flags. */
|
| 44 |
|
|
#define PF_X 0x1 /* Executable. */
|