Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1289764ybm; Tue, 21 May 2019 11:34:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlSuwLi8lE2+HV/28wR7pOYE2ZNWjXXAvcvZyVmdOf+c/cKS6Rk2xS9sdJvqfmmPS/djjN X-Received: by 2002:a63:1c16:: with SMTP id c22mr23779479pgc.333.1558463686557; Tue, 21 May 2019 11:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558463686; cv=none; d=google.com; s=arc-20160816; b=pNtF4wGVypQH1oKgSvEKvb9rg5hLG9/9jW7nOCwh+82n9mLWJDHLu3t7XnOQBZd2ip nyzrVMSGvr1qISmB+0QwERVv9LgI2g5KHOAFrizRbGygxSuxMsXKfELa6fUHCove3W9K nJLP4Ha+Di84+CD/vYQuAjcZdAZb/c10FZsyX1ESLbTbGjP2fIMuMbaf5hpXYsevwuq8 3MAVeMDc7QK0O+NOo7DLnESHSXGgiSKFEW0Ukq+UDClVXhLFokBxJ1EaDS+ds/fqHexr smNmS2ZJocZyHHyoArypVGlvziQ4orjn9KX9wBvwRl3ds8L7439BSbBoHOtmqCdoONyu XIDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=X1cqYjgQ6ZCg4XuZ8EIpOeizbJ5qVwXUyTiLD2TEdX8=; b=ZuX6wZ+p+mlnjObGAUZbEE4QpJ/0fwgjFH+Mo1ZtDKEVP1v5pgGA9e5bIGOLbNC1Gl btijN2DWXzmi1eLT1X6JK1+9ohi82EBVkXOgl+j0l2RyFiyCJfqpK5haeN7xEiFvSWYJ 9j/JnZw7oXKOHXErRQ2vuPgxEuxEP34IDYAzPyDP/0DOAz8gfstJm7HDcxcOznlL2bbO ELup6JGwaTqJ5760migl700CEqb16AbjU7ydGFrLdN5b6K+tabx7pSk81J4tn4C+zHnS V4KtdOHoXjmgSiTkmNJ4Y9PaFfe2tzh6iQ3v1/Hbrop5jL0mVnXTMxczw0K3QJTmGO0Z KN8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qlKEBLZM; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si24799499pfc.158.2019.05.21.11.34.25; Tue, 21 May 2019 11:34:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qlKEBLZM; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728055AbfEUSeV (ORCPT + 99 others); Tue, 21 May 2019 14:34:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:60946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727969AbfEUSeV (ORCPT ); Tue, 21 May 2019 14:34:21 -0400 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DE3E62173E; Tue, 21 May 2019 18:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558463660; bh=TS+Myr7yTT1qT00ODngyVPlLPpDgzJtrP5FUpXyLIEs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qlKEBLZMfmLyAMNkN9oCsU/Wup5zhTA9zasTLh40i5Zyp8qlqlklHK/+m2/KGngOA pixi4WTFD9n5AjTcIiG1TLcRJkcI8p+yapxLMdOLxC1pPHv+UveLyUuFDmm2loPgD6 2kTmneGIO6MOBoGzSbrjqVpWxH879GcvzelQ5xMI= Date: Tue, 21 May 2019 11:34:18 -0700 From: Eric Biggers To: Geert Uytterhoeven Cc: Herbert Xu , Thomas Gleixner , Daniel Lezcano , Linux Crypto Mailing List , Linux Kernel Mailing List , Linux-Renesas , Linux ARM Subject: Re: crypto: run initcalls for generic implementations earlier Message-ID: <20190521183417.GA121164@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, May 21, 2019 at 06:39:00PM +0200, Geert Uytterhoeven wrote: > Hi Eric, > > On Tue, May 7, 2019 at 5:26 AM Linux Kernel Mailing List > wrote: > > Commit: c4741b23059794bd99beef0f700103b0d983b3fd > > Parent: 40153b10d91c9e25f912344ba6ce1f0874400659 > > Refname: refs/heads/master > > Web: https://git.kernel.org/torvalds/c/c4741b23059794bd99beef0f700103b0d983b3fd > > Author: Eric Biggers > > AuthorDate: Thu Apr 11 21:57:42 2019 -0700 > > Committer: Herbert Xu > > CommitDate: Thu Apr 18 22:15:03 2019 +0800 > > > > crypto: run initcalls for generic implementations earlier > > > > Use subsys_initcall for registration of all templates and generic > > algorithm implementations, rather than module_init. Then change > > cryptomgr to use arch_initcall, to place it before the subsys_initcalls. > > > > This is needed so that when both a generic and optimized implementation > > of an algorithm are built into the kernel (not loadable modules), the > > generic implementation is registered before the optimized one. > > Otherwise, the self-tests for the optimized implementation are unable to > > allocate the generic implementation for the new comparison fuzz tests. > > > > Note that on arm, a side effect of this change is that self-tests for > > generic implementations may run before the unaligned access handler has > > been installed. So, unaligned accesses will crash the kernel. This is > > arguably a good thing as it makes it easier to detect that type of bug. > > > > Signed-off-by: Eric Biggers > > Signed-off-by: Herbert Xu > > > --- a/crypto/jitterentropy-kcapi.c > > +++ b/crypto/jitterentropy-kcapi.c > > @@ -198,7 +198,7 @@ static void __exit jent_mod_exit(void) > > crypto_unregister_rng(&jent_alg); > > } > > > > -module_init(jent_mod_init); > > +subsys_initcall(jent_mod_init); > > module_exit(jent_mod_exit); > > > > MODULE_LICENSE("Dual BSD/GPL"); > > This change causes jitterentropy to fail on Renesas SoCs based on > single-core Cortex A9 with: > > jitterentropy: Initialization failed with host not compliant with > requirements: 2 > > This happens because jitterentropy is now initialized before the main > clocksource is activated, i.e. before > > clocksource: Switched to clocksource ostm timer (on RZ/A1) > clocksource: Switched to clocksource fff80000.timer (on R-Mobile A1) > > is printed. > RZ/A1 and R-Mobile A1 SoCs rely on the OSTM resp. TMU timers. > > The issue does not happen on SoCs with Cortex A15 cores (with ARM > architectured timer) or Cortex A9 multicore (with ARM global timer). > > Gr{oetje,eeting}s, > > Geert > Thanks for the bug report. It seems there was no point for my patch to change jitterentropy_rng, since it's not a generic crypto algorithm that has multiple implementations, nor is it testable by the crypto self-tests. So I'll send a patch that changes it back to module_init(). - Eric