mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Anthony G. Basile" <basile@opensource.dyc.edu>
To: musl@lists.openwall.com
Subject: Re: fixing -fPIE + -fstack-protector-all
Date: Fri, 07 Nov 2014 07:25:31 -0500	[thread overview]
Message-ID: <545CBA3B.3000604@opensource.dyc.edu> (raw)
In-Reply-To: <545B6B36.6060806@barfooze.de>

On 11/06/14 07:36, John Spencer wrote:
> Anthony G. Basile wrote:
>> On 11/05/14 10:43, Rich Felker wrote:
>>> However, this proposed solution breaks one odd corner case: static
>>> linking when all the source files were compiled with -fPIC or -fPIE.
>>> In that case, there would be no references to __stack_chk_fail, only
>>> to __stack_chk_fail_local, and thereby __init_ssp would not get
>>> linked, and a zero canary would be used.
>>
>> I would rather not see this solution.
>>
>
> why ?

I want to save that corner case.  In gentoo we compile everything 
pic/pie, even our executables:

# readelf -h /bin/bash  | grep Type:
   Type:                              DYN (Shared object file)

This randomizes even the address of main.  The following

#include <stdio.h>
int main() {
   printf("%p\n", main);
}

yields

0x61f64b845
0x33fa0b7845
0x189ab51845
0x58531cd845

on successive runs when compiled with our default gcc specs.  Along with 
PaX's enhenced aslr this helps against brute forcing addresses.  Compare 
to when I turn off pie:

0x400605
0x400605
0x400605

Having said that, currently we do not support *static* pic/pie in 
Gentoo, but I would really like to, especially with musl.  Also, I'm not 
as worried about the GOT for reasons I stated elsewhere.


-- 
Anthony G. Basile, Ph. D.
Chair of Information Technology
D'Youville College
Buffalo, NY 14201
(716) 829-8197


  reply	other threads:[~2014-11-07 12:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 15:25 John Spencer
2014-11-05 15:43 ` Rich Felker
2014-11-05 16:01   ` John Spencer
2014-11-05 16:20     ` Rich Felker
2014-11-06  1:34   ` Andy Lutomirski
2014-11-06  1:44     ` Rich Felker
2014-11-06 11:45   ` Anthony G. Basile
2014-11-06 12:36     ` John Spencer
2014-11-07 12:25       ` Anthony G. Basile [this message]
2014-11-07  2:10     ` Andy Lutomirski
2014-11-07 12:16       ` Anthony G. Basile
2014-11-05 16:01 ` Timo Teras
2014-11-06 12:11   ` Anthony G. Basile
2014-11-06 15:43     ` Rich Felker
2014-11-06 12:40   ` John Spencer
2014-11-06 12:47     ` Timo Teras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545CBA3B.3000604@opensource.dyc.edu \
    --to=basile@opensource.dyc.edu \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).