From patchwork Wed Jun 14 15:23:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 105550 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp385388obh; Wed, 14 Jun 2017 08:23:50 -0700 (PDT) X-Received: by 10.84.233.141 with SMTP id l13mr697096plk.298.1497453830769; Wed, 14 Jun 2017 08:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497453830; cv=none; d=google.com; s=arc-20160816; b=wBfucQ57eAvUnfCuLSFfFKF/m3OaYhek9lEQWaMlMi7oum40G1Wa5i5Ru3Ok6ovZ1i aurCkCUZdevjY6MAqUTSY1ow8O7yMP5kPiZEnJ/nhrm1MGtbRp92Z+TIo9pzxXlWz5iG Xx2Qh5YxwH4L/CfK6htdNMo7URxSqD01qUIfKPBp7D+xir0KCBZF6TQ5cRwYDu6yJzex J0glIFHR8pys8/M6+R6LQqMuPafsoAM3CsCJ2wd03amuH7Ym7DL+yDzpIrtiUTWKM/Iz ajM3EcjaJKYbeGaxKEkbkvx5iYIORXhPmwfVzp+ZkvWCRXus1HPTzJpAKdCQzIrb4gkG x75Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=oK3K/liDh8+1F6QBweyK0Niui377jDrqnDEn8AxMGD0=; b=UfJC2l3VKQ/RpSfb3Lmawick7krD/7CvtgwkBk1+S8WNpd5wmCiRM16NxuCv0kDy6l yN4qKBLs91F5jjSfiSqp5mdMfwMscPuYdTKL4CgAoZvQ4E/vEvfmvNznBlgAcrhlvPq/ b2zoPLZYxMnzxytIMDDIzA5l8W12qL4KAzcBVfxXyMy4OrQXA3vRqh00VX4TpE1yJRqF eJbh0DmpN7rpeQJl6R+T6Eu3TgH9DDqcHfN57AbE+Gb5HhP92XvFy+986GHwUO1JuiS6 VNghGZwVoG/P0WDz1udEqhqrfCefAlAkeYy5/BfjHstGschjz4+si59lqC8BUryjHjuv VUyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=PNLD3CSU; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id g6si227314pln.178.2017.06.14.08.23.50; Wed, 14 Jun 2017 08:23:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=PNLD3CSU; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from review.yoctoproject.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 37853783BA; Wed, 14 Jun 2017 15:23:45 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by mail.openembedded.org (Postfix) with ESMTP id 02C0B783AD for ; Wed, 14 Jun 2017 15:23:40 +0000 (UTC) Received: by mail-pg0-f65.google.com with SMTP id v14so477889pgn.1 for ; Wed, 14 Jun 2017 08:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KkksbstK3R9z6xXLsJJuSbZgh2+DVw25DiQWAlQfvMA=; b=PNLD3CSUtIQMAzfWBjZ2zYHV1B710iU6/CIOqh13u8+O2DUMn+u+VdAdZrwL65Hg0s bZvRbT3y8sOzu1DQIH3Fq/cyacVLUTNlZ82eSV3DbgctQMHx5uEUVaQILWXUkW+aOg0E IFu5cQoZ4LTCkHlBpmH+hl9enco0nD//VNtcS06vTZJRZlGrLLWGxwcpNQJYMuxWq7ht SydKjmbJp5SV2hlrwy/h1WdbYR+yeFwx2iGFwG0kuCLfCoEIOdjEhSFKbs/KB8XqaG3S JZwOQe2sBnY4S4mWg246LpLkpQp3KmXZpW0dotPZjPcyBZm1Kz8jS48zddCYMjwkawAw 4igg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KkksbstK3R9z6xXLsJJuSbZgh2+DVw25DiQWAlQfvMA=; b=PjJxT3RCN6R0p8gmDvy3wlHGF1+2jvSOCp4NKZ+B4vPWbtxpJc1ftwnI7KzyI7bWPX A6Ob8l1WRLiPlzjPcTl/BK7C+wPCOZpqWfebq7JBrnnWpPr917tn3OY8WYbw5iQQ2MaL if40Uiyn/ChY8K8cW1oU/7xxbAo0lHjMoH6Ww41pkFDcZqrXxG5cy7bAAadD+VQaHe3R mLDHSq7tvqObPdEIKm9+DCxZErguKsYmK9i28h+B64jOVy4cexbOEwXd64sVLkvmpOHK wR2zS4EFkH8v7eSenrq0CQ/N0jKmGg00haAJAY4zGMOE34WKpzR1h2scHRJp99+LW4Cy sivA== X-Gm-Message-State: AKS2vOygeBM7eeBqNjeO1rkcRQKzepYF8RIsM46z7Cb3pJFzIYhhks/t XHrhUKF9QI93ig47 X-Received: by 10.84.209.238 with SMTP id y101mr675764plh.290.1497453821852; Wed, 14 Jun 2017 08:23:41 -0700 (PDT) Received: from localhost.localdomain ([2601:646:8882:b8c::264a]) by smtp.gmail.com with ESMTPSA id i2sm502948pfe.89.2017.06.14.08.23.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 08:23:40 -0700 (PDT) From: Khem Raj To: openembedded-core@lists.openembedded.org Date: Wed, 14 Jun 2017 08:23:21 -0700 Message-Id: <80c14cbb1b41755ac3370626f36f7fc84f106f92.1497453168.git.raj.khem@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: References: Subject: [OE-core] [PATCH 02/10] security_flags.inc: Delete pinnings for SECURITY_NO_PIE_CFLAGS X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org GCC is configured correctly to pass PIE cflags/ldflags Signed-off-by: Khem Raj --- meta/conf/distro/include/security_flags.inc | 83 ++++++++--------------------- 1 file changed, 22 insertions(+), 61 deletions(-) -- 2.13.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc index d3b7257240..f6bbf70655 100644 --- a/meta/conf/distro/include/security_flags.inc +++ b/meta/conf/distro/include/security_flags.inc @@ -1,4 +1,4 @@ -# Setup extra CFLAGS and LDFLAGS which have 'security' benefits. These +# Setup extra CFLAGS and LDFLAGS which have 'security' benefits. These # don't work universally, there are recipes which can't use one, the other # or both so a blacklist is maintained here. The idea would be over # time to reduce this list to nothing. @@ -14,89 +14,45 @@ lcl_maybe_fortify = "${@base_conditional('DEBUG_BUILD','1','','-D_FORTIFY_SOURCE # Error on use of format strings that represent possible security problems SECURITY_STRINGFORMAT ?= "-Wformat -Wformat-security -Werror=format-security" -SECURITY_CFLAGS ?= "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" +# Inject pie flags into compiler flags if not configured with gcc itself +# especially useful with external toolchains +SECURITY_PIE_CFLAGS ?= "${@'' if '${GCCPIE}' else '-pie -fPIE'}" + +SECURITY_NOPIE_CFLAGS ?= "-no-pie -fno-PIE" + +SECURITY_CFLAGS ?= "-fstack-protector-strong ${SECURITY_PIE_CFLAGS} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" SECURITY_NO_PIE_CFLAGS ?= "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}" SECURITY_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro,-z,now" SECURITY_X_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro" # powerpc does not get on with pie for reasons not looked into as yet -SECURITY_CFLAGS_powerpc = "-fstack-protector-strong ${lcl_maybe_fortify}" -# Deal with ppc specific linker failures when using the cflags -SECURITY_CFLAGS_pn-dbus_powerpc = "" -SECURITY_CFLAGS_pn-dbus-ptest_powerpc = "" -SECURITY_CFLAGS_pn-libmatchbox_powerpc = "" +SECURITY_CFLAGS_powerpc = "-fstack-protector-strong ${lcl_maybe_fortify} ${SECURITY_NOPIE_CFLAGS}" +SECURITY_CFLAGS_pn-libgcc_powerpc = "" # arm specific security flag issues -SECURITY_CFLAGS_pn-lttng-tools_arm = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-aspell = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-beecrypt = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-coreutils = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-cups = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-db = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-directfb = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-glibc = "" SECURITY_CFLAGS_pn-glibc-initial = "" -SECURITY_CFLAGS_pn-elfutils = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-enchant = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-expect = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-flac = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-gcc = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-gcc-runtime = "" -SECURITY_CFLAGS_pn-gcc-sanitizers = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-gdb = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-gmp = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-gnutls = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-gpgme = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-grub = "" SECURITY_CFLAGS_pn-grub-efi = "" SECURITY_CFLAGS_pn-grub-efi-native = "" SECURITY_CFLAGS_pn-grub-efi-x86-native = "" SECURITY_CFLAGS_pn-grub-efi-i586-native = "" SECURITY_CFLAGS_pn-grub-efi-x86-64-native = "" -SECURITY_CFLAGS_pn-gstreamer1.0-plugins-bad = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-gstreamer1.0-plugins-good = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-harfbuzz = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-kexec-tools = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-iptables = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libaio = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libcap = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libgcc = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libid3tag = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libnewt-python = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libglu = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libpcap = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libpcre = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-libproxy = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-mesa = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-mesa-gl = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-openssl = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-opensp = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-ppp = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python-pycurl = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python-numpy = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python3-numpy = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python3-pycairo = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python3-pycurl = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python3-pygpgme = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-python3 = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-syslinux = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-slang = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-source-highlight = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-tcl = "${SECURITY_NO_PIE_CFLAGS}" -SECURITY_CFLAGS_pn-tiff = "${SECURITY_NO_PIE_CFLAGS}" SECURITY_CFLAGS_pn-uclibc = "" SECURITY_CFLAGS_pn-uclibc-initial = "" -SECURITY_CFLAGS_pn-valgrind = "" -SECURITY_CFLAGS_pn-zlib = "${SECURITY_NO_PIE_CFLAGS}" + +SECURITY_CFLAGS_pn-mkelfimage_x86 = "" + +SECURITY_CFLAGS_pn-valgrind = "${SECURITY_NOPIE_CFLAGS}" +SECURITY_LDFLAGS_pn-valgrind = "" # Recipes which fail to compile when elevating -Wformat-security to an error SECURITY_STRINGFORMAT_pn-busybox = "" SECURITY_STRINGFORMAT_pn-gcc = "" -SECURITY_STRINGFORMAT_pn-oh-puzzles = "" -TARGET_CFLAGS_append_class-target = " ${SECURITY_CFLAGS}" +TARGET_CC_ARCH_append_class-target = " ${SECURITY_CFLAGS}" TARGET_LDFLAGS_append_class-target = " ${SECURITY_LDFLAGS}" SECURITY_LDFLAGS_remove_pn-gcc-runtime = "-fstack-protector-strong" @@ -104,6 +60,8 @@ SECURITY_LDFLAGS_remove_pn-glibc = "-fstack-protector-strong" SECURITY_LDFLAGS_remove_pn-glibc-initial = "-fstack-protector-strong" SECURITY_LDFLAGS_remove_pn-uclibc = "-fstack-protector-strong" SECURITY_LDFLAGS_remove_pn-uclibc-initial = "-fstack-protector-strong" +SECURITY_LDFLAGS_remove_pn-mkelfimage_x86 = "-fstack-protector-strong" + SECURITY_LDFLAGS_pn-xf86-video-fbdev = "${SECURITY_X_LDFLAGS}" SECURITY_LDFLAGS_pn-xf86-video-intel = "${SECURITY_X_LDFLAGS}" SECURITY_LDFLAGS_pn-xf86-video-omapfb = "${SECURITY_X_LDFLAGS}" @@ -112,4 +70,7 @@ SECURITY_LDFLAGS_pn-xf86-video-vesa = "${SECURITY_X_LDFLAGS}" SECURITY_LDFLAGS_pn-xf86-video-vmware = "${SECURITY_X_LDFLAGS}" SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}" -TARGET_CC_ARCH_append_pn-binutils = " ${SECURITY_CFLAGS} ${SELECTED_OPTIMIZATION}" +TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION}" +TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION}" +TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION}" +TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION}"