Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2174156iof; Tue, 7 Jun 2022 22:10:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe+np08E38pcThm3fm5A+aAsOkiPsozaAddt7bfzhNSxqOcGJK1n+BGhedXFYIfyQ2+4nD X-Received: by 2002:a17:90a:b002:b0:1ea:4140:edd2 with SMTP id x2-20020a17090ab00200b001ea4140edd2mr1248854pjq.21.1654665051514; Tue, 07 Jun 2022 22:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665051; cv=none; d=google.com; s=arc-20160816; b=FBXXnyenNmmMOReUHh8hlXNnhO5yjEwvw15Kds3JVsf1jTUvWuvm3z5tB7RFiYV45J B2G1IfJjLX97zj97TgcH4csMtQq+M/97q7iIQeSWJZ+0/ImKbMr3c4Jlq5SKpwmwKQHH J1eAoH+Jk10t5klpiG7FiVKxVDApTCas5tNs70juk3viT7hcqfE1QfnsxYApHAJC5b/x Q5YoRWDigqoH/altKCOylPN0nLWc//aPpXl9bJhxEZ9jWAUmsVdsonA1ap99P4ZNO3Fg y1dH3+OTDTROF/JbTC7P3DrKaYDtU8lZme5avNopIJr6dWFnVNRxNauGVy/ZV3Na2nF0 C9Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JXYCtnOH8D/QyBftfo4H/7oIrSJ0X4hdAIqvoJRWank=; b=Xdfk6MthzFBWPR/Ee1miXOYDK3yVOCYVyQBAfRQ1Ikk0wtMNOQZiOzDsJ+LjQuIBcH HQD+oBH7/8DQdE8ixZK1G3v7do3WhMKc5Kx5fLo3SEwik63D8vWtUGLU8OHPYqtxmB1U H8NWHKPKXCgDGpk2WAz69zGEN99eI7OB7Kd6+H/O5sDJBp6duvV8zur3mM6MWQeVIx/2 my0aJibC6uj+SntGFKKeNMl5yj7g6QDkh62uFc54TPsIsgiro24d1h2JctIBz8F8Cryc bRE2CmAXJo+MKSaoBXEHIs6oFzGi9pMRsdGi2eDLCrymjP6GB7x3gVQqj3sH43sIDf9H f4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b="T6/Fm3Fy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w123-20020a636281000000b003c219383924si25768599pgb.465.2022.06.07.22.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:10:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b="T6/Fm3Fy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 74F7E415203; Tue, 7 Jun 2022 21:43:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243590AbiFGMUg (ORCPT + 99 others); Tue, 7 Jun 2022 08:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243728AbiFGMSE (ORCPT ); Tue, 7 Jun 2022 08:18:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA453FB438 for ; Tue, 7 Jun 2022 05:16:32 -0700 (PDT) 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 3F66B61743 for ; Tue, 7 Jun 2022 12:16:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8B7FC385A5; Tue, 7 Jun 2022 12:16:30 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="T6/Fm3Fy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1654604188; 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=JXYCtnOH8D/QyBftfo4H/7oIrSJ0X4hdAIqvoJRWank=; b=T6/Fm3FyMhMiN9DD76jPM48CkpOZQvzHNz4hO6fSgwEueVDEPb4Y0MnYeGOopyMWkGod02 tnkvt2LTQB3NCTfFan0tEUQd/wXLcmvOdbJ9G5aQQ2GLuJW12/a5N0ojpIxkfNt5c44trd KWdY2Nm5mFiDhEfG0Gx0yl0V+rK/xGQ= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 04ff6650 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 7 Jun 2022 12:16:28 +0000 (UTC) Date: Tue, 7 Jun 2022 14:16:24 +0200 From: "Jason A. Donenfeld" To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Stephen Boyd , Catalin Marinas , Russell King , Arnd Bergmann , Phil Elwell Subject: Re: [PATCH] random: do not use jump labels before they are initialized Message-ID: References: <20220607100210.683136-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ard, On Tue, Jun 07, 2022 at 02:03:28PM +0200, Ard Biesheuvel wrote: > On Tue, 7 Jun 2022 at 13:35, Jason A. Donenfeld wrote: > > > > Hi Ard, > > > > On Tue, Jun 07, 2022 at 01:10:52PM +0200, Ard Biesheuvel wrote: > > > Fair enough. What I would like is to remove the need to play around > > > with the placement of jump_label_init() across architectures. Jump > > > labels are fundamentally a performance optimization, so unless you can > > > explain how setting it as early as possible makes a material > > > difference, performance or otherwise, I really think we should pursue > > > a solution that does the static key manipulation at some later time. > > > > Alright. It sounds like Catalin also prefers the same. This seems simple > > enough with minimal downsides: https://lore.kernel.org/lkml/20220607113238.769088-1-Jason@zx2c4.com/ > > > > That looks simple enough. Do we risk causing any boot stalls due to > the crediting being deferred? Or new warnings about randomness being > used before CRNG is ready? We don't risk boot stalls. But there will be warnings for developers who have enabled the CONFIG_WARN_ALL_UNSEEDED_RANDOM debug option. > > So maybe we should just go that route. > > > > It is not my preferred approach, but I can live with it. I'm not sure what your preferred approach is at this point in time actually. I'll summarize all the approaches discussed so far: 1) Fix archs to initialize jump labels earlier: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?id=73e2d827a501 https://lore.kernel.org/lkml/20220603121543.360283-1-Jason@zx2c4.com/ 2) Defer mixing & crediting until random_init(): https://lore.kernel.org/lkml/20220607111514.755009-1-Jason@zx2c4.com/ 3) Defer crediting (but not mixing) until random_init(): https://lore.kernel.org/lkml/20220607113238.769088-1-Jason@zx2c4.com/ 4) Defer changing the static branch (but neither mixing nor crediting) until random_init(): https://lore.kernel.org/lkml/20220607100210.683136-1-Jason@zx2c4.com/ My first choice is (1) if it's feasible. (2) is not possible without introducing a copy, so that's out. What's your preferred approach? Or is there a number 5 you have in mind? Jason