mailing list of musl libc
 help / color / mirror / code / Atom feed
* SSP and PIE support in musl
@ 2012-05-04  1:18 Rich Felker
  0 siblings, 0 replies; only message in thread
From: Rich Felker @ 2012-05-04  1:18 UTC (permalink / raw)
  To: musl

Hi all,
I've committed real SSP support (i.e. it really sets up a canary
rather than letting whatever data happens to be at a certain point in
the thread structure act as a canary) and PIE support in musl. The
overhead is zero for static linked programs that don't use it and
minimal (just some dead code) for the shared library if SSP is not in
use (no runtime size or performance cost).

These features should make musl a lot more appealing to
security-oriented distributions and applications and should not impact
users who are not using them.

Note that PIE requires the main executable to be fully PIC; textrels
are not supported. This means you cannot pull in any .a libs that were
not built with -fPIC and expect it to work; you have to use PIC .a
files or shared libraries. In theory, if all your .a files are built
PIC, you can have everything (including libc) static linked into the
PIE executable but it will still need ld-musl to relocate it at
runtime. If there's interest in support for textrels, I may add it,
but it would still not be possible on x86_64 (where the linker refuses
to even generate textrels).

It may also be possible (not sure yet) to generate fully static linked
PIE executables which do not require a dynamic linker at all (no
PT_INTERP header), by including a simplified version of the dynamic
linker (relative relocs only) in the main program binary (called from
the start code) and linking with -Bsymbolic. As far as I know, this
has never been done before, but it seems possible and definitely is
the sort of thing musl likes to tackle...

Rich


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-04  1:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04  1:18 SSP and PIE support in musl Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).