From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F166ECAAD2 for ; Mon, 29 Aug 2022 16:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FsgywKUXZfGJNA4iCg5ZX0VgIfcriDu80+GiRjFRT0Q=; b=4QrjTdN0iDOB8H PA/s+q2sMO3tLKavmKF8YQRRYe36uq4ReCP4KYTKpBMTAoja4n/F6+t0GclBQ67fo/1tGQmWH0J34 eBQ+troHTT5PNurLOGTJe3IhgaFAfSvdODsjFwKxV/dXlNfmFkpPaV+C6zvWFN0YV94h5A/n9Lh0U oO4r+wrfwi2Zl6TTj3YNPvdpDsiqKU8QwHPNddYdyOXwMVFfczNXppDNzSQKPo3Hl42tdG6z4ePdr d7/rQ2DaVY9sFJlpaothQy1Q5069OlhXsS3VeV/N7BnzGmptUYERDYZv3ZzYsk45vD3tbFzkenIm0 tXs08CBspGIY4wJOYsfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oShxj-00BthC-Qm; Mon, 29 Aug 2022 16:50:13 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oShnr-00BpB1-3i for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2022 16:40:00 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97A8C6125F; Mon, 29 Aug 2022 16:39:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F9B0C433D6; Mon, 29 Aug 2022 16:39:56 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="LfnwDr2l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1661791194; 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=oF1j60atJlDmJ/i/cn/SVD6+lw8BdA37ZDx7OhjUUlY=; b=LfnwDr2lKEuM/Iwq0wN8pMO7EITZzEXBK5Kj2tMINL0OnmV9YDrfbY2Q39x0MdvAPxPqU6 fNfDUe+vtWaZF0gRIt21dYVm25wBfkrMt3+G7os0IBL6FyocNXA5YinK8TyR1pNh4fvn6Y 6Am/7NMH2JQJRpwpE/jexjTKW7H4NVA= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 5635b464 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 29 Aug 2022 16:39:54 +0000 (UTC) Date: Mon, 29 Aug 2022 12:39:53 -0400 From: "Jason A. Donenfeld" To: Eric Biggers Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Adam Langley , Ard Biesheuvel Subject: Re: Should Linux set the new constant-time mode CPU flags? Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220829_093959_236726_8D5ECFE7 X-CRM114-Status: GOOD ( 16.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Eric, On Thu, Aug 25, 2022 at 11:15:58PM +0000, Eric Biggers wrote: > I'm wondering if people are aware of this issue, and whether anyone has any > thoughts on whether/where the kernel should be setting these new CPU flags. > There don't appear to have been any prior discussions about this. (Thanks to Maybe it should be set unconditionally now, until we figure out how to make it more granular. In terms of granularity, I saw other folks suggesting making it per-task (so, presumably, a prctl() knob), and others mentioning doing it just for kernel crypto. For the latter, I guess the crypto API could set it inside of its abstractions, and the various lib/crypto APIs could set it at invocation time. I wonder, though, what's the cost of enabling/disabling it? Would we in fact need a kind of lazy-deferred disabling, like we have with kernel_fpu_end()? I also wonder what crypto-adjacent code might wind up being missed if we're going function by function. Like, obviously we'd set this for crypto_memneq, but what about potential unprotected `==` of ID numbers that could leak some info in various protocols? What other subtle nearby code should we be thinking about, that relies on constant time logic but isn't neatly folded inside a crypto_do_something() function? Jason _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel