RFR: JDK-8081692 Configure should verify that -fstack-protector is valid

David Holmes david.holmes at oracle.com
Fri Jun 5 06:36:54 UTC 2015


On 4/06/2015 10:38 PM, Magnus Ihse Bursie wrote:
> On 2015-06-04 07:41, David Holmes wrote:
>> Magnus,
>>
>> You missed the hotspot side of this:
>>
>> ./solaris/makefiles/gcc.make:  DEBUG_CFLAGS += -fstack-protector-all
>> --param ssp-buffer-size=1
>> ./bsd/makefiles/gcc.make:    DEBUG_CFLAGS += -fstack-protector-all
>> --param ssp-buffer-size=1
>> ./linux/makefiles/gcc.make:    DEBUG_CFLAGS += -fstack-protector-all
>> --param ssp-buffer-size=1
>
> I'm not actually sure how to do this in hotspot. We have no access to
> the FLAGS_COMPILER_CHECK_ARGUMENTS configure argument.
>
> Should I move the definition of the DEBUG_CFLAGS from the hotspot
> makefiles into configure, and pass e.g. HOTSPOT_DEBUG_CFLAGS into
> hotspot-spec.gmk? Would that seem like a good idea to you?

I guess I was expecting a SUPPORTS_STACK_PROTECTOR variable that could 
be exported to spec.gmk.

BTW in this:

       CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param 
ssp-buffer-size=1"

the --param ssp-buffer-size is only meaningful when using 
-fstack-protector[-all]. It doesn't produce any warnings though so I 
assume it is harmless.

Thanks,
David

> /Magnus
> (I'm soooo longing for the build-infra hotspot replacement...)
>
>>
>> David
>>
>> On 3/06/2015 10:33 PM, Magnus Ihse Bursie wrote:
>>> Not all versions of gcc support -fstack-protector. We should check that
>>> it is accepted as an argument before adding it to the flags.
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8081692
>>> WebRev inline:
>>>
>>> diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
>>> --- a/common/autoconf/flags.m4
>>> +++ b/common/autoconf/flags.m4
>>> @@ -338,14 +338,16 @@
>>>         # no adjustment
>>>         ;;
>>>       slowdebug )
>>> -      # Add runtime stack smashing and undefined behavior checks
>>> -      CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param
>>> ssp-buffer-size=1"
>>> -      CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param
>>> ssp-buffer-size=1"
>>> +      # Add runtime stack smashing and undefined behavior checks.
>>> +      # Not all versions of gcc support -fstack-protector
>>> +      STACK_PROTECTOR_CFLAG="-fstack-protector-all"
>>> +      FLAGS_COMPILER_CHECK_ARGUMENTS([$STACK_PROTECTOR_CFLAG], [],
>>> [STACK_PROTECTOR_CFLAG=""])
>>> +
>>> +      CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param
>>> ssp-buffer-size=1"
>>> +      CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param
>>> ssp-buffer-size=1"
>>>         ;;
>>>       esac
>>>     fi
>>> -  AC_SUBST(CFLAGS_DEBUG_OPTIONS)
>>> -  AC_SUBST(CXXFLAGS_DEBUG_OPTIONS)
>>>
>>>     # Optimization levels
>>>     if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
>>>
>>> The AC_SUBST removal is just a bit of cleanup, we didn't use the
>>> *_DEBUG_OPTIONS in the spec files, just later on when constructing
>>> JDK_CFLAGS.
>>>
>>> /Magnus
>>>
>



More information about the build-dev mailing list