Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1467812ybv; Thu, 6 Feb 2020 04:42:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzlJCvwxrJx/BTj5bOP0RU+OKD9sKL8BgUlEQpmAATzPnf/GhyVLpX7r5qmH5ihxvNFNinc X-Received: by 2002:a9d:7f11:: with SMTP id j17mr31096483otq.281.1580992942077; Thu, 06 Feb 2020 04:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580992942; cv=none; d=google.com; s=arc-20160816; b=uO8IwJ6l1dLJa2IIoqcQIHvVNKAddRJ8c1Zz/FZqk1ChcCs2H0BshRgu8j45tdLN1R I+0LupeLHvAv1AfZxtyzgP85JsBJxzH5HuRYiV7qoelhKG6KEhKlixK7M4r0Ihz0zIJn WZl6eLaRReiH9f/gaFVZjtyi6xNr03y+IaKqT4keSL814OrYWnSgB9GjokSzUbuGqFSN NWaAkXVJuMvzR4o5PnHx82MWkB7Xyqi+Wti+UTwaHRUJqdzNP/rgFSdkFTKMv5psUeak S42/2WtGgYEyVzQo85D8ViQyGB3/YGcV22+dMvkZayrdVaXw28pd5CPJDGMXEpc04xKd 8DRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tf7UfAXF0+7+R/0CR/EhvROtYInc8epHQipEfshPVGs=; b=dLhzLG7dKVla+NjdGPDraibyZyGutG6c+glKGQyXu9IsIRDNJwt87hN8CowgQprIIv R5VY4lAqRfBm/oJ8rxvpEd/2GIPu+L5EefDwdpfDax4qKHbsqba2/aFY3izxQBes1ZBy lp1lD9DK+7Kz4B255l5DXfCjx4X0PKok9E++oMz7++UCGCkkMQ9wpiXFTvCDLL+occwL iecL83lIbCgHNJK5O6d4jD2+IQfgXUZyu2vYB8nCsTLtzrFVOmFaBw6gArCOBYKSIYWi T/bHAqbQQjZl1sfmt1JDSQYZAR6LhKAuJC+kXFlm9Jzv4/Ms6yA6xkt7nGOdlH+rAFmG vUBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PX6L81YY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l17si1889932otq.59.2020.02.06.04.42.09; Thu, 06 Feb 2020 04:42:22 -0800 (PST) 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=@chromium.org header.s=google header.b=PX6L81YY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727593AbgBFLsE (ORCPT + 99 others); Thu, 6 Feb 2020 06:48:04 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:43159 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726538AbgBFLsE (ORCPT ); Thu, 6 Feb 2020 06:48:04 -0500 Received: by mail-ot1-f65.google.com with SMTP id p8so5153850oth.10 for ; Thu, 06 Feb 2020 03:48:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=tf7UfAXF0+7+R/0CR/EhvROtYInc8epHQipEfshPVGs=; b=PX6L81YYJdfK1dzYbHAtJvW+q7p3T/0pcVLlue5FeG4q7vAYgtvwTOkmic7TMKGuuO +Kv/qr++XIOZZEokHxFHqatEdlf/ZNap1h7uIHw40ejP2uWu7PRmNoRic/wvHYFAd3Zk wKRp8P+VQP4V4FtxKgDx6FYxSI0lZ5z57RMqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=tf7UfAXF0+7+R/0CR/EhvROtYInc8epHQipEfshPVGs=; b=gbKX2IDFUwX0Eb0ND/dXAzEKTOW15thlZVcobNDqngPsqVZG3n5Og8Uz5Em1ubS3Ie kHvdiou+98+Hksxe+V688hwT2nkD6GPjfRKG38+0AT6xPF1O11CjPkbc1wLgsrODLZPD MDcWQSML8lL0ZYLsT8JCJ70C5LOjbPWZ12xCfOz97PGtavsPJ8GrsZAgxWqMAktI8PAo JNGRAjPzEgeoQDtqFe51xFQBr25NijerAIYKqs9/8HrBBapcTHUvU8v5ilt8kbBVA290 JqAIrkDfU4l+Xbo8swhFpk+a42ysq4ixI8BuhLD3xyU5BfCNqfzA7dokSm1F/5bj2Wv5 V57A== X-Gm-Message-State: APjAAAXZ48PzwrQCmnFz8L5/334c/TztWBhdeZl9c7tCC+KJKiiw8xj1 lQhLPCiSq5CW5/rzAYemSoTN4Q== X-Received: by 2002:a9d:5885:: with SMTP id x5mr29462319otg.132.1580989683562; Thu, 06 Feb 2020 03:48:03 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l207sm860711oih.25.2020.02.06.03.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 03:48:02 -0800 (PST) Date: Thu, 6 Feb 2020 03:48:01 -0800 From: Kees Cook To: Andy Lutomirski Cc: Kristen Carlson Accardi , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, arjan@linux.intel.com, rick.p.edgecombe@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [RFC PATCH 03/11] x86/boot: Allow a "silent" kaslr random byte fetch Message-ID: <202002060345.FAF7517CA4@keescook> References: <20200205223950.1212394-4-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 05, 2020 at 05:08:55PM -0800, Andy Lutomirski wrote: > > > > On Feb 5, 2020, at 2:39 PM, Kristen Carlson Accardi wrote: > > > > From: Kees Cook > > > > Under earlyprintk, each RNG call produces a debug report line. When > > shuffling hundreds of functions, this is not useful information (each > > line is identical and tells us nothing new). Instead, allow for a NULL > > "purpose" to suppress the debug reporting. > > Have you counted how many RDRAND calls this causes? RDRAND is > exceedingly slow on all CPUs I’ve looked at. The whole “RDRAND > has great bandwidth” marketing BS actually means that it has decent > bandwidth if all CPUs hammer it at the same time. The latency is abysmal. > I have asked Intel to improve this, but the latency of that request will > be quadrillions of cycles :) In an earlier version of this series, it was called once per function section (so, about 50,000 times). The (lack of) speed was quite measurable. > I would suggest adding a little ChaCha20 DRBG or similar to the KASLR > environment instead. What crypto primitives are available there? Agreed. The simple PRNG in the next patch was most just a POC initially, but Kristen kept it due to its debugging properties (specifying an external seed). Pulling in ChaCha20 seems like a good approach. -- Kees Cook