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: <20230725121538.2bb4b64f@meshulam.tesarici.cz>
Date:   Tue, 25 Jul 2023 12:15:38 +0200
From:   Petr Tesařík <petr@...arici.cz>
To:     Petr Tesarik <petrtesarik@...weicloud.com>
Cc:     Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Conor Dooley <conor.dooley@...rochip.com>,
        Li Huafei <lihuafei1@...wei.com>,
        Liao Chang <liaochang1@...wei.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Alyssa Ross <hi@...ssa.is>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Ricardo Ribalda <ribalda@...omium.org>,
        Kees Cook <keescook@...omium.org>,
        Heiko Stuebner <heiko@...ech.de>,
        Li Zhengyu <lizhengyu3@...wei.com>,
        linux-riscv@...ts.infradead.org (open list:RISC-V ARCHITECTURE),
        linux-kernel@...r.kernel.org (open list),
        Roberto Sassu <roberto.sassu@...weicloud.com>,
        Torsten Duwe <duwe@....de>, Torsten Duwe <duwe@...e.de>
Subject: Re: [PATCH v1 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation
 type

+Cc Torsten (somehow missed from the original Cc list).

Petr T

On Tue, 25 Jul 2023 10:44:25 +0200
Petr Tesarik <petrtesarik@...weicloud.com> wrote:

> From: Torsten Duwe <duwe@...e.de>
> 
> R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum
> 18-19 in Table 3. Relocation types here:
> 
> 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
> 
> Recent tools (at least GNU binutils-2.40) already use R_RISCV_CALL_PLT.
> Kernels built with such binutils fail kexec_load_file(2) 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: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Torsten Duwe <duwe@...e.de>
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@...wei.com>
> Cc: Li Zhengyu <lizhengyu3@...wei.com>
> Cc: stable@...r.kernel.org
> ---
>  arch/riscv/kernel/elf_kexec.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
> index 5372b708fae2..38390d3bdcac 100644
> --- 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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ