Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Hongxu Jia <hongxu.jia@windriver.com>,
	"openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 2/2] security_flags.inc: add var-FSTACK_PROTECTOR	to improve variable OVERRIDES
Date: Wed, 29 Aug 2018 09:18:01 +0000	[thread overview]
Message-ID: <dcef97cf1a06461aabe990674fd25bd9@XBOX02.axis.com> (raw)
In-Reply-To: <1535533498-36841-2-git-send-email-hongxu.jia@windriver.com>

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Hongxu Jia
> Sent: den 29 augusti 2018 11:05
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 2/2] security_flags.inc: add var-
> FSTACK_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-FSTACK_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-FSTACK_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 = ""
> ...
> 
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>  meta/conf/distro/include/security_flags.inc | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/meta/conf/distro/include/security_flags.inc
> b/meta/conf/distro/include/security_flags.inc
> index e113f99..6602ec0 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'}"
> 
>  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}"
> +FSTACK_PROTECTOR ?= "-fstack-protector-strong"

May I suggest to call it SECURITY_STACK_PROTECTOR instead? That aligns 
it better with the other variables.

> -SECURITY_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro,-z,now"
> -SECURITY_X_LDFLAGS ?= "-fstack-protector-strong -Wl,-z,relro"
> +SECURITY_CFLAGS ?= "${FSTACK_PROTECTOR} ${SECURITY_PIE_CFLAGS} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}"
> +SECURITY_NO_PIE_CFLAGS ?= "${FSTACK_PROTECTOR} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}"
> +
> +SECURITY_LDFLAGS ?= "${FSTACK_PROTECTOR} -Wl,-z,relro,-z,now"
> +SECURITY_X_LDFLAGS ?= "${FSTACK_PROTECTOR} -Wl,-z,relro"
> 
>  # powerpc does not get on with pie for reasons not looked into as yet
>  GCCPIE_powerpc = ""
> @@ -56,9 +58,9 @@ SECURITY_STRINGFORMAT_pn-gcc = ""
>  TARGET_CC_ARCH_append_class-target = " ${SECURITY_CFLAGS}"
>  TARGET_LDFLAGS_append_class-target = " ${SECURITY_LDFLAGS}"
> 
> -SECURITY_LDFLAGS_remove_pn-gcc-runtime = "-fstack-protector-strong"
> -SECURITY_LDFLAGS_remove_pn-glibc = "-fstack-protector-strong"
> -SECURITY_LDFLAGS_remove_pn-glibc-initial = "-fstack-protector-strong"
> +FSTACK_PROTECTOR_pn-gcc-runtime = ""
> +FSTACK_PROTECTOR_pn-glibc = ""
> +FSTACK_PROTECTOR_pn-glibc-initial = ""
>  # All xorg module drivers need to be linked this way as well and are
>  # handled in recipes-graphics/xorg-driver/xorg-driver-common.inc
>  SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}"
> --
> 2.7.4

//Peter



  reply	other threads:[~2018-08-29  9:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  9:04 [PATCH 1/2] security_flags.inc: use `?=' to set a default var-lcl_maybe_fortify Hongxu Jia
2018-08-29  9:04 ` [PATCH 2/2] security_flags.inc: add var-FSTACK_PROTECTOR to improve variable OVERRIDES Hongxu Jia
2018-08-29  9:18   ` Peter Kjellerstedt [this message]
2018-08-29  9:21     ` Hongxu Jia
2018-08-29 14:01   ` [PATCH V2] security_flags.inc: add var-SECURITY_STACK_PROTECTOR " Hongxu Jia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dcef97cf1a06461aabe990674fd25bd9@XBOX02.axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=hongxu.jia@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox