From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSOC2-00037e-AQ for qemu-devel@nongnu.org; Fri, 03 Jun 2011 02:49:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QSOC1-0004m3-3n for qemu-devel@nongnu.org; Fri, 03 Jun 2011 02:49:14 -0400 Received: from eu1sys200aog120.obsmtp.com ([207.126.144.149]:42835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QSOC0-0004lT-RL for qemu-devel@nongnu.org; Fri, 03 Jun 2011 02:49:13 -0400 Date: Fri, 3 Jun 2011 08:46:19 +0200 From: Message-ID: <20110603064619.GA7025@gnx2503> References: <1306928551-31723-1-git-send-email-cedric.vincent@st.com> <4DE63DF1.60709@twiddle.net> <20110601134734.GA10150@gnx2503> <4DE65BE3.1040004@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4DE65BE3.1040004@twiddle.net> Subject: Re: [Qemu-devel] [PATCH] linux-user: Define AT_RANDOM to support target dynamic linkers that do ASLR List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Laurent ALFONSI , Riku Voipio , "qemu-devel@nongnu.org" 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.