Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Seiderer <ps.report@gmx.net>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v1] package/ntpsec: fix Stack Smashing Protection detection
Date: Sat, 11 Feb 2023 18:55:47 +0100	[thread overview]
Message-ID: <20230211185547.59a1fa42@gmx.net> (raw)
In-Reply-To: <20230211164926.GI2796@scaer>

Hello Yann, *,

On Sat, 11 Feb 2023 17:49:26 +0100, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> Peter, All,
>
> On 2023-02-11 17:32 +0100, Peter Seiderer spake thusly:
> > Fix SSP missdetection (compiler supports '-fstack-protector-all' command
> > line argument but selected libc/toolchain does not support SSP,
> > e.g. i686-musl.
> >
> > Fixes:
> >
> >   - http://autobuild.buildroot.net/results/ded9ad5badbcfa6552443d3ce0866722becfefbd
> >
> >   [...]
> >   Checking if C compiler supports -fstack-protector-all : yes
> >   [...]
> >   Checking for type struct timex                                  : no
> >   The configuration failed
> >   (complete log in .../build/ntpsec-1_2_2/build/config.log)
> >
> >   And from build/ntpsec-1_2_2/build/config.log:
> >
> >   err: .../host/lib/gcc/i686-buildroot-linux-musl/12.2.0/../../../../i686-buildroot-linux-musl/bin/ld: test.c.1.o: in function `main':
> >   test.c:(.text.startup+0x2a): undefined reference to `__stack_chk_fail_local'
> >   .../host/lib/gcc/i686-buildroot-linux-musl/12.2.0/../../../../i686-buildroot-linux-musl/bin/ld: .../build/ntpsec-1_2_2/build/.conf_check_01f3f794d5b6ffb7add7ce130581ae04/testbuild/main/testprog: hidden symbol `__stack_chk_fail_local' isn't defined
> >   .../host/lib/gcc/i686-buildroot-linux-musl/12.2.0/../../../../i686-buildroot-linux-musl/bin/ld: final link failed: bad value
> >   collect2: error: ld returned 1 exit status
> >
> > Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> > ---
> >  package/ntpsec/ntpsec.mk | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/package/ntpsec/ntpsec.mk b/package/ntpsec/ntpsec.mk
> > index c7fa2f85a8..18a8353900 100644
> > --- a/package/ntpsec/ntpsec.mk
> > +++ b/package/ntpsec/ntpsec.mk
> > @@ -30,6 +30,15 @@ NTPSEC_DEPENDENCIES = \
> >  	libcap \
> >  	openssl
> >
> > +# prevent '-fstack-protector-all' compiler flag detection without
> > +# ssp support (e.g. i686-musl)
> > +ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
> > +define NTPSEC_FORCE_DISABLE_SSP
> > +	$(SED) s/fstack-protector-all/fstack-protector-all-disabled/g $(@D)/wscript
> > +endef
> > +endif
> > +NTPSEC_PRE_CONFIGURE_HOOKS += NTPSEC_FORCE_DISABLE_SSP
>
> Assigning to hooks should be done in the conditional if-block, not
> outside.
>
> But in Buildroot, the SSP flags are automatically handled by the
> wrapper, so we should just unconditionally remove said flags as set by
> the package, like was done in 50cbac5099b1 (package/sysvinit: add patch
> to fix compile without stack-protector support) for example (and no,
> that commit was not chosen totally at random ;-) ).

Nice reference ;-), do you prefer the above sed hack unconditionally
(not sure if the wscript will add additional -lssp/-lssp_nonshared if
available) or a patch removing the whole -fstack-protector-all/-lssp/-lssp_nonshared
handling?

Regards,
Peter


>
> Regards,
> Yann E. MORIN.
>
> >  # CC="$(HOSTCC)" is strange but needed to build some host tools, the
> >  # cross-compiler will properly be used to build target code thanks to
> >  # --cross-compiler
> > --
> > 2.39.1
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2023-02-11 17:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-11 16:32 [Buildroot] [PATCH v1] package/ntpsec: fix Stack Smashing Protection detection Peter Seiderer
2023-02-11 16:49 ` Yann E. MORIN
2023-02-11 17:55   ` Peter Seiderer [this message]

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=20230211185547.59a1fa42@gmx.net \
    --to=ps.report@gmx.net \
    --cc=buildroot@buildroot.org \
    --cc=yann.morin.1998@free.fr \
    /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