On Wed, Jun 01, 2011 at 05:33:55PM +0200, Richard Henderson wrote: > On 06/01/2011 06:47 AM, cedric.vinc...@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.