Author: emaste
Date: Wed Mar  4 18:21:30 2020
New Revision: 358631
URL: https://svnweb.freebsd.org/changeset/base/358631

Log:
  Reserve WXNEEDED ELF feature control flag
  
  This will be used to tag binaries that require W+X mappings, in advance
  of the ability to prevent W^X in mmap/mprotect.
  
  There is still some discussion about the flag's name, but the ABI won't
  change even if the name does (as kib pointed out in the review).
  
  Reviewed by:  csjp, kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D23909

Modified:
  head/contrib/elftoolchain/readelf/readelf.c
  head/sys/sys/elf_common.h
  head/usr.bin/elfctl/elfctl.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.c Wed Mar  4 17:55:57 2020        
(r358630)
+++ head/contrib/elftoolchain/readelf/readelf.c Wed Mar  4 18:21:30 2020        
(r358631)
@@ -3671,6 +3671,7 @@ static struct flag_desc note_feature_ctl_flags[] = {
        { NT_FREEBSD_FCTL_ASLR_DISABLE,         "ASLR_DISABLE" },
        { NT_FREEBSD_FCTL_PROTMAX_DISABLE,      "PROTMAX_DISABLE" },
        { NT_FREEBSD_FCTL_STKGAP_DISABLE,       "STKGAP_DISABLE" },
+       { NT_FREEBSD_FCTL_WXNEEDED,             "WXNEEDED" },
        { 0, NULL }
 };
 

Modified: head/sys/sys/elf_common.h
==============================================================================
--- head/sys/sys/elf_common.h   Wed Mar  4 17:55:57 2020        (r358630)
+++ head/sys/sys/elf_common.h   Wed Mar  4 18:21:30 2020        (r358631)
@@ -790,6 +790,7 @@ typedef struct {
 #define        NT_FREEBSD_FCTL_ASLR_DISABLE    0x00000001
 #define        NT_FREEBSD_FCTL_PROTMAX_DISABLE 0x00000002
 #define        NT_FREEBSD_FCTL_STKGAP_DISABLE  0x00000004
+#define        NT_FREEBSD_FCTL_WXNEEDED        0x00000008
 
 /* Values for n_type.  Used in core files. */
 #define        NT_PRSTATUS     1       /* Process status. */

Modified: head/usr.bin/elfctl/elfctl.c
==============================================================================
--- head/usr.bin/elfctl/elfctl.c        Wed Mar  4 17:55:57 2020        
(r358630)
+++ head/usr.bin/elfctl/elfctl.c        Wed Mar  4 18:21:30 2020        
(r358631)
@@ -66,6 +66,7 @@ static struct ControlFeatures featurelist[] = {
        { "protmax",    NT_FREEBSD_FCTL_PROTMAX_DISABLE,
            "Disable implicit PROT_MAX" },
        { "stackgap",   NT_FREEBSD_FCTL_STKGAP_DISABLE, "Disable stack gap" },
+       { "wxneeded",   NT_FREEBSD_FCTL_WXNEEDED, "Requires W+X mappings" },
 };
 
 static struct option long_opts[] = {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to