From: Richard Henderson <rth@twiddle.net>
To: cedric.vincent@st.com,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Laurent ALFONSI <Laurent.ALFONSI@st.com>,
Riku Voipio <riku.voipio@iki.fi>
Subject: Re: [Qemu-devel] [PATCH] linux-user: Define AT_RANDOM to support target dynamic linkers that do ASLR
Date: Wed, 01 Jun 2011 08:33:55 -0700 [thread overview]
Message-ID: <4DE65BE3.1040004@twiddle.net> (raw)
In-Reply-To: <20110601134734.GA10150@gnx2503>
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);
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.
r~
next prev parent reply other threads:[~2011-06-01 15:34 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 ` Richard Henderson [this message]
2011-06-03 6:46 ` [Qemu-devel] [PATCH] " cedric.vincent
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=4DE65BE3.1040004@twiddle.net \
--to=rth@twiddle.net \
--cc=Laurent.ALFONSI@st.com \
--cc=cedric.vincent@st.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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).