public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* --enable-stack-protector for glibc, v10
@ 2016-12-19 11:15 Nix
  2016-12-19 11:15 ` [PATCH 06/15] Prevent the rtld mapfile computation from dragging in __stack_chk_fail* Nix
                   ` (17 more replies)
  0 siblings, 18 replies; 35+ messages in thread
From: Nix @ 2016-12-19 11:15 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer

Here, as promised, is version 10 of the stack-protected glibc patch,
incorporating all review comments to date (unless I missed some).

Like the last, it's against glibc head as of Sat Nov 26, bf469f0ce98.

Tested with these flag combinations on {i686,x86_64)-pc-linux-gnu (with GCC
6.2.1-20161118, binutils 2.27.0.20160920, and kernel headers for v4.7.4):

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

(The only skipped tests were the AVX math tests, since the test machine is not
AVX-capable.)

Tested with with these flag combinations on sparc{32,64}-pc-linux-gnu (with GCC
4.9.1-20140922 (a bit old, sorry), binutils 2.24, and kernel headers for
v4.1.12):

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

Tested with these flag combinations on armv7l-unknown-linux-gnueabihf (with GCC
4.8.5-2ubuntu1~14.04.1 (so -strong isn't available), binutils 2.24, and kernel
headers for v3.13.11):

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

No failures are observed that are not also observed on an unpatched glibc with
the same flag combinations, saving only the usual intermittent localedata/wcs*
tests, an intermittent failure of the assertion in stdlib/tst-makecontext on
sparc32, and a consistent failure of posix/tst-spawn2: but these are mostly
likely spurious, other than posix/tst-spawn2, but I would completely believe
that a buffer overrun there is not spurious at all. The makecontext assertion
seems likely to depend on the behaviour of the installed libgcc_s.so...)

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 8 is
in Adhemerval's name, but obviously there's no assignment problem there either.)

Overview of changes in this posting:

 - Add back patch #1 in the series, the configury changes, accidentally dropped
   in the previous posting: whoops!

 - Revamp the __stack_chk_fail PLT-avoidance machinery to use strong_alias, like
   everything else: much thanks to Florian, who noticed that the hack I was
   using was problematic and provided tireless guidance in getting it fixed;
   debug/libc-stack_chk_fail_local.c is gone; there is not very much left of
   Adhemerval's original patch, but I'm leaving his name on it because it seems
   presumptuous to remove it; there are no __stack_chk_fail PLT bypasses on any
   platforms I have access to any more

 - As part of this, #define STACK_PROTECTOR_LEVEL=0 in non-stack-protected files
   within an otherwise stack-protected glibc, and when glibc is not
   stack-protected at all.

 - Explicitly pass -fno-stack-protector when glibc is not compiled with
   --enable-stack-protector: this prevents compiler-inserted __stack_chk_fails
   from being generated when glibc is not set up for PLT-bypassing them (will
   need tiny revisions if --enable-stack-protector becomes the default, but that
   time is not yet)

 - Drop some more libc_cv_predef_stack_protector checks that landed since my
   last series

 - Several tests were declaring that they needed to be compiled with
   $(no-stack-protector) when this is no longer true

 - Move the tests that were in csu/ (most of which were barely related to the
   code in csu/) into misc/ instead, so the -fno-stack-protection applied to the
   static-libc csu code does not cover the tests as well

 - Compile two PIE tests (tst-quad[12]pie.c) with -fPIE, since they are being
   linked with it and when stack-protection is enabled they suddenly contain
   external symbol references for the first time, which will result in the wrong
   relocation if the compiler does not know PIE is in use

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

end of thread, other threads:[~2016-12-22 22:41 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 11:15 --enable-stack-protector for glibc, v10 Nix
2016-12-19 11:15 ` [PATCH 06/15] Prevent the rtld mapfile computation from dragging in __stack_chk_fail* Nix
2016-12-19 11:15 ` [PATCH 08/15] Add a hidden __stack_chk_fail_local alias to libc.so Nix
2016-12-19 11:15 ` [PATCH 04/15] Mark all machinery needed in early static-link init as -fno-stack-protector Nix
2016-12-21 14:18   ` Florian Weimer
2016-12-19 11:25 ` [PATCH 10/15] Link a non-libc-using test with -fno-stack-protector Nix
2016-12-19 11:25 ` [PATCH 11/15] Drop explicit stack-protection of pieces of the system Nix
2016-12-19 11:25 ` [PATCH 14/15] tst-quad1pie, tst-quad2pie: compile with -fPIE Nix
2016-12-21 13:36   ` Florian Weimer
2016-12-19 11:25 ` [PATCH 09/15] De-PLTize __stack_chk_fail internal calls within libc.so Nix
2016-12-21 15:05   ` Florian Weimer
2016-12-22 22:41     ` Nix
2016-12-19 11:25 ` [PATCH 15/15] Enable -fstack-protector=* when requested by configure Nix
2016-12-19 11:26 ` [PATCH 13/15] Move all tests out of csu Nix
2016-12-21 13:36   ` Florian Weimer
2016-12-19 11:26 ` [PATCH 01/15] Configury support for --enable-stack-protector Nix
2016-12-19 11:26 ` [PATCH 05/15] Compile the entire dynamic linker with -fno-stack-protector Nix
2016-12-21 14:18   ` Florian Weimer
2016-12-21 14:25     ` Szabolcs Nagy
2016-12-21 14:57       ` Florian Weimer
2016-12-19 11:26 ` [PATCH 02/15] Initialize the stack guard earlier when linking statically Nix
2016-12-21 14:16   ` Florian Weimer
2016-12-21 20:15     ` Florian Weimer
2016-12-22 22:38       ` Nix
2016-12-19 11:26 ` [PATCH 12/15] Do not stack-protect sigreturn stubs Nix
2016-12-19 11:27 ` [PATCH 07/15] Work even with compilers hacked to enable -fstack-protector by default Nix
2016-12-19 11:27 ` [PATCH 03/15] Do not stack-protect ifunc resolvers Nix
2016-12-21 14:17   ` Florian Weimer
2016-12-22 22:40     ` Nix
2016-12-19 15:15 ` --enable-stack-protector for glibc, v10 Florian Weimer
2016-12-19 15:18   ` Chris Metcalf
2016-12-19 15:54   ` Nix
2016-12-20  8:30 ` Florian Weimer
2016-12-20 19:04   ` Nix
2016-12-21 17:26 ` 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).