Print this page
11866 Use -fstack-protector-strong when available
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>
Change-Id: Iaffe3e8275a3e6a06cc430743cd6539ead38f736

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/Makefile.intel
          +++ new/usr/src/uts/intel/Makefile.intel
↓ open down ↓ 126 lines elided ↑ open up ↑
 127  127  COPTIMIZE               = $(COPTFLAG_$(CLASS))
 128  128  
 129  129  CFLAGS                  = $(CFLAGS_XARCH)
 130  130  CFLAGS                  += $(COPTIMIZE)
 131  131  CFLAGS                  += $(INLINES) -D_ASM_INLINES
 132  132  CFLAGS                  += $(CCMODE)
 133  133  CFLAGS                  += $(SPACEFLAG)
 134  134  CFLAGS                  += $(CCUNBOUND)
 135  135  CFLAGS                  += $(CFLAGS_uts)
 136  136  CFLAGS                  += -xstrconst
 137      -CFLAGS                  += -_gcc=-fstack-protector
 138  137  
      138 +#
      139 +# Options to control which version of stack-protector we enable. This
      140 +# gives us a bit of flexibility and is unfortunately necessary as some
      141 +# modules do not function correctly with our defaults (qede).
      142 +#
      143 +#  o STACKPROTECT_              Sets the appropriate version for the compiler
      144 +#  o STACKPROTECT_strong        Sets us to use strong on all of the
      145 +#                               compilers it supports. This is the same
      146 +#                               as the default.
      147 +#
      148 +#  o STACKPROTECT_none          Disables the stack protector.
      149 +#
      150 +#  o STACKPROTECT_all           Enables it for everything.
      151 +#
      152 +#  o STACKPROTECT_basic         Enables the basic stack protector.
      153 +#
      154 +# -fstack-protector-strong is not available in our gcc4 which is why we
      155 +# have per-compiler versions below.
      156 +#
      157 +STACKPROTECT_           = -_gcc4=-fstack-protector
      158 +STACKPROTECT_           += -_gcc7=-fstack-protector-strong
      159 +STACKPROTECT_           += -_gcc8=-fstack-protector-strong
      160 +STACKPROTECT_           += -_gcc9=-fstack-protector-strong
      161 +
      162 +STACKPROTECT_strong     = $(STACKPROTECT_)
      163 +STACKPROTECT_none       = -_gcc=-fstack-protector-none
      164 +STACKPROTECT_all        = -_gcc=-fstack-protector-all
      165 +STACKPROTECT_basic      = -_gcc=-fstack-protector
      166 +
      167 +CFLAGS                  += $(STACKPROTECT_$(STACKPROTECT))
      168 +
 139  169  ASFLAGS_XARCH_32        = $(i386_ASFLAGS)
 140  170  ASFLAGS_XARCH_64        = $(amd64_ASFLAGS)
 141  171  ASFLAGS_XARCH           = $(ASFLAGS_XARCH_$(CLASS))
 142  172  
 143  173  ASFLAGS                 += $(ASFLAGS_XARCH)
 144  174  
 145  175  #
 146  176  #       Define the base directory for installation.
 147  177  #
 148  178  BASE_INS_DIR    = $(ROOT)
↓ open down ↓ 598 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX