From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C566212B162; Thu, 15 Feb 2024 12:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708001933; cv=none; b=g7LnPkp9zdptm+dEvjlHPSoVDldGhB9UO0iVCOjedJXyNjuXDq2BeOPIZq5hwCCfJPPNO82DarpU2bIGJLjC8EX37ZW6a4X5hWQSHMGNvAB+Mzt2AJkmNR1e8XikL7GIsgp1MtBAnm80Ub74A1yobmBjHJxfgtRCZVCrrw1elww= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708001933; c=relaxed/simple; bh=Ad/rzeg0qm+b8E72/V5gLfBzXXiMiZDjEciTC6pPZ+M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TSPzFhM8yRiRu6RBOr3xgTR6MdWOx0oM+9uqm8MocUHPTo31Cj1TqPVwJ29SBa9TeN96MVlPq4iNUMKiFHFMl3V8x8DiIPesQG5vQ4fNm5KSIF/Cac52RnE2azZQ41fSrCUUpp5nMUs3XiX+moWwjGGaRmmAltduOnSauaARehA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b=KSpbnvKz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="KSpbnvKz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C564EC433F1; Thu, 15 Feb 2024 12:58:50 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="KSpbnvKz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1708001929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dsxfcdPhD8kEeco8ZBp7CrkSEujEWrVukxbbEuEYW4M=; b=KSpbnvKzEbTsf3lyoqZVbKXYcOb0fjXmc8hoHRG/bglLZ20AuWeR/meJcQb1fLN8cv2zVb c9rvaJgbwrw8hLuUNPNSafs3KnvRFXTKZCvBZ9xeeQryDN1c+qySTFjzPpkmvSeAzss8Ii /DRRfnIN6ggqZ3N21gDSKiNZTK5rA78= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id e0407208 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 15 Feb 2024 12:58:48 +0000 (UTC) Date: Thu, 15 Feb 2024 13:58:47 +0100 From: "Jason A. Donenfeld" To: "Reshetova, Elena" Cc: Theodore Ts'o , Dave Hansen , "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "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: References: <20240201045710.GD2356784@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=utf-8 Content-Disposition: inline In-Reply-To: On Thu, Feb 15, 2024 at 07:07:45AM +0000, Reshetova, Elena wrote: > > You said that RDRAND is faster than the bus, so failures won't be > > observable, while RDSEED is not because it requires collecting entropy > > from the ether which is slow. That makes intuitive sense on a certain > > dumb simplistic level: AES is just an algorithm so is fast, while > > entropy collection is a more physical thing so is slow. But if you read > > the implementation details, RDRAND is supposed to reseed after 511 > > calls. So what's to stop you from exhausting RDSEED in one place, while > > also getting RDRAND to the end of its 511 calls, and *then* having your > > victim make the subsequent RDRAND call, which tries to reseed (or is in > > progress of doing so), finds that RDSEED is out of batteries, and > > underflows? What's the magic detail that makes this scenario not > > possible? > > This was on my list of scenarios to double check whenever it is possible > or not, and the answer is that it is not possible (at least for Intel). > This scenario is also briefly described in the public doc [1]: > > " Note that the conditioner does not send the same seed values to both the > DRBG and the ENRNG. This pathway can be thought of as an alternating > switch, with one seed going to the DRGB and the next seed going to the ENRNG. > *This construction ensures* that a software application can never obtain the > value used to seed the DRBG, *nor can it launch a Denial of Service (DoS) > attack against the DRBG through repeated executions of the RDSEED instruction.*" Interesting, and good to hear. So also implicit must be that the time required by 511 calls to RDRAND exceeds the reseeding time, so that you couldn't exhaust the seeds indirectly by flushing RDRAND. Jason