mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 4/6] sandbox: compile with symbol -fvisibility=hidden
Date: Tue, 27 Aug 2019 16:32:37 +0200	[thread overview]
Message-ID: <20190827143239.15682-5-ahmad@a3f.at> (raw)
In-Reply-To: <20190827143239.15682-1-ahmad@a3f.at>

barebox defines many symbols that are reserved for the C implementation.
This collides with the libc, when building barebox for ARCH=sandbox.

Specify -fvsibility-hidden, so libraries barebox is linked against don't
inadvertently use barebox' functions.

This fixes a heap corruption occurring when issuing fb0.enable=1 on my
system, because X11 used strdup out of barebox, but free out of glibc[1]:

     binding file /lib/x86_64-linux-gnu/libX11.so.6 [0] to
     ./barebox [0]: normal symbol l `strdup' [GLIBC_2.2.5]
     [...]
     binding file /lib/x86_64-linux-gnu/libc.so.6 [0] to
     /lib/x86_64-linux-gnu/libc.so.6 [0]: normal symbol `free' [GLIBC_2.2.5]

[1]: cf. CFLAGS +=-Dfree=barebox_free in arch/sandbox/Makefile

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/sandbox/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index 2a75b81cf632..780783a1e08c 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -1,6 +1,7 @@
 KBUILD_DEFCONFIG := sandbox_defconfig
 
-CPPFLAGS += -D__SANDBOX__ -fno-strict-aliasing
+CPPFLAGS += -D__SANDBOX__ -fno-strict-aliasing -fvisibility=hidden
+
 
 machine-y := sandbox
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-08-27 14:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 14:32 [PATCH 0/6] sandbox: add HWRNG driver for host /dev/random Ahmad Fatoum
2019-08-27 14:32 ` [PATCH 1/6] sandbox: include header to provide missing prototype Ahmad Fatoum
2019-08-27 14:32 ` [PATCH 2/6] sandbox: remove unused ARCH_LINUX Kconfig symbol Ahmad Fatoum
2019-08-27 14:32 ` [PATCH 3/6] sandbox: redefine optarg and optind to avoid collisions Ahmad Fatoum
2019-08-27 14:32 ` Ahmad Fatoum [this message]
2019-08-27 14:32 ` [PATCH 5/6] sandbox: hostfile: allow probing from device tree Ahmad Fatoum
2019-08-28 11:49   ` Sascha Hauer
2019-08-28 12:06     ` Ahmad Fatoum
2019-08-27 14:32 ` [PATCH 6/6] hwrng: add sandbox driver interface to host /dev/random Ahmad Fatoum

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=20190827143239.15682-5-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.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