From: Nix <nix@esperi.org.uk>
To: libc-alpha@sourceware.org
Subject: [PATCH 11/18] De-PLTize __stack_chk_fail internal calls within libc.so.
Date: Tue, 08 Mar 2016 13:53:00 -0000 [thread overview]
Message-ID: <1457445064-7107-12-git-send-email-nix@esperi.org.uk> (raw)
In-Reply-To: <1457445064-7107-1-git-send-email-nix@esperi.org.uk>
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
We use the same assembler-macro trick we use to de-PLTize
compiler-generated libcalls to memcpy and memset to redirect
__stack_chk_fail to __stack_chk_fail_local.
v5: New.
* sysdeps/generic/symbol-hacks.h (__stack_chk_fail): Add internal
alias.
---
sysdeps/generic/symbol-hacks.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index ce576c9..9d3662f 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -5,3 +5,9 @@ asm ("memmove = __GI_memmove");
asm ("memset = __GI_memset");
asm ("memcpy = __GI_memcpy");
#endif
+
+/* -fstack-protector generates calls to __stack_chk_fail, which need
+ similar adjustments to avoid going through the PLT. */
+#if !defined __ASSEMBLER__ && IS_IN (libc)
+asm ("__stack_chk_fail = __stack_chk_fail_local");
+#endif
--
2.7.0.198.g6dd47b6
next prev parent reply other threads:[~2016-03-08 13:53 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 13:51 --enable-stack-protector for glibc, v5 Nix
2016-03-08 13:51 ` [PATCH 03/18] Do not stack-protect ifunc resolvers Nix
2016-03-09 22:40 ` Mike Frysinger
2016-03-09 23:33 ` Nix
2016-03-10 0:23 ` Joseph Myers
2016-03-09 22:47 ` Mike Frysinger
2016-03-09 23:48 ` Nix
2016-03-10 2:24 ` Mike Frysinger
2016-03-08 13:51 ` [PATCH 02/18] Initialize the stack guard earlier when linking statically Nix
2016-03-09 22:38 ` Mike Frysinger
2016-03-09 22:47 ` Nix
2016-03-08 13:51 ` [PATCH 01/18] Configury support for --enable-stack-protector Nix
2016-03-09 22:37 ` Mike Frysinger
2016-03-09 23:29 ` Nix
2016-03-10 1:02 ` Nix
2016-03-08 13:53 ` [PATCH 18/18] Enable -fstack-protector=* when requested by configure Nix
2016-03-08 13:53 ` Nix [this message]
2016-03-08 13:53 ` [PATCH 13/18] Prohibit stack-protection if the compiler is not capable Nix
2016-03-08 13:54 ` [PATCH 06/18] Allow overriding of CFLAGS as well as CPPFLAGS for rtld Nix
2016-03-08 13:54 ` [PATCH 08/18] Prevent the rtld mapfile computation from dragging in __stack_chk_fail Nix
2016-03-08 13:54 ` [PATCH 14/18] Drop explicit stack-protection of pieces of the system Nix
2016-03-08 13:54 ` [PATCH 07/18] Compile the entire dynamic linker with -fno-stack-protector Nix
2016-03-08 13:54 ` [PATCH 16/18] sparc: do not stack-protect the sigreturn handler Nix
2016-03-08 13:55 ` [PATCH 05/18] Open-code the memcpy() at static TLS initialization time Nix
2016-03-09 22:43 ` Mike Frysinger
2016-03-10 1:01 ` Nix
2016-03-10 2:29 ` Mike Frysinger
2016-03-10 3:02 ` Adhemerval Zanella
2016-03-10 10:20 ` Nix
2016-03-10 10:29 ` Nix
2016-03-10 15:14 ` Nix
2016-03-08 13:55 ` [PATCH 12/18] Link various tests with -fno-stack-protector Nix
2016-03-08 13:55 ` [PATCH 17/18] x86, pthread_cond_*wait: Do not depend on %eax not being clobbered Nix
2016-03-10 13:03 ` Florian Weimer
2016-03-08 13:55 ` [PATCH 04/18] Mark all machinery needed in early static-link init as -fno-stack-protector Nix
2016-03-08 13:55 ` [PATCH 10/18] Link libc.so with libc_nonshared.a to pull in __stack_chk_fail_local Nix
2016-03-08 14:48 ` Andreas Schwab
2016-03-08 21:51 ` Nix
2016-03-09 8:13 ` Andreas Schwab
2016-03-09 16:00 ` Nix
2016-03-08 13:55 ` [PATCH 15/18] Avoid stack-protecting signal-handling functions sibcalled from assembly Nix
2016-03-08 13:56 ` [PATCH 09/18] Work even with compilers hacked to enable -fstack-protector by default Nix
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=1457445064-7107-12-git-send-email-nix@esperi.org.uk \
--to=nix@esperi.org.uk \
--cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).