Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 16 May 2017 11:02:09 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: Static PIE with musl and clang

* Paul Sturm <psturm@...putervoice.com> [2017-05-15 14:24:58 -0500]:
> I decided to take a step back and try to make this work first with gcc (7.1) and ld (2.28). Both tools were built statically and musl (1.16+) is also built as a static libc.a. 
> 
> Test program is aslr.c: 
> 
> #include <stdio.h> 
> 
> int main() { 
> printf("%p\n", main); 
> return 0; 
> } 
> 
> gcc aslr.c -fPIE -pie -static-libgcc -Wl,-static -Wl,--no-dynamic-linker 
> 
> ./a.out 
> Segementation fault 

there is no -static passed to the compiler so it cannot possibly
select the right crt file.

you need to patch gcc for static pie support, or pass all the
necessary linker flags manually (including the crt files).

https://github.com/richfelker/musl-cross-make/blob/master/patches/gcc-6.3.0/0010-static-pie-support.diff

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.