[PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures

Petr Tesarik posted 3 patches 2 years, 6 months ago
arch/riscv/kernel/elf_kexec.c    |  3 ++-
arch/riscv/purgatory/Makefile    | 26 +-------------------------
arch/riscv/purgatory/purgatory.c |  6 ++++--
3 files changed, 7 insertions(+), 28 deletions(-)
[PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
Posted by Petr Tesarik 2 years, 6 months ago
From: Petr Tesarik <petr.tesarik.ext@huawei.com>

The kexec_file_load(2) syscall does not work at least in some kernel
builds. For details see the relevant section in this blog post:

https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html

This patch series handles an additional relocation types, removes the need
to implement a Global Offset Table (GOT) for the purgatory and fixes the
placement of initrd.

Changelog
=========

Changes from v1:
- Replace memcmp() with a for loop.
- Drop handling of 16-bit add/subtract relocations. They were used only
  by alternatives in strcmp(), which was referenced only by string.o.
- Add the initrd placement fix.

Petr Tesarik (1):
  riscv/purgatory: do not link with string.o and its dependencies

Torsten Duwe (2):
  riscv/kexec: handle R_RISCV_CALL_PLT relocation type
  riscv/kexec: load initrd high in available memory

 arch/riscv/kernel/elf_kexec.c    |  3 ++-
 arch/riscv/purgatory/Makefile    | 26 +-------------------------
 arch/riscv/purgatory/purgatory.c |  6 ++++--
 3 files changed, 7 insertions(+), 28 deletions(-)

-- 
2.25.1
Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
Posted by patchwork-bot+linux-riscv@kernel.org 2 years, 6 months ago
Hello:

This series was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 26 Jul 2023 11:53:58 +0200 you wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Here is the summary with links:
  - [v2,1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
    https://git.kernel.org/riscv/c/1be0b05b3a80
  - [v2,2/3] riscv/purgatory: do not link with string.o and its dependencies
    (no matching commit)
  - [v2,3/3] riscv/kexec: load initrd high in available memory
    https://git.kernel.org/riscv/c/0ccd2e803745

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
Posted by Petr Tesarik 2 years, 6 months ago
Hi,

On 7/26/2023 11:53 AM, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> This patch series handles an additional relocation types, removes the need
> to implement a Global Offset Table (GOT) for the purgatory and fixes the
> placement of initrd.

It seems there are no objections, but what is the plan here? Take it
into 6.5 as a fix, or let it go through for-next?

Petr T

> Changelog
> =========
> 
> Changes from v1:
> - Replace memcmp() with a for loop.
> - Drop handling of 16-bit add/subtract relocations. They were used only
>   by alternatives in strcmp(), which was referenced only by string.o.
> - Add the initrd placement fix.
> 
> Petr Tesarik (1):
>   riscv/purgatory: do not link with string.o and its dependencies
> 
> Torsten Duwe (2):
>   riscv/kexec: handle R_RISCV_CALL_PLT relocation type
>   riscv/kexec: load initrd high in available memory
> 
>  arch/riscv/kernel/elf_kexec.c    |  3 ++-
>  arch/riscv/purgatory/Makefile    | 26 +-------------------------
>  arch/riscv/purgatory/purgatory.c |  6 ++++--
>  3 files changed, 7 insertions(+), 28 deletions(-)
>
Re: (subset) [PATCH v2 0/3] RISC-V: Fix a few kexec_file_load(2) failures
Posted by Palmer Dabbelt 2 years, 6 months ago
On Wed, 26 Jul 2023 11:53:58 +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@huawei.com>
> 
> The kexec_file_load(2) syscall does not work at least in some kernel
> builds. For details see the relevant section in this blog post:
> 
> https://sigillatum.tesarici.cz/2023-07-21-state-of-riscv64-kdump.html
> 
> [...]

Applied, thanks!

[1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type
      https://git.kernel.org/palmer/c/d0b4f95a5103
[3/3] riscv/kexec: load initrd high in available memory
      https://git.kernel.org/palmer/c/49af7a2cd5f6

Best regards,
-- 
Palmer Dabbelt <palmer@rivosinc.com>