Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1721822yba; Thu, 9 May 2019 23:16:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZj5ffspQgl1oO+/UoJ0nvTkxpRugscwpMhHhY7RoJsWYXNXlpr8KygGmVmuOGRZVaB+z4 X-Received: by 2002:a65:6449:: with SMTP id s9mr11148017pgv.90.1557469004074; Thu, 09 May 2019 23:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557469004; cv=none; d=google.com; s=arc-20160816; b=lmCvOCF4Rek5KMBznLtDgavFLx8CVDOEj3Kt1BfPrwwdEaNv6aPDZnnZMnccqSUJM+ arLe75ZyEnHW958ruu88SK1+awffM0lKKzelkRyi8sqM926f7qLo7eRdGno/yRTw86RO L3JO1prjMLRYbmcJIVb5fC0pFiXUv07AaeY95ipggp/Py7/4R4NAqJYnAwkaV31V0Tz3 /YzXAZWUYxmZpwRVjLkp7yS+OyaMjS+PSrYV/gfNlVy87qa1u8+/ZoT+JWQbbpWhN2P3 ZbayC96koBTGHhO2ilakIrllnavn6SVpVyPSmkmgCcI1Piw9bR1UWGMrgKQAK/9/MM4u 1xRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=wcoCn9aET8ENDUMb5kZFQY4rPTMs5oVxV7wArQjOIBo=; b=FOdxiYfCbm04VX51NSBbOcoSx0uoV9EnLQGOAdNQLNCzwXkxtcb4Z9yw58GFbzEhbB x8x2EwEZfTE9nCSXAjTsY/29cpeQOamgTWN9sUSp5kPBndeTly5Ll+ypz6jBm0RniODb SnDvhh4XAbv7m6EVblFAu9XGGx5WxwwGDOJTLK72Dsj8+W4nd+vI3htSJlcaaDLW62LI 5ky3j4DfQc5iFx0KpHj3/x8LhTWQXt4CkMDi2qFRSTe11FauGApE1SObUaclOyDamKNm jKiRrN4mGGNMA0vJzBAP4kCHaMwam1BQoPniT/oegu9GKf/MdrLWYCysfKXnkZi0eTX7 xwOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=OBoy5jFw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v65si7226502pfb.77.2019.05.09.23.16.27; Thu, 09 May 2019 23:16:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=OBoy5jFw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbfEJGOG (ORCPT + 99 others); Fri, 10 May 2019 02:14:06 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:36671 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbfEJGOF (ORCPT ); Fri, 10 May 2019 02:14:05 -0400 Received: by mail-lf1-f66.google.com with SMTP id y10so3284037lfl.3 for ; Thu, 09 May 2019 23:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wcoCn9aET8ENDUMb5kZFQY4rPTMs5oVxV7wArQjOIBo=; b=OBoy5jFwq7rwO6rQvfRJjzjUxv5hh15DMppI5VJRgrtBPPvNHy3xN3DS9UhKYbdjg2 x4th2Lp7uXVK/Q+3WelH6KnB3Xzx5iDF0au91UTqihiFLCAIk9+ctrLUnNOF6paggLUR iehK957Lt3Jw4wMEOGI1tIRKyCMykJlJy6Hug= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wcoCn9aET8ENDUMb5kZFQY4rPTMs5oVxV7wArQjOIBo=; b=pFOOi3mhbNoUSawlVGyRd870cXJtb63o543rXPd/KMto17+9F4lPvsFPHy7WSEXZ3R ztSjIqiFHWSHQYiVrr5h2m4x12ThzBgl2YNr3FAyTPRcm4TKZ2IFNX4KDc1kTEHOSVPw OfVvBudfkLFfwBGhb69Pnzg+BowcPrS1lXCeARBpsWTIIippgTgt9cUv3iDlqEHh+Fg/ Q9P9EnzsthEUcOtr1XqrAXonoRDuUWne/fnaY8TmiZmAETRV2kTPJM2a1b1AeXAVpFuy bRRo7F6hvo6RGT6Ae/y+Xty65pbIm6Zd85JJNicAaLfvXqY5KWjNbKms9bAPXzyRdspI Lt+w== X-Gm-Message-State: APjAAAWRA9YAuualRe3ut6of2OpTw3pXVJjLpe1dATI75oUfyyEhM6pM 2lILIdwC/8wT8Iz2/1ukM3nIiw== X-Received: by 2002:ac2:43cf:: with SMTP id u15mr4755854lfl.67.1557468843494; Thu, 09 May 2019 23:14:03 -0700 (PDT) Received: from [172.16.11.26] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id f4sm1025869ljm.80.2019.05.09.23.14.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 23:14:02 -0700 (PDT) Subject: Re: [PATCH] arm64: add support for rng-seed To: Hsin-Yi Wang , Rob Herring Cc: "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Mark Rutland , Catalin Marinas , Will Deacon , Frank Rowand , Andrew Morton , Mike Rapoport , Michal Hocko , Ard Biesheuvel , James Morse , Andrew Murray , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Stephen Boyd , Architecture Mailman List , Kees Cook References: <20190507045433.542-1-hsinyi@chromium.org> From: Rasmus Villemoes Message-ID: <36fab640-b98e-9781-f96f-0ed988a71077@rasmusvillemoes.dk> Date: Fri, 10 May 2019 08:14:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/05/2019 10.00, Hsin-Yi Wang wrote: >>>> Why do you need to clear it? That wasn't necessary for kaslr-seed. >>> I think it's for security purpose. If we know the random seed, it's >>> more likely we can predict randomness. >>> Currently on arm64, kaslr-seed will be wiped out (in >>> arch/arm64/kernel/kaslr.c#get_kaslr_seed(), it's set to 0) so we can't >>> read from sysfs (eg. /sys/firmware/devicetree/.../kaslr-seed) >>> I'm not sure on other arch if it will be wiped out. >> >> The difference is if I have the kaslr seed, I can calculate the kernel >> base address. >> >> In your case, you are feeding an RNG which continually has entropy >> added to it. I can't see that knowing one piece of the entropy data is >> a security hole. It looks more like you've just copied what what done >> for kaslr-seed. > +Kees who can probably explain this better. > > This early added entropy is also going to be used for stack canary. At > the time it's created there's not be much entropy (before > boot_init_stack_canary(), there's only add_latent_entropy() and > command_line). So, why not just have the bootloader add whatever entropy it has via the commandline, which already gets mixed in? That requires no kernel changes, and works for all architectures. If anything, perhaps instead of just adding gobbledygook=abc123, make an official command line parameter (there was talk about this at some point), and have the kernel overwrite the value with xxx so it's not visible in /proc/cmdline. Rasmus