public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* --enable-stack-protector for glibc, v6
@ 2016-03-13 15:17 Nix
  2016-03-13 15:17 ` [PATCH 01/17 v6] Configury support for --enable-stack-protector Nix
                   ` (17 more replies)
  0 siblings, 18 replies; 46+ messages in thread
From: Nix @ 2016-03-13 15:17 UTC (permalink / raw)
  To: libc-alpha

This is version 6 of the stack-protected glibc patch, incorporating all review
comments to date (unless I missed some).

It's not rebased and is still against glibc head as of a few weeks ago,
a5df3210a641c17.

Tested with these flag combinations on {i686,x86_64)-pc-linux-gnu:

--enable-omitfp --enable-stack-protector=all
--enable-stack-protector
--enable-stack-protector=strong
--enable-stack-protector=all
--enable-stackguard-randomization --enable-stack-protector=all
--enable-omitfp --enable-stackguard-randomization --enable-stack-protector
--enable-omitfp --enable-stackguard-randomization --enable-stack-protector=strong
--enable-omitfp --enable-stackguard-randomization --enable-stack-protector=all
--disable-stack-protector
--enable-stack-protector=no

Tested with with these flag combinations on sparc{32,64}-pc-linux-gnu:

--enable-stack-protector
--enable-stack-protector=strong
--enable-stackguard-randomization --enable-stack-protector=strong
--enable-stackguard-randomization --enable-stack-protector=all
--disable-stack-protector

Tested with these flag combinations on armv7l-unknown-linux-gnueabihf (it
happened to have GCC 4.8, so -strong wasn't available):

--enable-stackguard-randomization --enable-stack-protector
--enable-stackguard-randomization --enable-stack-protector=all --enable-omitfp
--disable-stack-protector

No failures are observed that are not also observed on an unpatched glibc with
the same flag combinations.

On the copyright assignment front, I am informed that Oracle has a blanket
assignment on file for glibc work, so I don't need to do anything. (Patch 11 is
in Adhemerval's name, but obviously there's no assignment problem there either.)

The only remaining question I really have is what to do instead of patch 13,
which I really do expect to be rejected.  Another configure argument to set the
stack-protection level of externally-facing components, perhaps, or simply a
wiring-in that if --enable-stack-protector is not passed, that -fstack-protector
is passed in for these external components anyway?  What I do think is that the
level set via --enable-stack-protector should be a minimum: that libresolv, nscd
et al should never be protected *less* than libc.so and the rest are.  Patch 13
was a nice simple way to do that, but it is probably *too* simple...

Overview of changes in this posting:

 - Quoting and shell-portability-sanity fixes in configure.ac
   [Review comments from Mike Frysinger and Andreas Schwab.]

 - No longer bother checking for __attribute__((__optimize__)): it is supported
   on all GCC versions we support, and -fno-stack-protector has worked in
   __attribute__((__optimize__)) for longer than that as well.
   [Review comment from Mike Frysinger.]

 - Only open-code the memcpy() in statically-linked TLS initialization if stack
   protection is in use and we don't have an arch-specific inline asm
   implementation that we can fall back on (as x86-32 does, and no-one else).
   [Review comment from Mike Frysinger.]

 - Move IREL application in static binaries up above the TCB initialization:
   this puts it back in its old relative position with respect to all that
   machinery, so you can call ifunced things like memcpy() when initializing
   the TLS -- as long as stack-protection is disabled, since we don't stack-
   protect memcpy().  (The only difference between the old and new static
   startup paths is now that the TLS and stack-protector canary are set up
   before the oscheck hook is called rather than afterwards.)
   (Needed for the above.)

 - Rather than linking libc_nonshared.a to libc.so in order to get
   __stack_chk_fail_local, compile a new debug/libc-stack_chk_fail_local.c as
   shared-only and link it in, which also means that we don't need to redirect
   __stack_chk_fail -> stack_chk_fail_local in the static libcs.  Consider
   __stack_chk_fail_local to be as ignorable as __stack_chk_fail when figuring
   out what symbols are needed by rtld.
   [Review comment from Andreas Schwab.]

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2016-05-16  9:16 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-13 15:17 --enable-stack-protector for glibc, v6 Nix
2016-03-13 15:17 ` [PATCH 01/17 v6] Configury support for --enable-stack-protector Nix
2016-04-10  3:58   ` Mike Frysinger
2016-04-10 11:26     ` Nix
2016-04-10 14:33       ` Mike Frysinger
2016-03-13 15:17 ` [PATCH 17/17 v5] Enable -fstack-protector=* when requested by configure Nix
2016-03-13 15:17 ` [PATCH 02/17 v6] Initialize the stack guard earlier when linking statically Nix
2016-03-13 15:17 ` [PATCH 11/17 v6] De-PLTize __stack_chk_fail internal calls within libc.so Nix
2016-03-13 15:17 ` [PATCH 03/17 v6] Do not stack-protect ifunc resolvers Nix
2016-04-10  3:59   ` Mike Frysinger
2016-03-13 15:18 ` [PATCH 14/17 v5] Avoid stack-protecting signal-handling functions sibcalled from assembly Nix
2016-05-13  9:54   ` Florian Weimer
2016-05-13 14:38     ` Nix
2016-05-15  9:50     ` Nix
2016-05-15 10:35       ` Andreas Schwab
2016-05-15 15:18         ` Nix
2016-05-15 15:49           ` Andreas Schwab
2016-05-16  9:00             ` Florian Weimer
2016-05-16  9:16               ` Andreas Schwab
2016-05-15 10:39       ` Nix
2016-03-13 15:18 ` [PATCH 07/17 v3] Compile the entire dynamic linker with -fno-stack-protector Nix
2016-03-13 15:18 ` [PATCH 13/17] Drop explicit stack-protection of pieces of the system Nix
2016-04-04 22:47   ` Roland McGrath
2016-05-13  9:49     ` Florian Weimer
2016-03-13 15:18 ` [PATCH 15/17 v4] sparc: do not stack-protect the sigreturn handler Nix
2016-05-13  9:55   ` Florian Weimer
2016-03-13 15:18 ` [PATCH 06/17] Allow overriding of CFLAGS as well as CPPFLAGS for rtld Nix
2016-04-04 22:44   ` Roland McGrath
2016-04-10  3:53   ` Mike Frysinger
2016-03-13 15:19 ` [PATCH 05/17 v6] Open-code the memcpy() at static TLS initialization time Nix
2016-03-13 15:19 ` [PATCH 10/17 v6] Add stack_chk_fail_local to libc.so Nix
2016-03-13 15:19 ` [PATCH 12/17 v3] Link various tests with -fno-stack-protector Nix
2016-03-13 15:19 ` [PATCH 08/17 v6] Prevent the rtld mapfile computation from dragging in __stack_chk_fail* Nix
2016-03-13 15:19 ` [PATCH 16/17 v5] x86, pthread_cond_*wait: Do not depend on %eax not being clobbered Nix
2016-03-14 20:01   ` Florian Weimer
2016-03-14 23:36     ` Nix
2016-03-23 15:02       ` Florian Weimer
2016-04-04 22:09         ` Nix
2016-03-13 15:20 ` [PATCH 04/17 v5] Mark all machinery needed in early static-link init as -fno-stack-protector Nix
2016-04-10  4:02   ` Mike Frysinger
2016-04-10 11:27     ` Nix
2016-05-15 10:01       ` Nix
2016-03-13 15:20 ` [PATCH 09/17 v6] Work even with compilers hacked to enable -fstack-protector by default Nix
2016-04-10  4:04   ` Mike Frysinger
2016-03-18 11:48 ` --enable-stack-protector for glibc, v6 Nix
2016-05-13 12:10   ` Florian Weimer

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).