diff options
| author | Khem Raj <raj.khem@gmail.com> | 2017-06-10 07:57:34 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-08 13:34:45 +0100 |
| commit | 6733a7873ca121295a2e309a6915b9816e1ae36b (patch) | |
| tree | 6cdf55980a0798fa03dcf2efad0c6caabc1f9a0a | |
| parent | c91314ec160420a320007d552cec6c7da4d54833 (diff) | |
| download | poky-6733a7873ca121295a2e309a6915b9816e1ae36b.tar.gz | |
security_flags.inc: Delete pinnings for SECURITY_NO_PIE_CFLAGS
GCC is configured correctly to pass PIE cflags/ldflags
(From OE-Core rev: e93765ffb5718b0fce84f0b8123963176dea95e4)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/conf/distro/include/security_flags.inc | 83 |
1 files changed, 22 insertions, 61 deletions
diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc index f2eb224a77..dd713b9818 100644 --- a/meta/conf/distro/include/security_flags.inc +++ b/meta/conf/distro/include/security_flags.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # Setup extra CFLAGS and LDFLAGS which have 'security' benefits. These | 1 | # Setup extra CFLAGS and LDFLAGS which have 'security' benefits. These |
| 2 | # don't work universally, there are recipes which can't use one, the other | 2 | # don't work universally, there are recipes which can't use one, the other |
| 3 | # or both so a blacklist is maintained here. The idea would be over | 3 | # or both so a blacklist is maintained here. The idea would be over |
| 4 | # time to reduce this list to nothing. | 4 | # time to reduce this list to nothing. |
| @@ -14,87 +14,45 @@ lcl_maybe_fortify = "${@base_conditional('DEBUG_BUILD','1','','-D_FORTIFY_SOURCE | |||
| 14 | # Error on use of format strings that represent possible security problems | 14 | # Error on use of format strings that represent possible security problems |
| 15 | SECURITY_STRINGFORMAT ?= "-Wformat -Wformat-security -Werror=format-security" | 15 | SECURITY_STRINGFORMAT ?= "-Wformat -Wformat-security -Werror=format-security" |
| 16 | 16 | ||
| 17 | SECURITY_CFLAGS ?= "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" | 17 | # Inject pie flags into compiler flags if not configured with gcc itself |
| 18 | # especially useful with external toolchains | ||
| 19 | SECURITY_PIE_CFLAGS ?= "${@'' if '${GCCPIE}' else '-pie -fPIE'}" | ||
| 20 | |||
| 21 | SECURITY_NOPIE_CFLAGS ?= "-no-pie -fno-PIE" | ||
| 22 | |||
| 23 | SECURITY_CFLAGS ?= "-fstack-protector-strong ${SECURITY_PIE_CFLAGS} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" | ||
| 18 | SECURITY_NO_PIE_CFLAGS ?= "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" | 24 | SECURITY_NO_PIE_CFLAGS ?= "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" |
| 19 | 25 | ||
| 20 | SECURITY_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro,-z,now" | 26 | SECURITY_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro,-z,now" |
| 21 | SECURITY_X_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro" | 27 | SECURITY_X_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro" |
| 22 | 28 | ||
| 23 | # powerpc does not get on with pie for reasons not looked into as yet | 29 | # powerpc does not get on with pie for reasons not looked into as yet |
| 24 | SECURITY_CFLAGS_powerpc = "-fstack-protector-strong ${lcl_maybe_fortify}" | 30 | SECURITY_CFLAGS_powerpc = "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_NOPIE_CFLAGS}" |
| 25 | # Deal with ppc specific linker failures when using the cflags | 31 | SECURITY_CFLAGS_pn-libgcc_powerpc = "" |
| 26 | SECURITY_CFLAGS_pn-dbus_powerpc = "" | ||
| 27 | SECURITY_CFLAGS_pn-dbus-ptest_powerpc = "" | ||
| 28 | SECURITY_CFLAGS_pn-libmatchbox_powerpc = "" | ||
| 29 | 32 | ||
| 30 | # arm specific security flag issues | 33 | # arm specific security flag issues |
| 31 | SECURITY_CFLAGS_pn-lttng-tools_arm = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 32 | SECURITY_CFLAGS_pn-aspell = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 33 | SECURITY_CFLAGS_pn-beecrypt = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 34 | SECURITY_CFLAGS_pn-coreutils = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 35 | SECURITY_CFLAGS_pn-cups = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 36 | SECURITY_CFLAGS_pn-db = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 37 | SECURITY_CFLAGS_pn-directfb = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 38 | SECURITY_CFLAGS_pn-glibc = "" | 34 | SECURITY_CFLAGS_pn-glibc = "" |
| 39 | SECURITY_CFLAGS_pn-glibc-initial = "" | 35 | SECURITY_CFLAGS_pn-glibc-initial = "" |
| 40 | SECURITY_CFLAGS_pn-elfutils = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 41 | SECURITY_CFLAGS_pn-enchant = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 42 | SECURITY_CFLAGS_pn-expect = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 43 | SECURITY_CFLAGS_pn-flac = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 44 | SECURITY_CFLAGS_pn-gcc = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 45 | SECURITY_CFLAGS_pn-gcc-runtime = "" | 36 | SECURITY_CFLAGS_pn-gcc-runtime = "" |
| 46 | SECURITY_CFLAGS_pn-gcc-sanitizers = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 47 | SECURITY_CFLAGS_pn-gdb = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 48 | SECURITY_CFLAGS_pn-gmp = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 49 | SECURITY_CFLAGS_pn-gnutls = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 50 | SECURITY_CFLAGS_pn-gpgme = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 51 | SECURITY_CFLAGS_pn-grub = "" | 37 | SECURITY_CFLAGS_pn-grub = "" |
| 52 | SECURITY_CFLAGS_pn-grub-efi = "" | 38 | SECURITY_CFLAGS_pn-grub-efi = "" |
| 53 | SECURITY_CFLAGS_pn-grub-efi-native = "" | 39 | SECURITY_CFLAGS_pn-grub-efi-native = "" |
| 54 | SECURITY_CFLAGS_pn-grub-efi-x86-native = "" | 40 | SECURITY_CFLAGS_pn-grub-efi-x86-native = "" |
| 55 | SECURITY_CFLAGS_pn-grub-efi-i586-native = "" | 41 | SECURITY_CFLAGS_pn-grub-efi-i586-native = "" |
| 56 | SECURITY_CFLAGS_pn-grub-efi-x86-64-native = "" | 42 | SECURITY_CFLAGS_pn-grub-efi-x86-64-native = "" |
| 57 | SECURITY_CFLAGS_pn-gstreamer1.0-plugins-bad = "${SECURITY_NO_PIE_CFLAGS}" | 43 | |
| 58 | SECURITY_CFLAGS_pn-gstreamer1.0-plugins-good = "${SECURITY_NO_PIE_CFLAGS}" | 44 | SECURITY_CFLAGS_pn-mkelfimage_x86 = "" |
| 59 | SECURITY_CFLAGS_pn-harfbuzz = "${SECURITY_NO_PIE_CFLAGS}" | 45 | |
| 60 | SECURITY_CFLAGS_pn-kexec-tools = "${SECURITY_NO_PIE_CFLAGS}" | 46 | SECURITY_CFLAGS_pn-valgrind = "${SECURITY_NOPIE_CFLAGS}" |
| 61 | SECURITY_CFLAGS_pn-iptables = "${SECURITY_NO_PIE_CFLAGS}" | 47 | SECURITY_LDFLAGS_pn-valgrind = "" |
| 62 | SECURITY_CFLAGS_pn-libaio = "${SECURITY_NO_PIE_CFLAGS}" | 48 | SECURITY_CFLAGS_pn-sysklogd = "${SECURITY_NOPIE_CFLAGS}" |
| 63 | SECURITY_CFLAGS_pn-libcap = "${SECURITY_NO_PIE_CFLAGS}" | 49 | SECURITY_LDFLAGS_pn-sysklogd = "" |
| 64 | SECURITY_CFLAGS_pn-libgcc = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 65 | SECURITY_CFLAGS_pn-libid3tag = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 66 | SECURITY_CFLAGS_pn-libnewt-python = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 67 | SECURITY_CFLAGS_pn-libglu = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 68 | SECURITY_CFLAGS_pn-libpcap = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 69 | SECURITY_CFLAGS_pn-libpcre = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 70 | SECURITY_CFLAGS_pn-libproxy = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 71 | SECURITY_CFLAGS_pn-mesa = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 72 | SECURITY_CFLAGS_pn-mesa-gl = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 73 | SECURITY_CFLAGS_pn-openssl = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 74 | SECURITY_CFLAGS_pn-opensp = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 75 | SECURITY_CFLAGS_pn-ppp = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 76 | SECURITY_CFLAGS_pn-python = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 77 | SECURITY_CFLAGS_pn-python-pycurl = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 78 | SECURITY_CFLAGS_pn-python-numpy = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 79 | SECURITY_CFLAGS_pn-python3-numpy = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 80 | SECURITY_CFLAGS_pn-python3-pycairo = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 81 | SECURITY_CFLAGS_pn-python3-pycurl = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 82 | SECURITY_CFLAGS_pn-python3-pygpgme = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 83 | SECURITY_CFLAGS_pn-python3 = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 84 | SECURITY_CFLAGS_pn-syslinux = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 85 | SECURITY_CFLAGS_pn-slang = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 86 | SECURITY_CFLAGS_pn-source-highlight = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 87 | SECURITY_CFLAGS_pn-tcl = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 88 | SECURITY_CFLAGS_pn-tiff = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 89 | SECURITY_CFLAGS_pn-valgrind = "" | ||
| 90 | SECURITY_CFLAGS_pn-zlib = "${SECURITY_NO_PIE_CFLAGS}" | ||
| 91 | 50 | ||
| 92 | # Recipes which fail to compile when elevating -Wformat-security to an error | 51 | # Recipes which fail to compile when elevating -Wformat-security to an error |
| 93 | SECURITY_STRINGFORMAT_pn-busybox = "" | 52 | SECURITY_STRINGFORMAT_pn-busybox = "" |
| 94 | SECURITY_STRINGFORMAT_pn-gcc = "" | 53 | SECURITY_STRINGFORMAT_pn-gcc = "" |
| 95 | SECURITY_STRINGFORMAT_pn-oh-puzzles = "" | ||
| 96 | 54 | ||
| 97 | TARGET_CFLAGS_append_class-target = " ${SECURITY_CFLAGS}" | 55 | TARGET_CC_ARCH_append_class-target = " ${SECURITY_CFLAGS}" |
| 98 | TARGET_LDFLAGS_append_class-target = " ${SECURITY_LDFLAGS}" | 56 | TARGET_LDFLAGS_append_class-target = " ${SECURITY_LDFLAGS}" |
| 99 | 57 | ||
| 100 | SECURITY_LDFLAGS_remove_pn-gcc-runtime = "-fstack-protector-strong" | 58 | SECURITY_LDFLAGS_remove_pn-gcc-runtime = "-fstack-protector-strong" |
| @@ -108,4 +66,7 @@ SECURITY_LDFLAGS_pn-xf86-video-vesa = "${SECURITY_X_LDFLAGS}" | |||
| 108 | SECURITY_LDFLAGS_pn-xf86-video-vmware = "${SECURITY_X_LDFLAGS}" | 66 | SECURITY_LDFLAGS_pn-xf86-video-vmware = "${SECURITY_X_LDFLAGS}" |
| 109 | SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}" | 67 | SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}" |
| 110 | 68 | ||
| 111 | TARGET_CC_ARCH_append_pn-binutils = " ${SECURITY_CFLAGS} ${SELECTED_OPTIMIZATION}" | 69 | TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION}" |
| 70 | TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION}" | ||
| 71 | TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION}" | ||
| 72 | TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION}" | ||
