cc-wrapper: treat hardeningDisable as string

This fixes passing the env variable to the ld-wrapper through the gcc
call. Wtf?!
This commit is contained in:
Robin Gloster 2016-03-14 00:26:52 +00:00
parent 1a5acdb695
commit a9b942c061

View File

@ -2,10 +2,10 @@ hardeningFlags=(fortify stackprotector pic strictoverflow format relro bindnow)
hardeningFlags+=("${hardeningEnable[@]}")
hardeningCFlags=()
hardeningLDFlags=()
hardeningDisable=(${hardeningDisable[@]})
hardeningDisable=${hardeningDisable:-""}
if [[ "$($LD -z 2>&1)" =~ "unknown option" ]]; then
hardeningDisable+=(bindnow relro)
hardeningDisable+=" bindnow relro"
fi
if [[ -n "$NIX_DEBUG" ]]; then echo HARDENING: Value of '$hardeningDisable': $hardeningDisable >&2; fi
@ -14,7 +14,7 @@ if [[ ! $hardeningDisable == "all" ]]; then
if [[ -n "$NIX_DEBUG" ]]; then echo 'HARDENING: Is active (not completely disabled with "all" flag)' >&2; fi
for flag in "${hardeningFlags[@]}"
do
if [[ ! "${hardeningDisable[@]}" =~ "$flag" ]]; then
if [[ ! "${hardeningDisable}" =~ "$flag" ]]; then
case $flag in
fortify)
if [[ -n "$NIX_DEBUG" ]]; then echo HARDENING: enabling fortify >&2; fi