public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: GNU C Library <libc-alpha@sourceware.org>
Subject: Changing stack protector initialization
Date: Thu, 27 Oct 2016 14:00:00 -0000	[thread overview]
Message-ID: <00e0fe87-5ea6-83a8-7e26-2b2af7dd0d0b@redhat.com> (raw)

I need a few more pseudo-random bits (32 instead of 16 on 64-bit 
architectures).  I talked to some cryptography people and they told me 
to expand the 16-byte secret by hashing it with SHA-256.

This key expansion has to happen both in ld.so (for the stack protector 
and pointer guard) and libc.so (for the new stuff).  My first attempt 
failed because doing the initialization in ld.so triggers duplication of 
the new guard variables from libc.so in ld.so, and the libc.so variables 
are never initialized.  (This is very confusing to GDB, which does not 
tell you that you have two variables with the same name at different 
addresses.)

I think the best approach is to duplicate the initialization code and 
run it twice, once based on the _dl_random value, and once using 
getauxval (AT_RANDOM).  The other alternative would be to put the values 
computed by rtld into rtld_global or some similar place and use those 
values to initialize the libc.so variables, but this wastes 16 bytes in 
the data segment per process.  (I need to make a copy so that the 
variable access does not go through the GOT.)

Is there another option to implement this?

Thanks,
Florian

             reply	other threads:[~2016-10-27 14:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 14:00 Florian Weimer [this message]
2016-10-27 17:03 ` Carlos O'Donell
2016-10-27 17:55   ` Florian Weimer

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=00e0fe87-5ea6-83a8-7e26-2b2af7dd0d0b@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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.
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).