diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2018-08-29 22:01:40 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-09-04 11:03:55 +0100 |
commit | 03b6f92245a9f534ba33a69727e15d7084893187 (patch) | |
tree | c993b56a5d00e30842a08ae48c74aaf55cdbd2ff | |
parent | 30f54f14dd3641f57398671680f2cafba19a5c61 (diff) | |
download | poky-03b6f92245a9f534ba33a69727e15d7084893187.tar.gz |
security_flags.inc: add var-SECURITY_STACK_PROTECTOR to improve variable OVERRIDES
There are var-SECURITY_PIE_CFLAGS, var-lcl_maybe_fortify and
var-SECURITY_STRINGFORMAT which are helpful for OVERRIDES.
Also add var-SECURITY_STACK_PROTECTOR, and drop hardcoded `_remove'
overrides. Such as `4ca946c security_flags: use -fstack-protector-strong',
it s/-fstack-protector-all/-fstack-protector-strong/, only tweak
var-SECURITY_STACK_PROTECTOR is sufficient.
The fix does not have any side affect on SECURITY_CFLAGS of glibc/
glibc-initial/gcc-runtime, these three directly assigned with "".
...
SECURITY_CFLAGS_pn-glibc = ""
SECURITY_CFLAGS_pn-glibc-initial = ""
SECURITY_CFLAGS_pn-gcc-runtime = ""
...
(From OE-Core rev: 0ed4a6233bdcb25cbdce698504611541420d92d0)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/conf/distro/include/security_flags.inc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc index e113f999a1..620978a8ed 100644 --- a/meta/conf/distro/include/security_flags.inc +++ b/meta/conf/distro/include/security_flags.inc | |||
@@ -21,11 +21,13 @@ SECURITY_PIE_CFLAGS ?= "${@'' if '${GCCPIE}' else '-pie -fPIE'}" | |||
21 | 21 | ||
22 | SECURITY_NOPIE_CFLAGS ?= "-no-pie -fno-PIE" | 22 | SECURITY_NOPIE_CFLAGS ?= "-no-pie -fno-PIE" |
23 | 23 | ||
24 | SECURITY_CFLAGS ?= "-fstack-protector-strong ${SECURITY_PIE_CFLAGS} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" | 24 | SECURITY_STACK_PROTECTOR ?= "-fstack-protector-strong" |
25 | SECURITY_NO_PIE_CFLAGS ?= "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" | ||
26 | 25 | ||
27 | SECURITY_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro,-z,now" | 26 | SECURITY_CFLAGS ?= "${SECURITY_STACK_PROTECTOR} ${SECURITY_PIE_CFLAGS} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" |
28 | SECURITY_X_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro" | 27 | SECURITY_NO_PIE_CFLAGS ?= "${SECURITY_STACK_PROTECTOR} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" |
28 | |||
29 | SECURITY_LDFLAGS ?= "${SECURITY_STACK_PROTECTOR} -Wl,-z,relro,-z,now" | ||
30 | SECURITY_X_LDFLAGS ?= "${SECURITY_STACK_PROTECTOR} -Wl,-z,relro" | ||
29 | 31 | ||
30 | # powerpc does not get on with pie for reasons not looked into as yet | 32 | # powerpc does not get on with pie for reasons not looked into as yet |
31 | GCCPIE_powerpc = "" | 33 | GCCPIE_powerpc = "" |
@@ -56,9 +58,9 @@ SECURITY_STRINGFORMAT_pn-gcc = "" | |||
56 | TARGET_CC_ARCH_append_class-target = " ${SECURITY_CFLAGS}" | 58 | TARGET_CC_ARCH_append_class-target = " ${SECURITY_CFLAGS}" |
57 | TARGET_LDFLAGS_append_class-target = " ${SECURITY_LDFLAGS}" | 59 | TARGET_LDFLAGS_append_class-target = " ${SECURITY_LDFLAGS}" |
58 | 60 | ||
59 | SECURITY_LDFLAGS_remove_pn-gcc-runtime = "-fstack-protector-strong" | 61 | SECURITY_STACK_PROTECTOR_pn-gcc-runtime = "" |
60 | SECURITY_LDFLAGS_remove_pn-glibc = "-fstack-protector-strong" | 62 | SECURITY_STACK_PROTECTOR_pn-glibc = "" |
61 | SECURITY_LDFLAGS_remove_pn-glibc-initial = "-fstack-protector-strong" | 63 | SECURITY_STACK_PROTECTOR_pn-glibc-initial = "" |
62 | # All xorg module drivers need to be linked this way as well and are | 64 | # All xorg module drivers need to be linked this way as well and are |
63 | # handled in recipes-graphics/xorg-driver/xorg-driver-common.inc | 65 | # handled in recipes-graphics/xorg-driver/xorg-driver-common.inc |
64 | SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}" | 66 | SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}" |