public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/7065] New: Support building glibc with -fstack-protector or -fstack-protector-all
@ 2008-12-04  0:39 nix at esperi dot org dot uk
  2008-12-04  0:47 ` [Bug libc/7065] " drepper at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: nix at esperi dot org dot uk @ 2008-12-04  0:39 UTC (permalink / raw)
  To: glibc-bugs

Several distributions, including Gentoo, have patches which attempt to make 
glibc build when compiled with -fstack-protector. None of them that I have 
found actually work: at best, they make it crash instantly, because none of 
them suppress generation of stack guards around functions called before the 
guard is initialized (or even before ld-linux.so.2 has relocated itself).

For now I'd consider it more of a maintenance burden than it's worth to
isolate the parts of ld.so that are called before security_init(), so
I've just arranged to avoid using the stack-protector in ld.so, and
marked the few things not also in the dynamic loader which are used
during pre-guard-init static library initialization with
-fno-stack-protector. (An improvement might be to mark these with
-fno-stack-protector only when building the static library.)

I can't think of a way to isolate the functions in this set automatically, but 
if you get it wrong it's easy to tell because you get an instant coredump, so 
it's easy to prevent the set of -fno-stack-protectored functions from 
bitrotting, manually maintained though it must be.)

You can still use -fstack-protector-all in all the rest of glibc, which
is an order of magnitude more code than ld.so and includes really hairy
stuff like malloc() and lots of functions that themselves call
string-manipulation functions, so I'd say this is a pretty good
tradeoff.

Some of the module tests need adjustment: they don't link against
libc, so must specify -fno-stack-protector; the same is true of some of the 
configury, taking care not to specify that unless GCC is actually capable of 
accepting -fstack-protector. (We specify -lssp and leave the stack protector on 
where possible in configure tests.)

Results of tests and patch against glibc 2.9 following shortly.

-- 
           Summary: Support building glibc with -fstack-protector or -
                    fstack-protector-all
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nix at esperi dot org dot uk
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=7065

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2009-06-04 22:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-04  0:39 [Bug libc/7065] New: Support building glibc with -fstack-protector or -fstack-protector-all nix at esperi dot org dot uk
2008-12-04  0:47 ` [Bug libc/7065] " drepper at redhat dot com
2008-12-04  0:54 ` nix at esperi dot org dot uk
2008-12-04  0:57 ` nix at esperi dot org dot uk
2008-12-05  0:32 ` zorry at ume dot nu
2008-12-10 17:10 ` rsa at us dot ibm dot com
2008-12-10 18:52 ` rsa at us dot ibm dot com
2008-12-13 19:04 ` nix at esperi dot org dot uk
2008-12-14 11:34 ` atoth at atoth dot sote dot hu
2008-12-14 14:01 ` xake at rymdraket dot net
2008-12-27  3:15 ` vapier at gentoo dot org
2009-06-04 22:25 ` robert at linuxfromscratch dot org

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