From: <cedric.vincent@st.com>
To: Richard Henderson <rth@twiddle.net>
Cc: Laurent ALFONSI <Laurent.ALFONSI@st.com>,
Riku Voipio <riku.voipio@iki.fi>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] linux-user: Define AT_RANDOM to support target dynamic linkers that do ASLR
Date: Fri, 3 Jun 2011 08:46:19 +0200 [thread overview]
Message-ID: <20110603064619.GA7025@gnx2503> (raw)
In-Reply-To: <4DE65BE3.1040004@twiddle.net>
On Wed, Jun 01, 2011 at 05:33:55PM +0200, Richard Henderson wrote:
> On 06/01/2011 06:47 AM, cedric.vincent@st.com wrote:
> > On Wed, Jun 01, 2011 at 03:26:09PM +0200, Richard Henderson wrote:
> >>
> >> 16 bytes, not 16 bits.
> >
> > You're right it's not 16 bits, it's "sizeof(uintptr_t)" actually:
>
> No, it's not.
>
> unsigned char k_rand_bytes[16];
> elf_addr_t __user *u_rand_bytes;
> ...
> /*
> * Generate 16 random bytes for userspace PRNG seeding.
> */
> get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes));
> u_rand_bytes = (elf_addr_t __user *)
> STACK_ALLOC(p, sizeof(k_rand_bytes));
> if (__copy_to_user(u_rand_bytes, k_rand_bytes, sizeof(k_rand_bytes)))
> return -EFAULT;
> ...
> NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes);
It's clearer to me now, thanks.
> Frankly, it's trivial to do this right in create_elf_tables.
> Grab 16 bytes at SP right at the beginning of the function,
> fill it with whatever random values seem good.
>
> I suggest at minimum a command-line argument to force a
> particular AT_RANDOM value, for repeatability.
OK, I will submit you such a patch soon.
Thanks,
Cédric.
next prev parent reply other threads:[~2011-06-03 6:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 11:42 [Qemu-devel] [PATCH] linux-user: Define AT_RANDOM to support target dynamic linkers that do ASLR Cédric VINCENT
2011-06-01 13:26 ` Richard Henderson
2011-06-01 13:47 ` cedric.vincent
2011-06-01 14:35 ` [Qemu-devel] [PATCH v2] " Cédric VINCENT
2011-06-01 15:33 ` [Qemu-devel] [PATCH] " Richard Henderson
2011-06-03 6:46 ` cedric.vincent [this message]
2011-06-13 12:03 ` Laurent Alfonsi
2011-06-13 15:53 ` Richard Henderson
2011-06-20 6:43 ` [Qemu-devel] [PATCH v3] linux-user: Define AT_RANDOM to support target stack protection mechanism Cédric VINCENT
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=20110603064619.GA7025@gnx2503 \
--to=cedric.vincent@st.com \
--cc=Laurent.ALFONSI@st.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
--cc=rth@twiddle.net \
/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 NNTP newsgroup(s).