From patchwork Fri Jun 3 12:15:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 12869029 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 0ECF8CCA482 for ; Fri, 3 Jun 2022 12:18:18 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jZmJ4oHGHn0WY1rUbQpgKbIRemUg6Iy7EnFkHatnVJs=; b=Glkm1W+0OMvkBS umb972lhGlhmS5l984hm8fAGYo1beigYVMt/pPzjnU8H7uUW82MRwFveFMyjiZyiubda0pSGyDgVN ACD99kCx4iIZNfUQxRhHfsxI2X7yk6FqPOvyglDdj5IPRPA1Bv0WWFfhlpaj40262FR5ysEnTUCPu 5wAFz4Lqex7Yzzbk0L/D0ZHJX8qetJQC5egkqACdno7RoGVYcyt5LRKETPy10DvaPya5RK5PS21T0 Gwxj4dOGZ6jYNtu4EzrFmLazh3gTLl5lRwks78v85wGglVxUNh55sMzFZQqBFlK52XmQOQ4n3XZxb 3r0yzlvPIX2liCloInPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nx6En-007MJt-FN; Fri, 03 Jun 2022 12:17:09 +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 1nx6De-007Lkv-RU for linux-arm-kernel@lists.infradead.org; Fri, 03 Jun 2022 12:16: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 6B462615A7; Fri, 3 Jun 2022 12:15:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3662C385A9; Fri, 3 Jun 2022 12:15:55 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="c3mcp+J+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1654258553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=oRsHxHQzO9b36Wu7d91EDPUtT5qXNW3912jYDw/ciis=; b=c3mcp+J+qUuufS2+xBe8Ii9kTqaeIMNB6W/woJj8yZqwjHzz9spVBuRHXD5MyzJIRw+Znw Sv2ZWHqUZu6dNBVJwJq15W+sAGxXcU3gVt5AYH8ICM6+yal0iL4Erteq+dy7pZqFGMp0dt qNk8lOYjQprBB4UmUtI0s4BmkDGCYns= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 2573374e (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 3 Jun 2022 12:15:52 +0000 (UTC) From: "Jason A. Donenfeld" To: linux@armlinux.org.uk, rmk+kernel@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com Cc: "Jason A. Donenfeld" , Stephen Boyd , Ard Biesheuvel , stable@vger.kernel.org Subject: [PATCH v2] ARM: initialize jump labels before setup_machine_fdt() Date: Fri, 3 Jun 2022 14:15:43 +0200 Message-Id: <20220603121543.360283-1-Jason@zx2c4.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220603_051559_184549_962D8FE4 X-CRM114-Status: GOOD ( 12.08 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Stephen reported that a static key warning splat appears during early boot on arm64 systems that credit randomness from device trees that contain an "rng-seed" property, because setup_machine_fdt() is called before jump_label_init() during setup_arch(), which was fixed by 73e2d827a501 ("arm64: Initialize jump labels before setup_machine_fdt()"). Upon cursory inspection, the same basic issue appears to apply to arm32 as well. So this commit adds a call to jump_label_init() just before setup_machine_fdt(). Reported-by: Stephen Boyd Suggested-by: Ard Biesheuvel Cc: Catalin Marinas Cc: stable@vger.kernel.org Fixes: f5bda35fba61 ("random: use static branch for crng_ready()") Signed-off-by: Jason A. Donenfeld --- arch/arm/kernel/setup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 1e8a50a97edf..3ff80b1ee0b5 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1101,6 +1101,7 @@ void __init setup_arch(char **cmdline_p) atags_vaddr = FDT_VIRT_BASE(__atags_pointer); setup_processor(); + jump_label_init(); if (atags_vaddr) { mdesc = setup_machine_fdt(atags_vaddr); if (mdesc)