Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp351546pxb; Thu, 21 Apr 2022 00:43:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiHCzcMttkzOQAdz1NEYrmzv6H4w7qROE8FHfz8qAGMbE7QDUl5megx5y1tehgO/m5HRxD X-Received: by 2002:a17:906:fc05:b0:6e8:89e7:52e7 with SMTP id ov5-20020a170906fc0500b006e889e752e7mr21433498ejb.360.1650527020177; Thu, 21 Apr 2022 00:43:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650527020; cv=none; d=google.com; s=arc-20160816; b=I0MnlsVgTjIfzfiPTYikBmj06GqNtN+GxSxGlg5473+XEYxlO+Tk/lrj1XFiVeT6yY 4DI1jVpqKyY1VcpMxWijB0AbCcOZHWneLuzj8BcS6vGPfB48gMiW72tsEgeGPPjd/7a6 QXYveydGCGPDDSdnVBL/FKUAVMIivsPIW06EdPu780u8v0lEdWfYjv26vyQttgVmy+EF xI3HK7mOajov6Yju/rELoxOgk5t8sv2651p1/cD2BE4V58LwO+icj5c5rbZ27AbBUdTk 6KobHGU8Gx7kiUqEWQMA0blOAASN9f7bsymZCxeascahYdcVItd3pfOOz3+aSb//TzMM ejow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0AODITKYyJtEle+S4cX8w6pvyuCOHjrS7aFRmGybDo8=; b=X1xGlL9/2amUEI7DLIzgTor1GRGOQyGRLiyX3f7c24Tdw3xX6R3Ma5229DYSYWynoF /psxsWqhKw/D18O4lW5DKsjR17RLs0ftUvjcnmcSMtFYBYLNo2BMB6Q8X3jZEsYYkJP4 AymmLH3Yyfesv/VUy6GvOyGIr5PJqXt71zpRobE7zOnvlmowzXkC1PKmcEWiV5WWOycX kh+j7TiOKoOn1OxuR2S0fByH1Q/arOE9msgewDG7PieajCFP9RTddCjMbIZfSN4zM0nk tX4rX/5xRyw+NjoKYVjxb+KoswSKK1MICT9XCOSQ0sRqGuj+29KTioYN9kDNcm4/qv4V GmKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=LOxH7J36; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f15-20020a056402194f00b0041d7932031bsi2648610edz.59.2022.04.21.00.43.02; Thu, 21 Apr 2022 00:43:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=LOxH7J36; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351085AbiDSLWE (ORCPT + 99 others); Tue, 19 Apr 2022 07:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351060AbiDSLV2 (ORCPT ); Tue, 19 Apr 2022 07:21:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0783B25EB9; Tue, 19 Apr 2022 04:18: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 sin.source.kernel.org (Postfix) with ESMTPS id 337B3CE1838; Tue, 19 Apr 2022 11:18:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EA77C385A8; Tue, 19 Apr 2022 11:18:11 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="LOxH7J36" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1650367089; 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: in-reply-to:in-reply-to:references:references; bh=0AODITKYyJtEle+S4cX8w6pvyuCOHjrS7aFRmGybDo8=; b=LOxH7J36MYF+Nm4lGWmal0/cEG8CwU3l9arno1POotRNbP696zlCNTeZilUdVYo/8Cxpk2 z4TmJi1mqWp23mUur53Zx/V9Yu17M1OsGhIWnMZvh8lrueF6EXAiU0usu7CBjDRXqX4PdE p2SJ97pP2MMoOIsyeOb0iJA9GKbEPSA= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id cff62030 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 19 Apr 2022 11:18:09 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, tglx@linutronix.de, arnd@arndb.de Cc: "Jason A. Donenfeld" , Theodore Ts'o , Dominik Brodowski , Russell King , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Thomas Bogendoerfer , Paul Walmsley , Palmer Dabbelt , Albert Ou , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Chris Zankel , Max Filippov , Stephen Boyd , Dinh Nguyen , linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, x86@kernel.org, linux-xtensa@linux-xtensa.org Subject: [PATCH v5 08/11] um: use fallback for random_get_entropy() instead of zero Date: Tue, 19 Apr 2022 13:16:47 +0200 Message-Id: <20220419111650.1582274-9-Jason@zx2c4.com> In-Reply-To: <20220419111650.1582274-1-Jason@zx2c4.com> References: <20220419111650.1582274-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-crypto@vger.kernel.org In the event that random_get_entropy() can't access a cycle counter or similar, falling back to returning 0 is really not the best we can do. Instead, at least calling random_get_entropy_fallback() would be preferable, because that always needs to return _something_, even falling back to jiffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. This is accomplished by just including the asm-generic code like on other architectures, which means we can get rid of the empty stub function here. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Signed-off-by: Jason A. Donenfeld --- arch/um/include/asm/timex.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/um/include/asm/timex.h b/arch/um/include/asm/timex.h index e392a9a5bc9b..9f27176adb26 100644 --- a/arch/um/include/asm/timex.h +++ b/arch/um/include/asm/timex.h @@ -2,13 +2,8 @@ #ifndef __UM_TIMEX_H #define __UM_TIMEX_H -typedef unsigned long cycles_t; - -static inline cycles_t get_cycles (void) -{ - return 0; -} - #define CLOCK_TICK_RATE (HZ) +#include + #endif -- 2.35.1