Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3252844rwo; Mon, 24 Jul 2023 08:22:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlGtBcUDzICyDUO5bJ+sotp9zSVm4ESKkza5WeOFdvr0XwFOux0VYdfVJgvgAixV0dmDSPFe X-Received: by 2002:a05:6512:3613:b0:4fb:893a:d322 with SMTP id f19-20020a056512361300b004fb893ad322mr5031817lfs.68.1690212173135; Mon, 24 Jul 2023 08:22:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690212173; cv=none; d=google.com; s=arc-20160816; b=dI1HsjcXJPLgYjKC9ceU6gSzNW6xla021wfJby0MQWEI4Xm0r6a+X7h8YJ/VkdEhg8 q5d/no+Lx/osKsFksh1p+sRjWwE/UyzMIYddFpDqWjxNNLhU4MxI3oC5ldo/EK1dnnr2 ujEhOYTMCtIuLpRN6qLrFppljXg9MnOLO3Y/L0pJprtyacZFLyBbMBT+ZV8U5XbcwkVQ 5L2VayV3gsewf/Cr7mT/0fx4juC+E778qg3Fn46Ms3zFv3VsMJIdbzoxnTc+m2C+3qBd QWKRGyTw836vPLTifwj2mowLPp3yiVG1uw+bdkIxhJvz6CRknDm/Rp+nLXUxttYRsG6V qjxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PR3jZRQ7jomDe93GjnCtCqKHs9vvjwcCaaPlUByugZU=; fh=BulyNLHtXa+jPFZDpgHE97o7cT2zLHhzGE8VwWHiSWM=; b=OrOox15tHsNYNKBSjefF7krkTlZDA11vU0ziyFY+fSobex/vs6OY9dI4nWgdTT4AL/ cnTE/QkBehUP8BZZP9OS5MjHPWLslQ3R8V7/nZn1ubVh2b2U8CdCaK8BB59FQsJwEdnH UaUlfLtNc7h5OauqS/Jd4Ui7QgdkGf4Qccepkh8Ep/UNBELiqOfg0ek5tmo8/emoG/nX IgZDsCcva8syZAilN829cOg4mJ7zfpSaAWhtfjpd3BDnhFEWjStABeKp7D5OgyaOwKyh +MxMHnL/jr7ZNNw0cf1kk7jKXhrYngYoeWcfVLAKsEouX+WmVJGxbeA8o2T+diobP4jY 7Cvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=I7sLOnHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020aa7d647000000b0051e041a38f0si6668984edr.596.2023.07.24.08.22.28; Mon, 24 Jul 2023 08:22:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@microchip.com header.s=mchp header.b=I7sLOnHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231418AbjGXOcR (ORCPT + 99 others); Mon, 24 Jul 2023 10:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbjGXOcQ (ORCPT ); Mon, 24 Jul 2023 10:32:16 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8232D10F0; Mon, 24 Jul 2023 07:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1690209129; x=1721745129; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=8lSqctVplAIarKGMJtl03N2iVLoJAxL48zKohtkfpEY=; b=I7sLOnHoVcjr7fkPhbt4R3jva+sRv+KDKhbSdKC/+F2pAIao7UFmLPTt f15XhJGXpUw0WYm0qhc1tsBRXtcQ2LHDdgvqNGPLOcxEotDjyDc1SAUnr YzgVOLUFOj/1kQyLRXJDGn+gxgCM/zDlSGoE8PUA5GVBzeDN6IaiiXRqK q+v8Z9iyllFOogEsH+1wLIRKEuOlq+N9qzTRpJivp2kR/GZW4xSwrpBWP Uy8L1ivBhYCt0QyKnwkrQVDXGxbsMydVOMYoHF9Rb+dpEGCT29GIY38dE qBA8JBpIAs5AQBvSvhQYXonjQyuHBYawQH9fF4wXHSE/0YlGIvE1a439x g==; X-IronPort-AV: E=Sophos;i="6.01,228,1684825200"; d="asc'?scan'208";a="162903015" X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Jul 2023 07:32:08 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 24 Jul 2023 07:31:37 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Mon, 24 Jul 2023 07:31:35 -0700 Date: Mon, 24 Jul 2023 15:31:01 +0100 From: Conor Dooley To: Alexandre Ghiti CC: Paul Walmsley , Palmer Dabbelt , Albert Ou , Ard Biesheuvel , Kees Cook , , , , Subject: Re: [PATCH v6 0/5] riscv: Introduce KASLR Message-ID: <20230724-sanded-dental-c9125c76ad74@wendy> References: <20230722123850.634544-1-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xtSbObKEFv5fOwOJ" Content-Disposition: inline In-Reply-To: <20230722123850.634544-1-alexghiti@rivosinc.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, 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-kernel@vger.kernel.org --xtSbObKEFv5fOwOJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Alex, On Sat, Jul 22, 2023 at 02:38:45PM +0200, Alexandre Ghiti wrote: > The following KASLR implementation allows to randomize the kernel mapping: >=20 > - virtually: we expect the bootloader to provide a seed in the device-tree > - physically: only implemented in the EFI stub, it relies on the firmware= to > provide a seed using EFI_RNG_PROTOCOL. arm64 has a similar implementati= on > hence the patch 3 factorizes KASLR related functions for riscv to take > advantage. >=20 > The new virtual kernel location is limited by the early page table that o= nly > has one PUD and with the PMD alignment constraint, the kernel can only ta= ke > < 512 positions. I gave this all a go today, it seems to do what it it says on the tin, and crashing my kernel does dump out an offset etc. Tested-by: Conor Dooley I'll hopefully get some time later in the week to go through the code. Cheers, Conor. --xtSbObKEFv5fOwOJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZL6LJQAKCRB4tDGHoIJi 0rUmAP434IQTNV26JB6nzkQMeniT7xYLVBw5Vtp0L980VphnTAD/UnQM8ZUEwq2o p+omBnMci+/NF3PBemZTOQee5NYREwg= =PcHz -----END PGP SIGNATURE----- --xtSbObKEFv5fOwOJ--