This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/7065] New: Support building glibc with -fstack-protector or -fstack-protector-all
- From: "nix at esperi dot org dot uk" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 4 Dec 2008 00:38:32 -0000
- Subject: [Bug libc/7065] New: Support building glibc with -fstack-protector or -fstack-protector-all
- Reply-to: sourceware-bugzilla at sourceware dot org
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.