lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e02fdfce-4574-8e7e-ec96-8e8eaa4067bc@huawei.com>
Date:   Mon, 13 Mar 2023 11:13:17 +0800
From:   Li Zhengyu <lizhengyu3@...wei.com>
To:     Torsten Duwe <duwe@....de>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Conor Dooley <conor.dooley@...rochip.com>,
        Palmer Dabbelt <palmer@...belt.com>
CC:     Albert Ou <aou@...s.berkeley.edu>,
        Li Huafei <lihuafei1@...wei.com>,
        Liao Chang <liaochang1@...wei.com>,
        <linux-riscv@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
        <liubao918@...wei.com>
Subject: Re: [PATCH] riscv: relocate R_RISCV_CALL_PLT in kexec_file

On Fri, 10 Mar 2023 19:27:03 +0100, Torsten Duwe <duwe@....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@...e.de>
> Cc: stable@...r.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@...wei.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ