Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp206913rdb; Thu, 8 Feb 2024 03:50:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfAUj8EY7iw1rqIs8JJ9nEZ7TQQrRxuFTXylD+pE7bl9FORBX/j5mPCvHFaB8AO8W6yy3U X-Received: by 2002:a17:906:4088:b0:a37:1c56:8979 with SMTP id u8-20020a170906408800b00a371c568979mr6904541ejj.76.1707393022161; Thu, 08 Feb 2024 03:50:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707393022; cv=pass; d=google.com; s=arc-20160816; b=r2A5RrvHmztMZPfx+cM7azqcwEYHl1qAyprCHZH51UyHjokOCOGmoYnQgEUyi88Jja jCbd/64Isr6jtJjawSmWiLdqGl8L+E06fftHjujB9E2h5wWcrTG/A+c8lqE4DbLY/Bsf Y1Vt0+LuBkrEMkQx4E8v0yQiKAMHVJOknHnAdf1cRCZ7Tp8ibQ3/uuN9ZjGUD1P3Itc+ de8r1UW8pkJ6PAYHoytFa2QL+7h+gY6gL+58H87S4AGYKOuJXsJ8eACdSFXcJSgcoABH V0HsHOMuKrLUsiGBPsss4BDTj0LYEipLOuvEohNRek2yh9l01jhKLRXrRDQITbBwpsQ2 79Bg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :reply-to:message-id:subject:cc:to:from:date; bh=wHkG2UkVxqmY25vRGzPgOGAA2JuoSIRh2pO0LwXFZNc=; fh=lzvLcmGya6+1EAnK3f34U2S1cIZO9qQEtmLhJwHlJYg=; b=sNOM/Y0iyuY3ttFRRa1qUdIkIzWu8vby49SQ2xEYeX2smHEJQS9MwOVM2tTAAR8t6r cxULPR+6D3LMUcnEiiItI6AuuIdSaq4AlcKbNWgYvmZ5PzyMYGzu51kMOzQsg7MinmXZ 1Bvzlqsu7cnE3D8F/q+GYHg9hqfOIL40HfA8gn0J4VU9I8TUllUNbqPYj1yzr/yBdibV zMBPfwmvyoAteILBVOxrbu8Wg97Ra1fe5xpVrwoa01lwFoYjg1kBQ3rp/FOVjuBI+sa0 7YYsdi7uIMlC8KFzHVzr3yHgC2785S4Y6UU06QNyyhrsRJo5DoT4pOELdlOcOs6WLAHM uMDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=wind.enjellic.com); spf=pass (google.com: domain of linux-kernel+bounces-57991-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57991-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCV9NQTIYVn4/4nkCMDumZgo7QnpPJllqNWbofZ5AVNFSNSdGOqDCzgmYQQruPXvVj56Fr1T8jM8hb8SiQiFb7ucCYs60waW4aELFeqJ0w== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r7-20020a1709067fc700b00a3ba6fe0840si554593ejs.1010.2024.02.08.03.50.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 03:50:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57991-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=wind.enjellic.com); spf=pass (google.com: domain of linux-kernel+bounces-57991-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57991-linux.lists.archive=gmail.com@vger.kernel.org" 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 E3DBD1F267BE for ; Thu, 8 Feb 2024 11:50:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00FF571B24; Thu, 8 Feb 2024 11:49:46 +0000 (UTC) Received: from wind.enjellic.com (wind.enjellic.com [76.10.64.91]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E5F16EB54 for ; Thu, 8 Feb 2024 11:49:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=76.10.64.91 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707392985; cv=none; b=lMYpSmv3HVItDj8ZKLsyn90bNYJb+WsOro5T7A+RXCcOEkdSvEfT/UC123gkPf7cxgscO8VGgSs3I91BvcQ9QSueC3ZuQZn6FVhanXaQAdQ4ksycTib4CiT2KueJVvyWsB9iz+v9uKq7GITVa3CF2OEB6UES2sSv/x74XEltp0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707392985; c=relaxed/simple; bh=W8hh8SVXTKvD7eEwi7WV4j5y4uSnRC+F/4neJBDMh5U=; h=Date:From:To:Cc:Subject:Message-ID:References:Mime-Version: Content-Type:Content-Disposition:In-Reply-To; b=Jf3Dons3usBZ1kKwoUrnE78bxUfZzzgDkOrdiPLBARFTrJQ6yULqSOQ+qUKHBw2+xh6VZlnCLiX114aLGisnFRoL4HxUsH1NyI7050xgPhNIGwREqA2pFC8qHuP8SsUSjF1oWu7PzFIkrX1dzopjrLbdxSBD/TYZPplEpPY3pOw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=enjellic.com; spf=pass smtp.mailfrom=wind.enjellic.com; arc=none smtp.client-ip=76.10.64.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=enjellic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wind.enjellic.com Received: from wind.enjellic.com (localhost [127.0.0.1]) by wind.enjellic.com (8.15.2/8.15.2) with ESMTP id 418BijxE023873; Thu, 8 Feb 2024 05:44:45 -0600 Received: (from greg@localhost) by wind.enjellic.com (8.15.2/8.15.2/Submit) id 418BiiQW023872; Thu, 8 Feb 2024 05:44:44 -0600 Date: Thu, 8 Feb 2024 05:44:44 -0600 From: "Dr. Greg" To: Borislav Petkov Cc: "Daniel P. Berrang??" , "Reshetova, Elena" , "Jason A. Donenfeld" , "Hansen, Dave" , "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , "x86@kernel.org" , "Theodore Ts'o" , Kuppuswamy Sathyanarayanan , "Nakajima, Jun" , Tom Lendacky , "Kalra, Ashish" , Sean Christopherson , "linux-coco@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/2] x86/random: Issue a warning if RDRAND or RDSEED fails Message-ID: <20240208114444.GA23164@wind.enjellic.com> Reply-To: "Dr. Greg" References: <88a72370-e300-4bbc-8077-acd1cc831fe7@intel.com> <20240206011247.GA29224@wind.enjellic.com> <20240206120445.GA1247@wind.enjellic.com> <20240206153529.GHZcJRwTdDkWXuopOQ@fat_crate.local> 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: <20240206153529.GHZcJRwTdDkWXuopOQ@fat_crate.local> User-Agent: Mutt/1.4i X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.3 (wind.enjellic.com [127.0.0.1]); Thu, 08 Feb 2024 05:44:45 -0600 (CST) On Tue, Feb 06, 2024 at 04:35:29PM +0100, Borislav Petkov wrote: Good morning, or perhaps afternoon, thanks for taking the time to reply. > On Tue, Feb 06, 2024 at 06:04:45AM -0600, Dr. Greg wrote: > > The silence appears to be deafening out of the respective engineering > > camps... :-) > I usually wait for those threads to "relax" themselves first. :) Indeed, my standard practice is to wait 24 hours before replying to any public e-mail, hence the delay in my response. > So, what do you wanna know? I guess a useful starting point would be if AMD would like to offer any type of quantification for 'astronomically small' when it comes to the probability of failure over 10 RDRAND attempts... :-) Secondly, given our test findings and those of RedHat, would it be safe to assume that EPYC has engineering that prevents RDSEED failures that Ryzen does not? Given HPA's response in this thread, I do appreciate that all of this may be shrouded in trade secrets and other issues. With an acknowledgement to that fact, let me see if I can extend the discussion in a generic manner that may prove useful to the community without being 'abusive'. Both AMD and Intel designs start with a hardware based entropy source. Intel samples thermal/quantum junction noise, AMD samples execution jitter over a bank of inverter based oscillators. An assumption of constant clocked sampling implies a maximum randomness bandwidth limit. None of this implies that randomness is a finite resource, it will always become available, with the caveat that a core may have to stand in line, cup in hand, waiting for a dollop. So this leaves the fundamental question of what does an RDRAND or RDSEED failure return actually imply? Silicon is a expensive resource, which would imply a queue depth limitation for access to the socket common RNG infastructure. If the queue is full when an instruction issues, it would be a logical response to signal an instruction failure quickly and let software try again. An alternate theory would be a requirement for constant instruction time completion. In that case a 'buffer' of cycles would be included in the RNG instruction cycle allocation count. If the instruction would need to 'sleep', waiting for randomness, beyond this cycle buffer, a failure would be returned. Absent broken hardware, astronomical then becomes the probability of a core being unlucky enough to run into these or alternate implementation scenarios 10 times in a row. Particularly given the recommendation to sleep between attempts, which implies getting scheduled onto different cores for the attempts. Any enlightenment along these lines would seem to be useful in facilitating an understanding of the issues at hand. Given the time and engineering invested in the engineering behind both TDX and SEV-SNP, it would seem unlikely that really smart engineers at both Intel and AMD didn't anticipate this issue and its proper resolution for CoCo environments. > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette All the best from the Upper Midwest. As always, Dr. Greg The Quixote Project - Flailing at the Travails of Cybersecurity https://github.com/Quixote-Project