Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp432993rdb; Thu, 15 Feb 2024 04:59:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjXnASNYYp76pjB/nOilrvwbkQdPHVJOHqFw8ia9Vzf5nkVNdt6f+G1se+sZ4Ri25t8DsInWRci5f9ZX/rC/DpMv2E5+8fE5Qhujk2jQ== X-Google-Smtp-Source: AGHT+IE0iXBFmzHHoGfZv0kmSDbsoOK8UI8p6gvOlDenHfUxo7IAb3u5pA2bOnuhQpQMdv0u7Lgw X-Received: by 2002:ac8:5a55:0:b0:42c:43d6:c69e with SMTP id o21-20020ac85a55000000b0042c43d6c69emr8811263qta.1.1708001940449; Thu, 15 Feb 2024 04:59:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708001940; cv=pass; d=google.com; s=arc-20160816; b=WkKdDMf08SiCzRmCeoLjSUZD1H7F4Yz9qOec6Sub1JJuOGxMEaDQn6aupiLvzM3pjM HuavuTCiTkQyiGJ4aseF9NgBN9A/SBp+MDuU4igTPxHUO1pCM+Ypl30mEqnJZFFW6H8p CEvq5UBSLqCIlKq2qsFtAM2S2KFtmKSrvkn9hmYAb+OS9kHMDrYpVlJCVcMARuC85el8 u0QtR2ZNnNJ3GL2+w/IbwV5VJYdIxITJcqp004b2X28Eye+ORAU7E+XSx+z8A9jZMx4p XB4/T2qs68eS8TtkISpVlx0xIqW7MHO6mmzUCgRVnrdk5jPgBQHETzcqDO6/XuRoH//9 iQWQ== 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=dsxfcdPhD8kEeco8ZBp7CrkSEujEWrVukxbbEuEYW4M=; fh=n0mcKnSoxB4jHCbMIRfqpHyywkWenRzvDPlqJ7OVWTk=; b=elAGNyjinIVZ9hzHw7oJmoNyPKom1wAIBk2mf7+iiIxhx267OCWeJ67R7Q0oS2vOFn 2v4zbtNl0Iym69B32jhbdTrAYUrnvyYtbnbMmGgXLk7G3hj27/sBpQb4BUGBdUwwRZ8z Nw8KdMWn18MLfEv/tKNv+KpvZzdNBon8PBG7DhrSDbKpTIX22XPtC8VqOAzD0pL9qoQ3 MaqxzzipoGkjVh+K9QmhPAI6pskLV/LIkaO3aAOXa5UcBylxmtJl79Qn7I76rnjN+477 YQHyNhL4uI0TVXce4ggE1WtfK9aTbBRsZUipig2SSJgls8j3fOIN75uda3cdGQPNTd7B h8YQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=KSpbnvKz; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-kernel+bounces-66936-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w25-20020ac86b19000000b0042c3e04578bsi1232379qts.688.2024.02.15.04.59.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 04:59:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66936-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=KSpbnvKz; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-kernel+bounces-66936-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3A0211C23529 for ; Thu, 15 Feb 2024 12:59:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10BE912F39E; Thu, 15 Feb 2024 12:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="KSpbnvKz" 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 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