svn commit: r358267 - in stable/12: contrib/elftoolchain/elfdump contrib/elftoolchain/readelf sys/sys
Christian S.J. Peron
csjp at FreeBSD.org
Mon Feb 24 02:11:55 UTC 2020
Author: csjp
Date: Mon Feb 24 02:11:54 2020
New Revision: 358267
URL: https://svnweb.freebsd.org/changeset/base/358267
Log:
MFC r348776
Teach readelf about some OpenBSD ELF program headers
Discussed with: emaste
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20548
Modified:
stable/12/contrib/elftoolchain/elfdump/elfdump.c
stable/12/contrib/elftoolchain/readelf/readelf.c
stable/12/sys/sys/elf_common.h
Modified: stable/12/contrib/elftoolchain/elfdump/elfdump.c
==============================================================================
--- stable/12/contrib/elftoolchain/elfdump/elfdump.c Sun Feb 23 23:39:55 2020 (r358266)
+++ stable/12/contrib/elftoolchain/elfdump/elfdump.c Mon Feb 24 02:11:54 2020 (r358267)
@@ -343,17 +343,20 @@ elf_phdr_type_str(unsigned int type)
static char s_type[32];
switch (type) {
- case PT_NULL: return "PT_NULL";
- case PT_LOAD: return "PT_LOAD";
- case PT_DYNAMIC: return "PT_DYNAMIC";
- case PT_INTERP: return "PT_INTERP";
- case PT_NOTE: return "PT_NOTE";
- case PT_SHLIB: return "PT_SHLIB";
- case PT_PHDR: return "PT_PHDR";
- case PT_TLS: return "PT_TLS";
- case PT_GNU_EH_FRAME: return "PT_GNU_EH_FRAME";
- case PT_GNU_STACK: return "PT_GNU_STACK";
- case PT_GNU_RELRO: return "PT_GNU_RELRO";
+ case PT_NULL: return "PT_NULL";
+ case PT_LOAD: return "PT_LOAD";
+ case PT_DYNAMIC: return "PT_DYNAMIC";
+ case PT_INTERP: return "PT_INTERP";
+ case PT_NOTE: return "PT_NOTE";
+ case PT_SHLIB: return "PT_SHLIB";
+ case PT_PHDR: return "PT_PHDR";
+ case PT_TLS: return "PT_TLS";
+ case PT_GNU_EH_FRAME: return "PT_GNU_EH_FRAME";
+ case PT_GNU_STACK: return "PT_GNU_STACK";
+ case PT_GNU_RELRO: return "PT_GNU_RELRO";
+ case PT_OPENBSD_RANDOMIZE: return "PT_OPENBSD_RANDOMIZE";
+ case PT_OPENBSD_WXNEEDED: return "PT_OPENBSD_WXNEEDED";
+ case PT_OPENBSD_BOOTDATA: return "PT_OPENBSD_BOOTDATA";
}
snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type);
return (s_type);
Modified: stable/12/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- stable/12/contrib/elftoolchain/readelf/readelf.c Sun Feb 23 23:39:55 2020 (r358266)
+++ stable/12/contrib/elftoolchain/readelf/readelf.c Mon Feb 24 02:11:54 2020 (r358267)
@@ -670,6 +670,9 @@ phdr_type(unsigned int mach, unsigned int ptype)
case PT_GNU_EH_FRAME: return "GNU_EH_FRAME";
case PT_GNU_STACK: return "GNU_STACK";
case PT_GNU_RELRO: return "GNU_RELRO";
+ case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE";
+ case PT_OPENBSD_WXNEEDED: return "OPENBSD_WXNEEDED";
+ case PT_OPENBSD_BOOTDATA: return "OPENBSD_BOOTDATA";
default:
if (ptype >= PT_LOOS && ptype <= PT_HIOS)
snprintf(s_ptype, sizeof(s_ptype), "LOOS+%#x",
Modified: stable/12/sys/sys/elf_common.h
==============================================================================
--- stable/12/sys/sys/elf_common.h Sun Feb 23 23:39:55 2020 (r358266)
+++ stable/12/sys/sys/elf_common.h Mon Feb 24 02:11:54 2020 (r358267)
@@ -544,6 +544,10 @@ typedef struct {
#define PT_ARM_EXIDX 0x70000001 /* ARM exception unwind tables. */
#define PT_HIPROC 0x7fffffff /* Last processor-specific type. */
+#define PT_OPENBSD_RANDOMIZE 0x65A3DBE6 /* OpenBSD random data segment */
+#define PT_OPENBSD_WXNEEDED 0x65A3DBE7 /* OpenBSD EXEC/WRITE pages needed */
+#define PT_OPENBSD_BOOTDATA 0x65A41BE6 /* OpenBSD section for boot args */
+
/* Values for p_flags. */
#define PF_X 0x1 /* Executable. */
#define PF_W 0x2 /* Writable. */
More information about the svn-src-stable-12
mailing list