public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Nix <nix@esperi.org.uk>
To: libc-alpha@sourceware.org
Cc: fweimer@redhat.com, Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: [PATCH 08/12] De-PLTize __stack_chk_fail internal calls within libc.so.
Date: Mon, 28 Nov 2016 13:25:00 -0000	[thread overview]
Message-ID: <20161128123228.30856-9-nix@esperi.org.uk> (raw)
In-Reply-To: <20161128123228.30856-1-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.
v6: Only do it within the shared library: with __stack_chk_fail_local
    in libc_pic.a now we don't need to worry about calls from inside
    other routines in libc_nonshared.a any more.
v8: Merge #ifdef blocks.

	* sysdeps/generic/symbol-hacks.h (__stack_chk_fail): Add internal
	alias.
---
 sysdeps/generic/symbol-hacks.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index ce576c9..36908b5 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -4,4 +4,8 @@
 asm ("memmove = __GI_memmove");
 asm ("memset = __GI_memset");
 asm ("memcpy = __GI_memcpy");
+
+/* -fstack-protector generates calls to __stack_chk_fail, which need
+   similar adjustments to avoid going through the PLT.  */
+asm ("__stack_chk_fail = __stack_chk_fail_local");
 #endif
-- 
2.10.1.208.gbec66bc

  parent reply	other threads:[~2016-11-28 13:25 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28 12:33 --enable-stack-protector for glibc, v9 Nix
2016-11-28 12:33 ` [PATCH 12/12] Enable -fstack-protector=* when requested by configure Nix
2016-11-28 12:33 ` [PATCH 03/12] Mark all machinery needed in early static-link init as -fno-stack-protector Nix
2016-12-15 14:01   ` Florian Weimer
2016-12-15 14:21     ` Nick Alcock
2016-12-15 14:31       ` Florian Weimer
2016-12-15 14:44         ` Nick Alcock
2016-11-28 12:33 ` [PATCH 06/12] Work even with compilers hacked to enable -fstack-protector by default Nix
2016-11-28 12:33 ` [PATCH 04/12] Compile the entire dynamic linker with -fno-stack-protector Nix
2016-11-28 12:33 ` [PATCH 07/12] Add stack_chk_fail_local to libc.so Nix
2016-11-28 13:25 ` [PATCH 09/12] Link various tests with -fno-stack-protector Nix
2016-12-15 14:43   ` Florian Weimer
2016-12-15 14:54     ` Nix
2016-12-15 15:54       ` Florian Weimer
2016-12-15 15:56         ` Nix
2016-12-15 15:55       ` Nix
2016-11-28 13:25 ` Nix [this message]
2016-12-15 13:56   ` [PATCH 08/12] De-PLTize __stack_chk_fail internal calls within libc.so Florian Weimer
2016-12-15 14:16     ` Nix
2016-12-15 14:21       ` Florian Weimer
2016-12-15 14:29         ` Nix
2016-12-15 14:33           ` Florian Weimer
2016-12-15 14:40             ` Nix
2016-12-15 17:24               ` Nix
2016-12-15 18:22                 ` Florian Weimer
2016-12-15 20:00                   ` Nix
2016-12-15 20:22                     ` Florian Weimer
2016-12-15 20:44                       ` Florian Weimer
2016-12-15 20:49                         ` Nix
2016-12-15 20:58                           ` Florian Weimer
2016-12-16 11:39                       ` Florian Weimer
2016-12-16 11:44                         ` Nix
2016-11-28 13:25 ` [PATCH 10/12] Drop explicit stack-protection of pieces of the system Nix
2016-11-28 13:26 ` [PATCH 11/12] Do not stack-protect sigreturn stubs Nix
2016-11-28 13:26 ` [PATCH 01/12] Initialize the stack guard earlier when linking statically Nix
2016-11-28 13:26 ` [PATCH 02/12] Do not stack-protect ifunc resolvers Nix
2016-12-15 12:18   ` Florian Weimer
2016-12-15 12:34     ` Nick Alcock
2016-12-15 12:58       ` Florian Weimer
2016-11-28 13:26 ` [PATCH 05/12] Prevent the rtld mapfile computation from dragging in __stack_chk_fail* 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=20161128123228.30856-9-nix@esperi.org.uk \
    --to=nix@esperi.org.uk \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --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).