Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2172639iof; Tue, 7 Jun 2022 22:08:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuN8rRmLTKHpA901VZQBrq/Ojqurw//i53ITpRgATJiRackGXU6EYPPgPaw/sTjjY2CgUh X-Received: by 2002:aa7:8883:0:b0:51c:41b6:6e1d with SMTP id z3-20020aa78883000000b0051c41b66e1dmr5711991pfe.82.1654664899174; Tue, 07 Jun 2022 22:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654664899; cv=none; d=google.com; s=arc-20160816; b=d2jMy9vDXsVNE9unhc4CWeGhVpUw7yL0joluZ3zKqZbrVyClSrokkfR99JwawhkFB7 Jkmgl31AxLpMOX9hiAPcHmY/HZTTovKOyiMJfECLPawuVF1Xp3sX2XJyvOst3+Vj7am5 jNTk7dpo0aXw7BgT6vYrySWVdR+bMiphqFCCXExmx6Ad/PM3gUgACSHh+vbTszJZYlHP 9s2DlQfTrZ68oHHZBfYuHFq3hsPeeyUfqsiq6Ht03CTXpRu2x9av3WLCirleHUYqeze7 sVQgPqsu5ChAtm1uLrIZic6nww3er5W2BOCqHNa8l5Aalg60Mnk6EKs7B2rXFv9A8gJV dpzw== 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=EFatu6W8SBbcaoaZKbQzjLqPuGtYylAXIKGYFtoTLpA=; b=KfDbfmYqXybsV/brGGKCXoH+DnsMHuP3lH1Jb+RlypFfv1j4W44zSvqdyDFGAvlPYR lHcC+eumznThMdCBWi+DkAbaBIPLYugiMCPxtNFEcONpWrRe5KmZkRRZjuwK2zOYshvu 35QGWJWMg+5cV1sJ9y1aEpEfcH71GhJjqAQrGGinyAxzfQuhBZD+MRBMTPADHlrz88Tz TMOBXYEWw/IqUlNtF1JMl+UvOaOW5jn32CkakmKcIduY48Nr3jw/RbQP35hncJ6g0BHe 4mBu0p0SaKlMhg/MZfNu4Zr0YgBbAk+yU/Kywi70V49EmiTdB0OpIqxuXFSFvV7J5fv6 7xuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NuORGd8L; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id 35-20020a630f63000000b003fcb3adf3cbsi4847409pgp.809.2022.06.07.22.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:08:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=NuORGd8L; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 E65011E4BFC; Tue, 7 Jun 2022 21:35:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241004AbiFGK2V (ORCPT + 99 others); Tue, 7 Jun 2022 06:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240993AbiFGK2T (ORCPT ); Tue, 7 Jun 2022 06:28:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7626AB7DF7 for ; Tue, 7 Jun 2022 03:28:18 -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 ams.source.kernel.org (Postfix) with ESMTPS id 19368B81ED9 for ; Tue, 7 Jun 2022 10:28:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F15ECC385A5; Tue, 7 Jun 2022 10:28:14 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="NuORGd8L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1654597692; 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=EFatu6W8SBbcaoaZKbQzjLqPuGtYylAXIKGYFtoTLpA=; b=NuORGd8LUwfWLNMSn60llHi61VATl0SnqQDJuJEw68mvN6UJ7SgvesMijkmSG/s634trIC JFlTzx2wJxqSBfvF+V+hxXfKbrDAcTMZpv4xLSoupQvJl5xmGo9Zyg0y0UAWuVtTBc2pzW KP/vGrfkeX3b+iRZRcKxOceq0qbIRp4= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 1e7bee8b (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 7 Jun 2022 10:28:12 +0000 (UTC) Date: Tue, 7 Jun 2022 12:28:08 +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 12:13:29PM +0200, Ard Biesheuvel wrote: > Hi Jason, > > On Tue, 7 Jun 2022 at 12:04, Jason A. Donenfeld wrote: > > > > [ I would like to pursue fixing this more directly first before actually > > merging this, but I thought I'd send this to the list now anyway as a > > the "backup" plan. If I can't figure out how to make headway on the > > main plan in the next few days, it'll be easy to just do this. ] > > > > What more direct fix did you have in mind here? A non-broken version of https://lore.kernel.org/lkml/20220603121543.360283-1-Jason@zx2c4.com/ As I mentioned in https://lore.kernel.org/lkml/Yp8kQrBgE3WVqqC5@zx2c4.com/ , I would like a few days to see if there's some trivial way of not needing that on arm32. If it turns out to be easy, then I'd prefer the direct fix akin to the arm64 one. If it turns out to be not easy, then I'll merge the backup commit. > > diff --git a/drivers/char/random.c b/drivers/char/random.c > > index 4862d4d3ec49..f9a020ec08b9 100644 > > --- a/drivers/char/random.c > > +++ b/drivers/char/random.c > > @@ -650,7 +650,8 @@ static void __cold _credit_init_bits(size_t bits) > > > > if (orig < POOL_READY_BITS && new >= POOL_READY_BITS) { > > crng_reseed(); /* Sets crng_init to CRNG_READY under base_crng.lock. */ > > - execute_in_process_context(crng_set_ready, &set_ready); > > + if (static_key_initialized) > > + execute_in_process_context(crng_set_ready, &set_ready); > > Can we just drop this entirely, and rely on the hunk below to set the > static key? What justifies having two code paths that set the static > key in different ways on different architectures? No, we can't. The hunk below (A) is called from init/main.c some time after jump_label_init(). The hunk above (B) is called whenever we reach the 256-bit mark. The order is (B)(A) on machines that get seeded from efi or device tree. The order is (A)(B) on all other machines, which reach the 256-bit mark at "some point"... could be after a second, a minute, whenever enough estimated entropy has been accounted. Jason