From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 2/2] package/dmalloc: disable stack-protector
Date: Sun, 12 Jun 2022 22:37:29 +0200 [thread overview]
Message-ID: <20220612203729.GM427639@scaer> (raw)
In-Reply-To: <20220610210541.3643416-2-fontaine.fabrice@gmail.com>
Fabrice, All,
On 2022-06-10 23:05 +0200, Fabrice Fontaine spake thusly:
> Fix the following build failure with stack-protector:
>
> /home/autobuild/autobuild/instance-1/output-1/per-package/dmalloc/host/bin/i686-buildroot-linux-gnu-ld -shared --whole-archive -soname libdmallocth.so -o libdmallocth.so.t libdmallocth.a
> /home/autobuild/autobuild/instance-1/output-1/per-package/dmalloc/host/bin/i686-buildroot-linux-gnu-ld: libdmallocth.a(append.o): in function `append_long':
> append.c:(.text+0x115): undefined reference to `__stack_chk_fail_local'
>
> Fixes:
> - http://autobuild.buildroot.org/results/f808885dcbbe4322631fa57f72af23009babcb26
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> package/dmalloc/dmalloc.mk | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/package/dmalloc/dmalloc.mk b/package/dmalloc/dmalloc.mk
> index 81ac467277..f0a05412c1 100644
> --- a/package/dmalloc/dmalloc.mk
> +++ b/package/dmalloc/dmalloc.mk
> @@ -12,7 +12,11 @@ DMALLOC_LICENSE = ISC
> DMALLOC_LICENSE_FILES = LICENSE.txt
>
> DMALLOC_INSTALL_STAGING = YES
> -DMALLOC_CFLAGS = $(TARGET_CFLAGS)
> +# dmalloc must be compiled with no stack protection as it builds its shared
> +# library from its static library through --whole-archive, so forcefully pass
> +# -fno-stack-protector to override what Buildroot may have in TARGET_CFLAGS if
> +# BR2_SSP_* support is enabled.
> +DMALLOC_CFLAGS = $(TARGET_CFLAGS) -fno-stack-protector
At the risk of more goofiness, but the reference build issue had me
notice that dmalloc uses ld to do the link phase, while it should really
call gcc.
Indeed, I think the issue really is that -lssp (or the like) is missing
in the link command.
We have some very old, legacy, unexpained code that been there since the
dawn of times, that tweaks dmalloc's configure to shoehorn the cross-ld:
$(SED) 's/(ld -/($${LD-ld} -/' $(@D)/configure
$(SED) 's/'\''ld -/"$${LD-ld}"'\'' -/' $(@D)/configure
This should be converted over to use gcc, which would then properly pull
in the libraries needed when SSP is on.
However, this is not going to be trivial -whole-archive is not known to
gcc, so it must be passed as -Wl,-whole-archive.
Furthermore, -Wl,-no-whole-archive must be pased after the static
libdmalloc.a library (as explaiend in the ld manpage).
So, thisis a bit of a bigger change, but I otherwise fdo not think that
disabling SSP is a good idea, especially for a library that deals with
allocating memory...
Regards,
Yann E. MORIN.
> ifeq ($(BR2_STATIC_LIBS),y)
> DMALLOC_CONF_OPTS += --disable-shlib
> --
> 2.35.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-06-12 20:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 21:05 [Buildroot] [PATCH 1/2] package/dmalloc: fix strndup detection Fabrice Fontaine
2022-06-10 21:05 ` [Buildroot] [PATCH 2/2] package/dmalloc: disable stack-protector Fabrice Fontaine
2022-06-12 20:37 ` Yann E. MORIN [this message]
2023-02-08 16:28 ` Yann E. MORIN
2022-06-12 20:23 ` [Buildroot] [PATCH 1/2] package/dmalloc: fix strndup detection Yann E. MORIN
2022-06-19 13:41 ` Peter Korsgaard
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=20220612203729.GM427639@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=fontaine.fabrice@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox