Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E578CC33CB1 for ; Fri, 17 Jan 2020 15:26:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 83EA32073A for ; Fri, 17 Jan 2020 15:26:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GuRZBBMk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sirena.org.uk header.i=@sirena.org.uk header.b="K34xgQDv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83EA32073A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UvifCA4WcGMJD1XlLHGZhpY9Y6L7fW+8vif+cwta9dk=; b=GuRZBBMkjWJMvy OZ+7Dx+JQftLYCJ3xtaWv9XUSbSlk9+9FZA4xwpGe1MiQ2d6+JNCS2WT44mZKmdIXgHcjVPl4KIDj yxSx3wmaYY9PevgrEtLd9u3QVqSyA27GSHSxJro78MncJKyC6bZHZBUZDJp44UZSF//zNYFwK0FIA fPyk+Wjoj8jIlQxRu37sF++nXxosUv5mzb33t/5dV6In4weBRXb/t1lQoBVN4Mc6EXYHAEne6YKX5 WWyQhySheJsqMNm9P2oFoZt0cqu9s4uto21sB2hd1FvuxvaYhMzvYG7gt3859G3Ptj1uOv9BZfbhE XMb/hX4qpjO2SuNjsdWQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1isTWQ-0006Xf-NV; Fri, 17 Jan 2020 15:26:54 +0000 Received: from heliosphere.sirena.org.uk ([172.104.155.198]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1isTWL-0006Wj-IW for linux-arm-kernel@lists.infradead.org; Fri, 17 Jan 2020 15:26:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qJkC6dW2ZVljeXY7Bkw+krWJcPHn9qUW3kJH5+UG+40=; b=K34xgQDv/NwyKtiaVt80i97YuW pxr9wSRLxqGmmt5JYuFj2Bbr0KhWvLC/pic6xbfiKxDe/hyVbXVVPV6syWy+gsr7OUMGlrZ7/gJOX KwB5ZUIHGRtEomZADAJtr7d37t4oC8DqdZy67EfidAlhL6zVAAPo8/sXr95AUPY5Jg4E=; Received: from fw-tnat-cam4.arm.com ([217.140.106.52] helo=fitzroy.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1isTWF-0006mj-Ih; Fri, 17 Jan 2020 15:26:43 +0000 Received: by fitzroy.sirena.org.uk (Postfix, from userid 1000) id 3A422D02C26; Fri, 17 Jan 2020 15:26:43 +0000 (GMT) From: Mark Brown To: Will Deacon , Catalin Marinas Subject: [PATCH v11 2/2] arm64: Use v8.5-RNG entropy for KASLR seed Date: Fri, 17 Jan 2020 15:26:42 +0000 Message-Id: <20200117152642.4905-3-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200117152642.4905-1-broonie@kernel.org> References: <20200117152642.4905-1-broonie@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200117_072649_606283_80C6C464 X-CRM114-Status: UNSURE ( 9.59 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Mark Brown , Richard Henderson , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org When seeding KALSR on a system where we have architecture level random number generation make use of that entropy, mixing it in with the seed passed by the bootloader. Since this is run very early in init before feature detection is complete we open code rather than use archrandom.h. Signed-off-by: Mark Brown Reviewed-by: Mark Rutland Reviewed-by: Richard Henderson --- arch/arm64/kernel/kaslr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c index 2a11a962e571..53b8a4ee64ff 100644 --- a/arch/arm64/kernel/kaslr.c +++ b/arch/arm64/kernel/kaslr.c @@ -120,6 +120,17 @@ u64 __init kaslr_early_init(u64 dt_phys) return 0; } + /* + * Mix in any entropy obtainable architecturally, open coded + * since this runs extremely early. + */ + if (__early_cpu_has_rndr()) { + unsigned long raw; + + if (__arm64_rndr(&raw)) + seed ^= raw; + } + if (!seed) { kaslr_status = KASLR_DISABLED_NO_SEED; return 0; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel