All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Khem Raj <raj.khem@gmail.com>, ChenQi <Qi.Chen@windriver.com>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] defaultsetup.conf: Enable security flags+pie	by default
Date: Fri, 27 Jul 2018 20:49:51 +0000	[thread overview]
Message-ID: <084d0ef1bd4047859ed68d8e90d3321d@XBOX02.axis.com> (raw)
In-Reply-To: <CAMKF1spfo0rTE31BiCuYPZuR2GQ=U4i9LBGkQ_r3HQdZf4udsQ@mail.gmail.com>

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Khem Raj
> Sent: den 24 juli 2018 16:12
> To: ChenQi <Qi.Chen@windriver.com>
> Cc: Patches and discussions about the oe-core layer <openembedded-
> core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCH] defaultsetup.conf: Enable security
> flags+pie by default
> 
> On Tue, Jul 24, 2018 at 12:30 AM ChenQi <Qi.Chen@windriver.com> wrote:
> >
> > Hi Khem,
> >
> > The comments in security-flags.inc also needs to be modified to
> remove
> > 'poky-lsb' info.
> >
> > I'd suggest we still put it into distro conf file (poky.conf) instead
> of
> > defaultsetup.conf, because defaultsetup.conf is included by
> > bitbake.conf. I think things in defaultsetup.conf should be necessary
> > default values to build things out. I don't think security flags is
> > necessary to build things out.
> 
> this is the default setup, even non-poky users will get consistent
> experience.

I have to agree with Chen here. I think requiring security_flags.inc from 
defaultsetup.conf is the wrong thing to do. We use security_flags.inc in 
our setup, and I know how much trouble it has brought. To me, using it 
should be a distro decision, not something that is enforced by the use 
of bitbake.

> > Also, I got a question when I just looked at this file.
> > Do you think we should adjust CFLAGS and LDFALGS in security_flags.inc
> > instead of the current TARGET_CC_ARCH and TARGET_LDFLAGS?
> 
> in many cases packages do not honor CFLAGS/LDFLAGS say during configure
> 
> > We are naming
> > variables to SECURITY_CFLAGS and SECURITY_LDFLAGS, it seems that they
> > belong to CFLAGS and LDFLAGS naturally. But I'm not sure about it.
> >
> yes they do, but this makes it easy to override the setting for
> packages where these options are needed to be overridden or modified.

Actually, with the changes introduced in Pyro, SECURITY_CFLAGS became a 
mess. Before Pyro, you either set SECURITY_CFLAGS to 
"${SECURITY_NO_PIE_CFLAGS}" (to disable the use of -fpie), or you set it 
to the empty string (to disable all security options). With Pyro and later, 
you instead have to set SECURITY_CFLAGS to "${SECURITY_NO_PIE_CFLAGS} 
${SECURITY_NOPIE_CFLAGS}" to make sure -fpie is disabled, or set it to 
"${SECURITY_NOPIE_CFLAGS}" to disable everything. Alternatively you can 
set SECURITY_PIE_CFLAGS to "${SECURITY_NOPIE_CFLAGS}" to only disable 
-fpie.

I have considered to suggest changing the definition of 
SECURITY_NOPIE_CFLAGS to:

SECURITY_NOPIE_CFLAGS ?= "${@'-no-pie -fno-PIE' if '${GCCPIE}' else ''}"

and then change SECURITY_NO_PIE_CFLAGS to:

SECURITY_NO_PIE_CFLAGS ?= "-fstack-protector-strong ${SECURITY_NOPIE_CFLAGS} ${lcl_maybe_fortify} ${SECURITY_STRINGFORMAT}"

That would better have matched the situation before Pyro, in that one yet 
again would set SECURITY_CFLAGS to "${SECURITY_NO_PIE_CFLAGS}" to disable 
-fpie. Unfortunately one would still have to set SECURITY_CFLAGS to 
"${SECURITY_NOPIE_CFLAGS}" to disable everything.

> > Best Regards,
> > Chen Qi
> >
> >
> > On 07/24/2018 03:09 AM, Khem Raj wrote:
> > > This has been an opt-in for so long, some distributions e.g.
> > > poky-lsb uses it by default however, since most of linux
> > > distros have started to default to these settings for security
> > > enhancements, time has come for OE to make it default too
> > >
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > ---
> > >   meta/conf/distro/defaultsetup.conf | 1 +
> > >   1 file changed, 1 insertion(+)
> > >
> > > diff --git a/meta/conf/distro/defaultsetup.conf
> b/meta/conf/distro/defaultsetup.conf
> > > index ca2f9178d2..352e279596 100644
> > > --- a/meta/conf/distro/defaultsetup.conf
> > > +++ b/meta/conf/distro/defaultsetup.conf
> > > @@ -1,6 +1,7 @@
> > >   include conf/distro/include/default-providers.inc
> > >   include conf/distro/include/default-versions.inc
> > >   include conf/distro/include/default-distrovars.inc
> > > +require conf/distro/include/security_flags.inc
> > >   include conf/distro/include/world-broken.inc
> > >
> > >   TCMODE ?= "default"

//Peter



  reply	other threads:[~2018-07-27 20:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 19:09 [PATCH] defaultsetup.conf: Enable security flags+pie by default Khem Raj
2018-07-24  6:42 ` Anuj Mittal
2018-07-24 14:13   ` Khem Raj
2018-07-24  7:34 ` ChenQi
2018-07-24 14:12   ` Khem Raj
2018-07-27 20:49     ` Peter Kjellerstedt [this message]
2018-07-27 21:05       ` Andre McCurdy
2018-07-27 21:26       ` Khem Raj
2018-07-31 21:17         ` Peter Kjellerstedt
2018-08-02  9:26           ` Khem Raj

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=084d0ef1bd4047859ed68d8e90d3321d@XBOX02.axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=Qi.Chen@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.