Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4759674iob; Mon, 9 May 2022 00:31:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9jlf5ouKwxY1ksIdj8OvugQ+OJYEPXoGnKtbvkJFEDd+kpDnZYtOWx68PP6+ATur/98Zm X-Received: by 2002:a17:90b:3b90:b0:1dc:1ebb:8853 with SMTP id pc16-20020a17090b3b9000b001dc1ebb8853mr24756830pjb.231.1652081465484; Mon, 09 May 2022 00:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652081465; cv=none; d=google.com; s=arc-20160816; b=PD/eB3vsGrvRFlroBQXfB+mdRp+qaoUx5VxhYJftrGPBpcX/cZvaic2FLP/Zno/d/M SCr0pDGrw4wtJeOfUN2pqlSXEgj0zraB2a5p7sJFNA+RxrLJsEbFv5L4+Ysr3RRwRBOR JKHt9Ef9seC3g6Vlq2OkftQUyhw5+4YF7Ib/aRusCIwhSMNhNQpnHWYnMzuPcqkQ+SqQ 5EtmIQjseKpicEXa8Vz1XYtuLXP0bfRJBk64JwZp6lkm4oqR1aFEGd1Rl18vloCAPeHA S2khdSxj45MH4QC/QLu7Cv5yju9xCvjiH3v2MLaH760GaAZo78LgKxScwAUF8z0W3vxk 5Ang== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Dcz9MFpNHCFKx2TGJDNIUqllRgwjj7RyATuty7yE2nQ=; b=Kf18Rc4CmBPtett/PwuLFQ8QsrhaDf8odl0Atb/YAUJIJkbpCd7HYTguZA6QabbZFf 08G/Vz/AJu2UPkP3ndfwh93mgUtgCkioLN6lS+2W1yTvaSp415aFBjMdKSF2agMCI5c0 pV6cBJvcynL19WxT8yiteIyVwlH7q47wkXbd7GIlcH48/4wZQNrKf0CVYWgbne69aytL i2uOhQOgUMApnzHoLo35gDBwvmwmRkoZP27ewngNxiMyw3B4fxLvlz/xQZl+6x5Yooa8 rZBH3uhv8017MGZxdVLGDycPbcAsIv+RzaN0TzQr4ek3wTWwy06ha6CI6GatCjHMXLTt BIAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=DxnB+sEE; 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 z1-20020a656641000000b003c6a370aa3fsi5258271pgv.439.2022.05.09.00.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 00:31:05 -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=DxnB+sEE; 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 743E41207CE; Mon, 9 May 2022 00:27:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232165AbiEEAfA (ORCPT + 99 others); Wed, 4 May 2022 20:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbiEEAe7 (ORCPT ); Wed, 4 May 2022 20:34:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AE7B4BB87 for ; Wed, 4 May 2022 17:31:21 -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 1410961D42 for ; Thu, 5 May 2022 00:31:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D85A7C385A5; Thu, 5 May 2022 00:31:19 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="DxnB+sEE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1651710678; 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=Dcz9MFpNHCFKx2TGJDNIUqllRgwjj7RyATuty7yE2nQ=; b=DxnB+sEEzyL+6svIUzSDufMh/e3wx+lQebf9IokfpfK/iDGwIDHWDFvMyHSh+j2kepYwJn VRYFyML68HXiIid7/6o7t41zJH0vAB6+4Xz+WQdj2cVbRlsSDYRB1GNfsGS3dDp+UaPWkG awhF5yV02bKxT1b5BIuIByjxJbj4TGg= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id dda00650 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Thu, 5 May 2022 00:31:18 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-kernel@vger.kernel.org Cc: "Jason A. Donenfeld" , Stafford Horne , Andrew Morton Subject: [PATCH] init: call time_init() before rand_initialize() Date: Thu, 5 May 2022 02:31:14 +0200 Message-Id: <20220505003114.177552-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Currently time_init() is called before rand_initialize(), but rand_initialize() makes use of the timer on various platforms, and sometimes this timer needs to be initialized by time_init() first. In order to not return zero, reverse the order of these two calls. The block doing random initialization was right before time_init() before, so changing the order shouldn't have any complicated effects. Cc: Stafford Horne Cc: Andrew Morton Signed-off-by: Jason A. Donenfeld --- Andrew - this file has no formal maintainer, but you've signed the most commits, so I'm CC'ing you. This has some interactions with my random.git tree, so unless there are objections, I'll queue it up there. -Jason init/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/main.c b/init/main.c index 98182c3c2c4b..e37ec99cf56d 100644 --- a/init/main.c +++ b/init/main.c @@ -1035,6 +1035,7 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void) softirq_init(); timekeeping_init(); kfence_init(); + time_init(); /* * For best initial stack canary entropy, prepare it after: @@ -1049,7 +1050,6 @@ asmlinkage __visible void __init __no_sanitize_address start_kernel(void) add_device_randomness(command_line, strlen(command_line)); boot_init_stack_canary(); - time_init(); perf_event_init(); profile_init(); call_function_init(); -- 2.35.1