From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751594AbaBLXzM (ORCPT ); Wed, 12 Feb 2014 18:55:12 -0500 Received: from mail-ve0-f182.google.com ([209.85.128.182]:62374 "EHLO mail-ve0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108AbaBLXzK (ORCPT ); Wed, 12 Feb 2014 18:55:10 -0500 MIME-Version: 1.0 In-Reply-To: <1882539.R1gpoLLYks@wuerfel> References: <1392168805-14200-1-git-send-email-lauraa@codeaurora.org> <1571508.yGAAZ8TNH0@wuerfel> <20140212184521.GO27395@titan.lakedaemon.net> <1882539.R1gpoLLYks@wuerfel> Date: Wed, 12 Feb 2014 17:55:08 -0600 Message-ID: Subject: Re: [RFC/PATCH 0/3] Add devicetree scanning for randomness From: Rob Herring To: Arnd Bergmann Cc: "linux-arm-kernel@lists.infradead.org" , Jason Cooper , "devicetree@vger.kernel.org" , Laura Abbott , Kees Cook , "linux-kernel@vger.kernel.org" , Rob Herring , Kumar Gala , Grant Likely Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 12, 2014 at 1:12 PM, Arnd Bergmann wrote: > On Wednesday 12 February 2014 13:45:21 Jason Cooper wrote: >> On Wed, Feb 12, 2014 at 07:17:41PM +0100, Arnd Bergmann wrote: >> > On Wednesday 12 February 2014 12:45:54 Jason Cooper wrote: >> > > I brought this up at last weeks devicetree irc meeting. My goal is to >> > > provide early randomness for kaslr on ARM. Currently, my idea is modify >> > > the init script to save an additional random seed from /dev/urandom to >> > > /boot/random-seed. >> > > >> > > The bootloader would then load this file into ram, and pass the >> > > address/size to the kernel either via dt, or commandline. kaslr (run in >> > > the decompressor) would consume some of this randomness, and then >> > > random.c would consume the rest in a non-crediting initialization. >> > >> > I like the idea, but wouldn't it be easier to pass actual random data >> > using DT, rather than the address/size? >> >> I thought about that at first, but that requires either that the >> bootloader be upgraded to insert the data, or that userspace is >> modifying the dtb at least twice per boot. >> >> I chose address/size to facilitate modifying existing/fielded devices. >> The user could modify the dtb once, and modify the bootloader >> environment to load X amount to Y address. As a fallback, it could be >> expressed on the commandline for non-DT bootloaders. > > Ah, so you are interested in boot loaders that can be scripted to do > what you had in mind but cannot be scripted to add or modify a DT > property. I hadn't considered that, but you are probably right that > this is at least 90% of the systems you'd find in the wild today. > > Thinking this a bit further, I wonder if (at least upstream) u-boot > has a way to modify DT properties in a scripted way that would allow > the direct property. It sounds like a generally useful feature not > just for randomness, so if that doesn't already work, maybe someone > can implement it. In the simplest case, you'd only need to find the > address of an existing property in the dtb and load a file to > that location. You would be referring to the u-boot fdt command which can read and set properties. Of course, like all u-boot commands, that may or may not be enabled by a vendor's u-boot. :( Rob From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Herring Subject: Re: [RFC/PATCH 0/3] Add devicetree scanning for randomness Date: Wed, 12 Feb 2014 17:55:08 -0600 Message-ID: References: <1392168805-14200-1-git-send-email-lauraa@codeaurora.org> <1571508.yGAAZ8TNH0@wuerfel> <20140212184521.GO27395@titan.lakedaemon.net> <1882539.R1gpoLLYks@wuerfel> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: In-Reply-To: <1882539.R1gpoLLYks@wuerfel> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Arnd Bergmann Cc: "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , Jason Cooper , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Laura Abbott , Kees Cook , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Rob Herring , Kumar Gala , Grant Likely List-Id: devicetree@vger.kernel.org On Wed, Feb 12, 2014 at 1:12 PM, Arnd Bergmann wrote: > On Wednesday 12 February 2014 13:45:21 Jason Cooper wrote: >> On Wed, Feb 12, 2014 at 07:17:41PM +0100, Arnd Bergmann wrote: >> > On Wednesday 12 February 2014 12:45:54 Jason Cooper wrote: >> > > I brought this up at last weeks devicetree irc meeting. My goal is to >> > > provide early randomness for kaslr on ARM. Currently, my idea is modify >> > > the init script to save an additional random seed from /dev/urandom to >> > > /boot/random-seed. >> > > >> > > The bootloader would then load this file into ram, and pass the >> > > address/size to the kernel either via dt, or commandline. kaslr (run in >> > > the decompressor) would consume some of this randomness, and then >> > > random.c would consume the rest in a non-crediting initialization. >> > >> > I like the idea, but wouldn't it be easier to pass actual random data >> > using DT, rather than the address/size? >> >> I thought about that at first, but that requires either that the >> bootloader be upgraded to insert the data, or that userspace is >> modifying the dtb at least twice per boot. >> >> I chose address/size to facilitate modifying existing/fielded devices. >> The user could modify the dtb once, and modify the bootloader >> environment to load X amount to Y address. As a fallback, it could be >> expressed on the commandline for non-DT bootloaders. > > Ah, so you are interested in boot loaders that can be scripted to do > what you had in mind but cannot be scripted to add or modify a DT > property. I hadn't considered that, but you are probably right that > this is at least 90% of the systems you'd find in the wild today. > > Thinking this a bit further, I wonder if (at least upstream) u-boot > has a way to modify DT properties in a scripted way that would allow > the direct property. It sounds like a generally useful feature not > just for randomness, so if that doesn't already work, maybe someone > can implement it. In the simplest case, you'd only need to find the > address of an existing property in the dtb and load a file to > that location. You would be referring to the u-boot fdt command which can read and set properties. Of course, like all u-boot commands, that may or may not be enabled by a vendor's u-boot. :( Rob -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: robherring2@gmail.com (Rob Herring) Date: Wed, 12 Feb 2014 17:55:08 -0600 Subject: [RFC/PATCH 0/3] Add devicetree scanning for randomness In-Reply-To: <1882539.R1gpoLLYks@wuerfel> References: <1392168805-14200-1-git-send-email-lauraa@codeaurora.org> <1571508.yGAAZ8TNH0@wuerfel> <20140212184521.GO27395@titan.lakedaemon.net> <1882539.R1gpoLLYks@wuerfel> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Feb 12, 2014 at 1:12 PM, Arnd Bergmann wrote: > On Wednesday 12 February 2014 13:45:21 Jason Cooper wrote: >> On Wed, Feb 12, 2014 at 07:17:41PM +0100, Arnd Bergmann wrote: >> > On Wednesday 12 February 2014 12:45:54 Jason Cooper wrote: >> > > I brought this up at last weeks devicetree irc meeting. My goal is to >> > > provide early randomness for kaslr on ARM. Currently, my idea is modify >> > > the init script to save an additional random seed from /dev/urandom to >> > > /boot/random-seed. >> > > >> > > The bootloader would then load this file into ram, and pass the >> > > address/size to the kernel either via dt, or commandline. kaslr (run in >> > > the decompressor) would consume some of this randomness, and then >> > > random.c would consume the rest in a non-crediting initialization. >> > >> > I like the idea, but wouldn't it be easier to pass actual random data >> > using DT, rather than the address/size? >> >> I thought about that at first, but that requires either that the >> bootloader be upgraded to insert the data, or that userspace is >> modifying the dtb at least twice per boot. >> >> I chose address/size to facilitate modifying existing/fielded devices. >> The user could modify the dtb once, and modify the bootloader >> environment to load X amount to Y address. As a fallback, it could be >> expressed on the commandline for non-DT bootloaders. > > Ah, so you are interested in boot loaders that can be scripted to do > what you had in mind but cannot be scripted to add or modify a DT > property. I hadn't considered that, but you are probably right that > this is at least 90% of the systems you'd find in the wild today. > > Thinking this a bit further, I wonder if (at least upstream) u-boot > has a way to modify DT properties in a scripted way that would allow > the direct property. It sounds like a generally useful feature not > just for randomness, so if that doesn't already work, maybe someone > can implement it. In the simplest case, you'd only need to find the > address of an existing property in the dtb and load a file to > that location. You would be referring to the u-boot fdt command which can read and set properties. Of course, like all u-boot commands, that may or may not be enabled by a vendor's u-boot. :( Rob