Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4862424rwd; Tue, 30 May 2023 10:58:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4P4jxScBQywCdsDSXhioyZpiNSEI++Dsu0ov5xCKuPUYc5P8qQvP9Hg032QlnjrV8SINGB X-Received: by 2002:a05:6a20:2d20:b0:10d:1213:432a with SMTP id g32-20020a056a202d2000b0010d1213432amr3015413pzl.33.1685469496686; Tue, 30 May 2023 10:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685469496; cv=none; d=google.com; s=arc-20160816; b=D+uOU2DywuWXC2csFU3UzBb9WVPKGS5fWjTrCN4SUx5HC+qhexmSMNUgJfaid3F128 uvo2WapBNEo08b30PpeBzfE036a61KYg0DQ+be7VZlmtPsyQ05XL1LjBs0LjFquTjc1z bJ12KkK9j+zZPDTJJmuCmCc9twyOCg9m6AIPym5uWPEAu13ZwG9OpSOQxNR39n63Wmwg 1pRdRttPZwMjiFELqncKqzJL+/fkcoD8WD5WZ4Ways4sxeCEx84jXtZO3z7c3yaGlngp Njv8HEwjMvQLJAggpFiKrQJJBRuVgkWFjneOT+HJk6sXodmjxAE32OPqrsSVCsdXWLp5 43CQ== 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=ZbKD8T6XaIwB4p2rBGYXibCFVbjC5VHZ8efSGsRpmf8=; b=xqW5lZ5/o+fGmPnlBnfWG0cEE82jiEWxamVvoWTAs84Dy3vw9+g24/JJC9P4GoK9Ei ljnhumd3RxYqU/IibLyr5TlOaS3Wowgha80IRaB6YgTr78YIy9aAaKlM6WyXL9SmEOBp OFiri/yqCyhL0Nie/8r66DkZWyhOzx8IOGqxvuE6R/BWFWFjou2RKnkMNlP4wA2OVcyi 3PcyqpNO8pZSQbSLn5X0DPWWkIN4jYLZr1hkqfap19/WcBa/KUxAPy59KK+a9fhq2Pfi 8ffIUKxiOHXB5UGhJscJLkDKyRUQbJ+cnxN7AwJhQc6PUAQJNEdM7bdB/FpjlrYRwJwW eh6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F5RyBCiN; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a63f74e000000b0051b554df1c2si8927168pgk.497.2023.05.30.10.58.03; Tue, 30 May 2023 10:58:16 -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=@kernel.org header.s=k20201202 header.b=F5RyBCiN; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232603AbjE3Rr2 (ORCPT + 99 others); Tue, 30 May 2023 13:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbjE3Rr0 (ORCPT ); Tue, 30 May 2023 13:47:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2780EC for ; Tue, 30 May 2023 10:47:23 -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 5F5AD62EA0 for ; Tue, 30 May 2023 17:47:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF09C433D2; Tue, 30 May 2023 17:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685468842; bh=ZbKD8T6XaIwB4p2rBGYXibCFVbjC5VHZ8efSGsRpmf8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F5RyBCiNjWNomJEEMvP38q3EOc/bloifBXLw76Zo2gV7mUs8f4F1/RFXyZ8vlvMyh PRGJ+HkY49bqp4CW8Bn3jc2Ip1ya2vOhm4lT4pZYsBBni+Lu4PmvN/hYEY5jhgZNVJ SOWuvGQ5mVXBHmwiue8FlqTbYsdgFjZMLf/EE8uVdipOjvBzwtJ6fgyfZ4R/r72TTa 0v2taCtgBw7q7ZEMwXGqV7r4Sh6e0McsVf1WAOEQqQh56sdby20Fq9bo62fpZQRTMh TyFIZ/5mzaWaTjb9EhH4z8MMziZGz8zYgcjbE5bC5IMCXuB8tWOHMSgGcd8/n64GyZ qzRhpd4A8miuQ== Date: Tue, 30 May 2023 18:47:18 +0100 From: Conor Dooley To: Alexandre Ghiti Cc: Conor Dooley , Alexandre Ghiti , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andreas Schwab , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -fixes] riscv: Fix relocatable kernels with early alternatives using -fno-pie Message-ID: <20230530-hatchery-unifier-64d7a2ffe0d0@spud> References: <20230527-hyperlink-doctrine-ef22cfcb508a@spud> <20230528-darkness-grandly-6cb9e014391d@spud> <20230528-uneatable-earpiece-3f8673548863@spud> <20230529-skillet-quarters-3fbc3b6edb3a@spud> <41e57bb9-ce0c-7772-abeb-5c01d5ec19bb@ghiti.fr> <20230530-polka-trifle-7ccd7a093099@wendy> <92d4aaa8-a1ed-74e1-3a22-df9be1ca1e4a@ghiti.fr> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yFAqj5gbekTcSN8V" Content-Disposition: inline In-Reply-To: <92d4aaa8-a1ed-74e1-3a22-df9be1ca1e4a@ghiti.fr> X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 --yFAqj5gbekTcSN8V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 30, 2023 at 04:33:45PM +0200, Alexandre Ghiti wrote: >=20 > On 30/05/2023 13:27, Conor Dooley wrote: > > On Mon, May 29, 2023 at 09:37:28PM +0200, Alexandre Ghiti wrote: > > > On 29/05/2023 21:06, Conor Dooley wrote: > > > > On Mon, May 29, 2023 at 08:51:57PM +0200, Alexandre Ghiti wrote: > > > > > On 28/05/2023 15:56, Conor Dooley wrote: > > > > > > On Sun, May 28, 2023 at 03:42:59PM +0200, Alexandre Ghiti wrote: > > > > > > > Hmmm, it still works for me with both clang and gcc-9. > > > > > > gcc-9 is a bit of a relic, do you have more recent compilers ly= ing > > > > > > around? If not, I can try some older compilers at some point. > > > > > >=20 > > > > > > > You don't have to do that now but is there a way I could get = your compiled > > > > > > > image? With the sha1 used to build it? Sorry, I don't see wha= t happens, I > > > > > > > need to get my hands dirty in some debug! > > > > > > What do you mean by "sha1"? It falls with v6.4-rc1 which is a s= table > > > > > > hash, if that's what you're looking for. > > > > > >=20 > > > > > > Otherwise, > > > > > > https://github.com/ConchuOD/riscv-env/releases/download/v2022.0= 3/vmlinux.bin > > > > > > (ignore the release crap haha, too lazy to find a proper hosting > > > > > > mechanism) > > > > > Ok, I don't get much info without the symbols, can you also provi= de the > > > > > vmlinux please? But at least your image does not boot, not during= the early > > > > > boot though because the mmu is enabled. > > > > Do you see anything print when you try it? Cos I do not. Iff I have= time > > > > tomorrow, I'll go poking with gdb. I'm sorry I have not really done= any > > > > investigating, I have been really busy this last week or so with > > > > dt-binding stuff but I should be freer again from tomorrow. > > > >=20 > > > > https://github.com/ConchuOD/riscv-env/releases/download/v2022.03/vm= linux > > >=20 > > > Better, the trap happens in kasan_early_init() when it tries to acces= s a > > > global symbol using the GOT but ends up with a NULL pointer, which is= weird. > > > So to me, this is not related to kasan, it happens that kasan_early_i= nit() > > > is the first function called after enabling the mmu, I think you may = have an > > > issue with the filling of the relocations. > > Yeah, it reproduces without KASAN. > >=20 > > > Sorry to bother you again, but if > > > at some point you can recompile with DEBUG_INFO enabled, that would be > > > perfect! And also provide the vmlinux.relocs file. Sorry for all that= , too > > > bad I can't reproduce it. > > New vmlinux & vmlinux.relocs here: > > https://microchiptechnology-my.sharepoint.com/:u:/g/personal/conor_dool= ey_microchip_com/EZpFNxYYrnNAh5Z3c-rf0pUBBpdPGTLafqdtfcXRUUBkXw?e=3D7KKMHX > > They're pretty massive unfortunately & hopefully that is not some > > garbage internal-only link. > > .config is a wee bit different, cos different build machine, but the > > problem still manifests on a icicle. I've added it to the tarball just > > in case. >=20 >=20 > Ok so I had to recreate the Image from the files you gave me and it boots > fine using qemu: is that expected? Because you only mention the icicle > above. Unfortunately you sent this one right as I left work.. I ssh'ed in though and ran the vmlinux.bin & had the same issues. Silly question perhaps - is it just not possible to boot something that has been hit with `objcopy -O binary vmlinux vmlinux.bin` with CONFIG_RELOCATABLE? At this point that's the main thing that sticks out to me as being different. You couldn't boot the vmlinux.bin that I sent you either. Cheers, Conor. --yFAqj5gbekTcSN8V Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZHY2pgAKCRB4tDGHoIJi 0hAqAP9YasgLw/aZyFNtndJoOr+ciIy8BdmXFiR3djiyi79E1wEAqr4fh/FlvjgV 896quzlFUVMJxGPMq51gcAZSP9yvdAI= =a/8W -----END PGP SIGNATURE----- --yFAqj5gbekTcSN8V--