Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp2097186rdb; Wed, 31 Jan 2024 20:57:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUhsWi8+hddup/Q1yLES+tzEx/vWqdSwfsyJvsHwYhcbMxRgSIikLDcUahmQG0WSCoeAHs X-Received: by 2002:a17:907:20a8:b0:a2e:ad24:da8 with SMTP id pw8-20020a17090720a800b00a2ead240da8mr3041149ejb.19.1706763471233; Wed, 31 Jan 2024 20:57:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706763471; cv=pass; d=google.com; s=arc-20160816; b=kE/WJDFrSELNHg9mTgj8HERLUzWVjXg+rCKPbUATdggBxIAsrtbQ0b3z6VvEqY+hzu CRPvPdQPRlM2S+ErXVlprpKZ+s8hT+NHzUisuAGEkmYZD8mpCWyXyVsUTSTQ1DZSyvks yKB1O7eMSjHRJTsbGGJeYYEi4YwhYNqiZtP5QEvumDXYN672MIDGuRmc6lcqNTR+e+HS jrhk5O8kNbxePMSjiMf4T3VQ75YA5F4jUQ6tmS698l8RkaN3Z/RUEWmQV+5ixIecvG5t 734/J/VrghekM/EbT9hBCUyf276rszIH3VR6ZFp7qAtpyBSXXbKSR2TedrneiI2iwpCq d1rA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=s5ToCA1JK1JWcXOK8/ttVS+ZKfu8UHQRYtgp6PPZIrk=; fh=t9wnQXpQY2bjybhSggiKSGRnNkohVZjb8qwnGLr2tXM=; b=waWxcrH0msmzHD23qiHhcDxOfJ6C/yUZHZ79g644qWd6PzRdRoq++yA6ljV8gYoWkM y268YBas1ZKyos/42qG57dJJG/PanMXtHBHnuibJNrjBaA633lKPwLgDCeEybRRNAllg m1o0IpjvBAzwQRnTeOdxOL0jrRPyeRAh9SuqrEHcw1lF7rDK2Ew97feWOH9N565pWjna W/iWY+mRSzkdQo9hGOzpCDv7c1hZXo5mo7TfHAnRo5DDgrnBtSNDfX7kRv8MRjukNLpI YK8Jw0l/Ka1wT/dZPBNQAoR3yxLkEtuBkv1C3I8WzGaLQ2FMdUB0wYnmPnBr+ObQ+Wgn 8S+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mit.edu header.s=outgoing header.b=MqwSgJtn; arc=pass (i=1 spf=pass spfdomain=mit.edu dkim=pass dkdomain=mit.edu dmarc=pass fromdomain=mit.edu); spf=pass (google.com: domain of linux-kernel+bounces-47639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47639-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mit.edu X-Forwarded-Encrypted: i=1; AJvYcCVxzQfOwPTryWJ4sl1bJuy0Zk1nZFoDmkw3+SH1UVvj/YxxPrNL6/Xm/hIlrJAe8AucXhKkKm6KAcqxKVhk2gob9InUeaCLVK7o5r3P1Q== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v27-20020a170906181b00b00a362d509ba2si2311451eje.637.2024.01.31.20.57.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 20:57:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@mit.edu header.s=outgoing header.b=MqwSgJtn; arc=pass (i=1 spf=pass spfdomain=mit.edu dkim=pass dkdomain=mit.edu dmarc=pass fromdomain=mit.edu); spf=pass (google.com: domain of linux-kernel+bounces-47639-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47639-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id ED5691F2239B for ; Thu, 1 Feb 2024 04:57:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48EC33BB4E; Thu, 1 Feb 2024 04:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mit.edu header.i=@mit.edu header.b="MqwSgJtn" Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6C2C3BB3C for ; Thu, 1 Feb 2024 04:57:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.9.28.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706763465; cv=none; b=NlxTgAN/40Yt+xotvT5qOvIk2sUfXtPbl1cPcpV7VR5M74rubU4mrPRPcqKJbPjOmbv63E5bHSEsB18qn2re9NYB7sLhxDzaX5ILDiFEyKSc8GA1Y5CA9dFbVYS2FWgt9nsOrSs6/O4L44lYV5wHZ9FBVyd6NxN67cSi4pw5nWQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706763465; c=relaxed/simple; bh=zYVGiC1rLRFF+J+Yr82QEPl5LjdWofkbHi4aPWTR5Z8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CJgufzWSVhYcCWmMf0mfg3hfOejE4mPjnHNAFCaKdeQpzTbN3xU/hfuT+abHD5RjBHXL2wTArdubT6QbOW9qgEbgxFlDgmzHQjsmpiU9gk5SjgBxhpHfRXad9tzV9oufoNc2FZBPbX92HhgFWhCc9LL+k7mtx95QJpaPFkVJHsc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mit.edu; spf=pass smtp.mailfrom=mit.edu; dkim=pass (2048-bit key) header.d=mit.edu header.i=@mit.edu header.b=MqwSgJtn; arc=none smtp.client-ip=18.9.28.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mit.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mit.edu Received: from cwcc.thunk.org (pool-173-48-116-252.bstnma.fios.verizon.net [173.48.116.252]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 4114vATx012056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 23:57:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1706763434; bh=s5ToCA1JK1JWcXOK8/ttVS+ZKfu8UHQRYtgp6PPZIrk=; h=Date:From:Subject:Message-ID:MIME-Version:Content-Type; b=MqwSgJtnw4X94zDhBAH6QhHOATjVVZYoLWGI0YKJLSWQwmWWTNJLtmHmrkbkdW3YG ov/cwRHzxDcMWkoZ+QGs2/X3qO/+Is1sILcwTcZXCKj+eQ7gvpgX2Filnj+BmfPxHW zEKcY6ib7BfLs8zNsKvX7hAdPz9r9gOLKR7hx3IXW1jnhf71C5GCcnfEPsk3adQL0r EhjRDnSms1WnNOFHwou6YDmR5oanEQg0PfTf4ENs5Gl+zhjh3f/D5WnmGfHA+ZCkzv tYq2GVgzrjDM2UzjbnuirVULtYw+A0i/N85rQVmy/uelT+3CQNYIXvJzH0Cfv2+erM UhQsg/cq8tdYw== Received: by cwcc.thunk.org (Postfix, from userid 15806) id 4E15B15C0667; Wed, 31 Jan 2024 23:57:10 -0500 (EST) Date: Wed, 31 Jan 2024 23:57:10 -0500 From: "Theodore Ts'o" To: "Jason A. Donenfeld" Cc: "Reshetova, Elena" , "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , "x86@kernel.org" , Kuppuswamy Sathyanarayanan , "Nakajima, Jun" , Tom Lendacky , "Kalra, Ashish" , Sean Christopherson , "linux-coco@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/2] x86/random: Retry on RDSEED failure Message-ID: <20240201045710.GD2356784@mit.edu> References: <20240131140756.GB2356784@mit.edu> <20240131171042.GA2371371@mit.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jan 31, 2024 at 07:01:01PM +0100, Jason A. Donenfeld wrote: > So if this is what we're congealing around, I guess we can: > > 0) Leave RDSEED alone and focus on RDRAND. > 1) Add `WARN_ON_ONCE(in_early_boot);` to the failure path of RDRAND > (and simply hope this doesn't get exploited for guest-guest boot DoS). > 2) Loop forever in RDRAND on CoCo VMs, post-boot, with the comments > and variable naming making it clear that this is a hardware bug > workaround, not a "feature" added for "extra security". > 3) Complain loudly to Intel and get them to fix the hardware. > > Though, a large part of me would really like to skip that step (2), > first because it's a pretty gross bandaid that adds lots of > complexity, and second because it'll make (3) less poignant If we need to loop more than, say, 10 seconds in a CoCo VM, I'd just panic with a repeated RDRAND failure message. This makes the point of (3) that much pointed, and it's better than having a CoCo VM mysteriously hang in the face of a DOS attack. I'll note that it should be relatively easy for Intel to make sure that if there is an undue draw on RDRAND, to at that point enforce "fair share" mode where each of the N cores get at most 1/N of the available entropy. So if you have single core CoCo VM on a 256 core machine trying to boot, and the evil attacker has purchased 255 cores worth of VM's, all of which are busy-looping on RDRAND, while the CoCo VM is booting, if it is looping on RDRAND, it should be getting 1/256th of the availabe RDRAND output, and since it is only trying to grab enough randomness to seed the /dev/random CRNG, if it can't get enough randomness in 10 seconds --- well, Intel's customers should be finding another vendor's CPU that can do a better job. - Ted