Message ID | 20230310182726.GA25154@lst.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1039408wrd; Fri, 10 Mar 2023 10:46:07 -0800 (PST) X-Google-Smtp-Source: AK7set9eFYyT8qu5lvd3MOkPzInhiYh9/jd06m8O4Ulx+d9ZIiMxY8Ttq9USB+gRxPwWMDW9Tnwh X-Received: by 2002:a17:90b:3b90:b0:234:b35b:f905 with SMTP id pc16-20020a17090b3b9000b00234b35bf905mr28627275pjb.2.1678473967076; Fri, 10 Mar 2023 10:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678473967; cv=none; d=google.com; s=arc-20160816; b=FtrbU+XaHb5upNT1oCZcKYMW1zP1ng+1cdC4nYB8TlDCf6JOlJv217heS50DuYxUy9 xgX5d5OGa8S1s94b8yGEMWMMP8XFSxd3bnGFhsCbnbhWkYyWx60XviJVJEAchtdvqELf 8eCJFGjiTKXzoAtqLQjJodXQb4M2xnVJeACijYzxdnfpi6t+zPsrvPfPhN+i3/HwODvz IHMAxkNXQ3bge2sqqFuCzTcjxA9ReRHN7jJ/cHrzz9X6ZfXrZ+xla0d7j+U6WIxjkch4 H09NMS7H2gV1Lsv+J9Li/hR4h/Yl1HuMtMaoOoFUZob6C+Jraq21bMNzBwMmTUowlEjb iEKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=bMKdu59QN1K1eeFPH3Zg4eX8zroAOtzv8asIbcYiozQ=; b=sYcPvy9szsfty+judsj1a2nVnTNrOxZfmfitLxigVLnajlFRNviIx1axC09eK1bj/B hP+O0gE6wlyfyIBVMnNejN+D0X4Xbjlm31P6RQCsawzFuopT3MUM0ue7ELLGYuXMkqDE S5OGdvd/pkKKx/f+Rn4vpesG1cXlGU8cf0oaIYSQ2G7j2TTCjjZK0NWRtc3kR9yl17RM T0OgVrMSSm+AM8s65jV6oFGjajOZiNW4FPwMyl6e8XyILjHtaK7Sk8aDqBcVDJljhwsV eFwa0X9wRh5ZheGi7Xa5ZiGySeANbqGl9rzNN1KaE0KRYRggLzY9+8YeBd4+JjgYCNRY dLkw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a17090a3e0300b0023a6f8f2c0esi389588pjc.172.2023.03.10.10.45.54; Fri, 10 Mar 2023 10:46:07 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230455AbjCJS1e (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Fri, 10 Mar 2023 13:27:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjCJS1c (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Mar 2023 13:27:32 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 672D15D44C for <linux-kernel@vger.kernel.org>; Fri, 10 Mar 2023 10:27:31 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2005) id 038CF67373; Fri, 10 Mar 2023 19:27:27 +0100 (CET) Date: Fri, 10 Mar 2023 19:27:26 +0100 From: Torsten Duwe <duwe@lst.de> To: Li Zhengyu <lizhengyu3@huawei.com>, Paul Walmsley <paul.walmsley@sifive.com>, Conor Dooley <conor.dooley@microchip.com>, Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu>, Li Huafei <lihuafei1@huawei.com>, Liao Chang <liaochang1@huawei.com>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file Message-ID: <20230310182726.GA25154@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760007518153239589?= X-GMAIL-MSGID: =?utf-8?q?1760007518153239589?= |
Series |
riscv: relocate R_RISCV_CALL_PLT in kexec_file
|
|
Commit Message
Torsten Duwe
March 10, 2023, 6:27 p.m. UTC
Depending on the toolchain (here: gcc-12, binutils-2.40) the
relocation entries for function calls are no longer R_RISCV_CALL, but
R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will
fail with
kexec_image: Unknown rela relocation: 19
kexec_image: Error loading purgatory ret=-8
The binary code at the call site remains the same, so tell
arch_kexec_apply_relocations_add() to handle _PLT alike.
fixes: 838b3e28488f702 ("Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Cc: stable@vger.kernel.org
---
Comments
On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > Depending on the toolchain (here: gcc-12, binutils-2.40) the > relocation entries for function calls are no longer R_RISCV_CALL, but > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > fail with > > kexec_image: Unknown rela relocation: 19 > kexec_image: Error loading purgatory ret=-8 > > The binary code at the call site remains the same, so tell > arch_kexec_apply_relocations_add() to handle _PLT alike. R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. See Enum 18-19 in Table 3. Relocation types from https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc . It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT") https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > Signed-off-by: Torsten Duwe <duwe@suse.de> > Cc: stable@vger.kernel.org > > --- > --- a/arch/riscv/kernel/elf_kexec.c > +++ b/arch/riscv/kernel/elf_kexec.c > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > * sym, instead of searching the whole relsec. > */ > case R_RISCV_PCREL_HI20: > + case R_RISCV_CALL_PLT: > case R_RISCV_CALL: > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > ENCODE_UJTYPE_IMM(val - addr); > > . Palmer, please apply these references to the commit message. Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com>
On Mon, 13 Mar 2023 11:13:17 +0800 Li Zhengyu <lizhengyu3@huawei.com> wrote: > On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > > Depending on the toolchain (here: gcc-12, binutils-2.40) the > > relocation entries for function calls are no longer R_RISCV_CALL, but > > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > > fail with > > > > kexec_image: Unknown rela relocation: 19 > > kexec_image: Error loading purgatory ret=-8 > > > > The binary code at the call site remains the same, so tell > > arch_kexec_apply_relocations_add() to handle _PLT alike. > > R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. > > See Enum 18-19 in Table 3. Relocation types from > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc > . > > It was deprecated in ("Deprecated R_RISCV_CALL, prefer > R_RISCV_CALL_PLT") > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > > > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > > Signed-off-by: Torsten Duwe <duwe@suse.de> > > Cc: stable@vger.kernel.org > > > > --- > > --- a/arch/riscv/kernel/elf_kexec.c > > +++ b/arch/riscv/kernel/elf_kexec.c > > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > > * sym, instead of searching the whole relsec. > > */ > > case R_RISCV_PCREL_HI20: > > + case R_RISCV_CALL_PLT: > > case R_RISCV_CALL: > > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > > ENCODE_UJTYPE_IMM(val - addr); > > > > . > > Palmer, please apply these references to the commit message. > > Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com> > Ping?
On Tue, Mar 21, 2023 at 04:03:49PM +0100, Torsten Duwe wrote: > On Mon, 13 Mar 2023 11:13:17 +0800 > Li Zhengyu <lizhengyu3@huawei.com> wrote: > > > On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > > > Depending on the toolchain (here: gcc-12, binutils-2.40) the > > > relocation entries for function calls are no longer R_RISCV_CALL, but > > > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > > > fail with > > > > > > kexec_image: Unknown rela relocation: 19 > > > kexec_image: Error loading purgatory ret=-8 > > > > > > The binary code at the call site remains the same, so tell > > > arch_kexec_apply_relocations_add() to handle _PLT alike. > > > > R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. > > > > See Enum 18-19 in Table 3. Relocation types from > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc > > . > > > > It was deprecated in ("Deprecated R_RISCV_CALL, prefer > > R_RISCV_CALL_PLT") > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > > > > > > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > > > Signed-off-by: Torsten Duwe <duwe@suse.de> > > > Cc: stable@vger.kernel.org > > > > > > --- > > > --- a/arch/riscv/kernel/elf_kexec.c > > > +++ b/arch/riscv/kernel/elf_kexec.c > > > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > > > * sym, instead of searching the whole relsec. > > > */ > > > case R_RISCV_PCREL_HI20: > > > + case R_RISCV_CALL_PLT: > > > case R_RISCV_CALL: > > > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > > > ENCODE_UJTYPE_IMM(val - addr); > > > > > > . > > > > Palmer, please apply these references to the commit message. > > > > Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com> > > > > Ping? It's not been all that longer than a week & you're in patchwork so you won't be forgotten, but I noticed a complaint when I went looking on patchwork about your fixes tag: Commit: f28b81e30b4b ("riscv: relocate R_RISCV_CALL_PLT in kexec_file") Fixes tag: fixes: 838b3e28488f702 ("Load purgatory in kexec_file") Has these problem(s): - Subject does not match target commit subject Just use git log -1 --format='Fixes: %h ("%s")' The fixes tag should be: Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file") Note the capital F & the missed RISC-V: prefix, checkpatch should have complained about this. Checkpatch also complains that your suse email in the Signoff doesn't match the lst.de email that you used to send the patch (IOW you're missing a From: header that send-email would add). Could you fix those things up please & I suppose you can take the opportunity to make the changes that Li Zhengyu suggested to the commit message itself at the same time. Thanks, Conor.
Hey Torsten, On Tue, Mar 21, 2023 at 03:35:38PM +0000, Conor Dooley wrote: > On Tue, Mar 21, 2023 at 04:03:49PM +0100, Torsten Duwe wrote: > > On Mon, 13 Mar 2023 11:13:17 +0800 > > Li Zhengyu <lizhengyu3@huawei.com> wrote: > > > > > On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@lst.de> wrote: > > > > Depending on the toolchain (here: gcc-12, binutils-2.40) the > > > > relocation entries for function calls are no longer R_RISCV_CALL, but > > > > R_RISCV_CALL_PLT. When trying kexec_load_file on such kernels, it will > > > > fail with > > > > > > > > kexec_image: Unknown rela relocation: 19 > > > > kexec_image: Error loading purgatory ret=-8 > > > > > > > > The binary code at the call site remains the same, so tell > > > > arch_kexec_apply_relocations_add() to handle _PLT alike. > > > > > > R_RISCV_CALL has already been deprecated, and replaced by R_RISCV_CALL_PLT. > > > > > > See Enum 18-19 in Table 3. Relocation types from > > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc > > > . > > > > > > It was deprecated in ("Deprecated R_RISCV_CALL, prefer > > > R_RISCV_CALL_PLT") > > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > > > > > > > > > > fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > > > > Signed-off-by: Torsten Duwe <duwe@suse.de> > > > > Cc: stable@vger.kernel.org > > > > > > > > --- > > > > --- a/arch/riscv/kernel/elf_kexec.c > > > > +++ b/arch/riscv/kernel/elf_kexec.c > > > > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > > > > * sym, instead of searching the whole relsec. > > > > */ > > > > case R_RISCV_PCREL_HI20: > > > > + case R_RISCV_CALL_PLT: > > > > case R_RISCV_CALL: > > > > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > > > > ENCODE_UJTYPE_IMM(val - addr); > > > > > > > > . > > > > > > Palmer, please apply these references to the commit message. > > > > > > Reviewed-by: Li Zhengyu <lizhengyu3@huawei.com> > > > > > > > Ping? > > It's not been all that longer than a week & you're in patchwork so you > won't be forgotten, Turns out it did get forgotten, or more accurately, marked as "Changes Requested". > but I noticed a complaint when I went looking on > patchwork about your fixes tag: > > Commit: f28b81e30b4b ("riscv: relocate R_RISCV_CALL_PLT in kexec_file") > Fixes tag: fixes: 838b3e28488f702 ("Load purgatory in kexec_file") > Has these problem(s): > - Subject does not match target commit subject > Just use > git log -1 --format='Fixes: %h ("%s")' > > The fixes tag should be: > Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file") > > Note the capital F & the missed RISC-V: prefix, checkpatch should have > complained about this. > Checkpatch also complains that your suse email in the Signoff doesn't > match the lst.de email that you used to send the patch (IOW you're > missing a From: header that send-email would add). > > Could you fix those things up please & I suppose you can take the > opportunity to make the changes that Li Zhengyu suggested to the commit > message itself at the same time. Would you mind resending this with the Fixes & Signoff corrections? Thanks, Conor.
--- a/arch/riscv/kernel/elf_kexec.c +++ b/arch/riscv/kernel/elf_kexec.c @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, * sym, instead of searching the whole relsec. */ case R_RISCV_PCREL_HI20: + case R_RISCV_CALL_PLT: case R_RISCV_CALL: *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | ENCODE_UJTYPE_IMM(val - addr);