[PATCH] arm64: fix static data relocations in machine_apply_elf_rel()

2022-03-30 Thread Pingfan Liu
As for 'static data relocations', instead of patching an instruction (OR ops), it should be assigned to value directly. Signed-off-by: Pingfan Liu Cc: Geoff Levand Cc: Catalin Marinas Cc: Simon Horman To: kexec@lists.infradead.org --- kexec/arch/arm64/kexec-arm64.c | 5 ++--- 1 file changed,

[PATCH 0/2] misc improvement of code

2022-03-30 Thread Pingfan Liu
Cc: Simon Horman To: kexec@lists.infradead.org Pingfan Liu (2): arm64/crashdump-arm64: explicit type conversion to suppress compiler warning kexec/elf: assign one to align if sh_addralign equals zero kexec/arch/arm64/crashdump-arm64.c | 2 +- kexec/kexec-elf-rel.c | 10 +

[PATCH 1/2] arm64/crashdump-arm64: explicit type conversion to suppress compiler warning

2022-03-30 Thread Pingfan Liu
elf_info.page_offset is 'unsigned long long', while get_page_offset() has the input param as a type of 'unsigned long *'. It demands explicit type casting to mute the compiler warning. Signed-off-by: Pingfan Liu Cc: Simon Horman To: kexec@lists.infradead.org --- kexec/arch/arm64/crashdump-arm64

[PATCH 2/2] kexec/elf: assign one to align if sh_addralign equals zero

2022-03-30 Thread Pingfan Liu
According to ELF specification, if sh_addralign equals zero or one, then the section has no alignment requirement on the start address. (I.e. it can be aligned on 1 byte) Since modern cpu asks the .text, .data, .bss to be aligned on the machine word boundary at least, so in elf_rel_load(), sh_addr

[PATCH 0/3] arm64: add support for new reloc type in kexec-arm64.c

2022-03-30 Thread Pingfan Liu
With GCC 12 or Clang 13, kexec-tools can not load kernel successfully on aarch64. This is caused by some unsupported reloc type in arm64/kexec-arm64.c. This series add support for those reloc type. Cc: Geoff Levand Cc: Catalin Marinas Cc: Simon Horman To: kexec@lists.infradead.org Pingfan Liu

Re: [PATCH] arm64/kexec-arm64: add support for R_AARCH64_LDST128_ABS_LO12_NC rela

2022-03-30 Thread Pingfan Liu
I find that kexec-tools can not work with clang either, compose a series ([PATCH 0/3] arm64: add support for new reloc type in kexec-arm64.c) to fix these relocs issues. So please ignore this thread. Thanks, Pingfan On Thu, Mar 31, 2022 at 9:22 AM Pingfan Liu wrote: > > Sorry for forgetting to

[PATCH 3/3] arm64/kexec-arm64: add support for R_AARCH64_MOVW_UABS_G* rela

2022-03-30 Thread Pingfan Liu
Build kexec-tools with clang(clang version 13.0.1 (Fedora 13.0.1-1.fc36)). Then when kexec loads kernel, it runs into the error message "machine_apply_elf_rel: ERROR Unknown type: 264". This is caused by the following reloc type in purgatory/purgatory.ro, which is not supported yet. R_AARCH64_MO

[PATCH 1/3] arm64/kexec-arm64: add support for R_AARCH64_LDST128_ABS_LO12_NC rela

2022-03-30 Thread Pingfan Liu
GCC 12 has some changes, which affects the generated AArch64 code of kexec-tools. Accordingly, a new rel type R_AARCH64_LDST128_ABS_LO12_NC is confronted by machine_apply_elf_rel() on AArch64. This fails the load of kernel with the message "machine_apply_elf_rel: ERROR Unknown type: 299" Citing f

[PATCH 2/3] arm64/kexec-arm64: use enum to organize the reloc type

2022-03-30 Thread Pingfan Liu
More and more reloc type need to be supported on aarch64. Using enum to organize them to shorten the #ifdef macro list. Signed-off-by: Pingfan Liu Cc: Geoff Levand Cc: Catalin Marinas Cc: Simon Horman To: kexec@lists.infradead.org --- kexec/arch/arm64/kexec-arm64.c | 56 +-

Re: [PATCH] arm64/kexec-arm64: add support for R_AARCH64_LDST128_ABS_LO12_NC rela

2022-03-30 Thread Pingfan Liu
Sorry for forgetting to add the address of the mailing list. On Thu, Mar 31, 2022 at 9:18 AM Pingfan Liu wrote: > > GCC 12 has some changes, which affects the generated AArch64 code of > kexec-tools. > Accordingly, a new rel type R_AARCH64_LDST128_ABS_LO12_NC is confronted > by machine_apply_elf

Re: [PATCH] kexec-tools: fix leak FILE pointer.

2022-03-30 Thread Simon Horman
On Wed, Mar 30, 2022 at 07:09:51PM +0800, Lichen Liu wrote: > Close fp if file size is smaller than 13 bytes. > > Signed-off-by: Lichen Liu Thanks, applied. ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/k

Re: [PATCH v2 -next 5/6] RISC-V: Add purgatory

2022-03-30 Thread kernel test robot
Hi Li, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on next-20220329] url: https://github.com/intel-lab-lkp/linux/commits/Li-Zhengyu/riscv-kexec-add-kexec_file_load-support/20220330-162008 base:c2528a0cdebd8ba7ef30e0655f8ea89f34c3a633 config: riscv

URGENT

2022-03-30 Thread Alyona Kozak
Greetings, Hope you are fine . Please did you got my previous email to you ? With Respect Alyona Kozak ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec

[PATCH] kexec-tools: fix leak FILE pointer.

2022-03-30 Thread Lichen Liu
Close fp if file size is smaller than 13 bytes. Signed-off-by: Lichen Liu --- kexec/lzma.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kexec/lzma.c b/kexec/lzma.c index f27cfe2..2fc07e6 100644 --- a/kexec/lzma.c +++ b/kexec/lzma.c @@ -170,8 +170,11 @@ int is_lzma_file

Re: [PATCH v2] kexec-tools: Determine if the image is lzma commpressed

2022-03-30 Thread Lichen Liu
Hi Simon, I will send a new patch to fix it. Thanks! On Wed, Mar 30, 2022 at 5:14 PM Simon Horman wrote: > > On Wed, Mar 30, 2022 at 01:33:26PM +0800, Lichen Liu wrote: > > Currently there are 2 functions for decompressing compressed image. The > > zlib_decompress_file() will determine if the

Re: [PATCH v2] purgatory: do not enable vectorization automatically for purgatory compiling

2022-03-30 Thread Baoquan He
On 03/30/22 at 11:14am, Simon Horman wrote: > On Tue, Mar 29, 2022 at 06:12:28PM +0800, Baoquan He wrote: > > Redhat CKI reported kdump kernel will hang a while very early after crash > > triggered, then reset to firmware to reboot. > > > > This failure can only be observed with kdump or kexec reb

Re: [PATCH v2] purgatory: do not enable vectorization automatically for purgatory compiling

2022-03-30 Thread Simon Horman
On Tue, Mar 29, 2022 at 06:12:28PM +0800, Baoquan He wrote: > Redhat CKI reported kdump kernel will hang a while very early after crash > triggered, then reset to firmware to reboot. > > This failure can only be observed with kdump or kexec reboot via > kexec_load system call. With kexec_file_load

Re: [PATCH v2] kexec-tools: Determine if the image is lzma commpressed

2022-03-30 Thread Simon Horman
On Wed, Mar 30, 2022 at 01:33:26PM +0800, Lichen Liu wrote: > Currently there are 2 functions for decompressing compressed image. The > zlib_decompress_file() will determine if the image is compressed by gzip > before read, but lzma_decompress_file() will not. This can cause misleading > informatio

Re: [ANNOUNCE] kexec-tools v2.0.24 preparation

2022-03-30 Thread Simon Horman
On Wed, Mar 30, 2022 at 11:07:01AM +0800, Dave Young wrote: > On 03/29/22 at 06:16pm, Baoquan He wrote: > > On 03/29/22 at 11:17am, Simon Horman wrote: > > > On Sat, Mar 26, 2022 at 02:55:43PM +0800, RuiRui Yang wrote: > > > > Hi Simon, > > > > > > > > Recently RH CKI detected a kexec/kdump failur

[PATCH v2 -next 4/6] RISC-V: Support for kexec_file on panic

2022-03-30 Thread Li Zhengyu
This patch adds support for loading a kexec on panic (kdump) kernel. It has been tested with vmcore-dmesg on riscv64 QEMU on both an smp and a non-smp system. Signed-off-by: Li Zhengyu --- arch/riscv/kernel/elf_kexec.c | 119 +- 1 file changed, 118 insertions(+),

[PATCH v2 -next 3/6] RISC-V: Add kexec_file support

2022-03-30 Thread Li Zhengyu
From: Liao Chang This patch adds support for kexec_file on RISC-V. I tested it on riscv64 QEMU with busybear-linux and single core along with the OpenSBI firmware fw_jump.bin for generic platform. On SMP system, it depends on CONFIG_{HOTPLUG_CPU, RISCV_SBI} to resume/stop hart through OpenSBI fi

[PATCH v2 -next 5/6] RISC-V: Add purgatory

2022-03-30 Thread Li Zhengyu
This patch adds purgatory, the name and concept have been taken from kexec-tools. Purgatory runs between two kernels, and do verify sha256 hash to ensure the kernel to jump to is fine and has not been corrupted after loading. Makefile is modified based on x86 platform. Signed-off-by: Li Zhengyu -

[PATCH v2 -next 2/6] RISC-V: use memcpy for kexec_file mode

2022-03-30 Thread Li Zhengyu
From: Liao Chang The pointer to buffer loading kernel binaries is in kernel space for kexec_fil mode, When copy_from_user copies data from pointer to a block of memory, it checkes that the pointer is in the user space range, on RISCV-V that is: static inline bool __access_ok(unsigned long addr,

[PATCH v2 -next 0/6] riscv: kexec: add kexec_file_load() support

2022-03-30 Thread Li Zhengyu
This patchset implement kexec_file_load() support on riscv, Most of the code is based on the kexec-tool-patch repo developed by Nick Kossifids. This patch series enables us to load the riscv vmlinux by specifying its file decriptor, instead of user-filled buffer via kexec_file_load() syscall. `` C

[PATCH v2 -next 6/6] RISC-V: Load purgatory in kexec_file

2022-03-30 Thread Li Zhengyu
This patch supports kexec_file to load and relocate purgatory. It works well on riscv64 QEMU, being tested with devmem. Signed-off-by: Li Zhengyu --- arch/riscv/kernel/elf_kexec.c | 151 ++ 1 file changed, 151 insertions(+) diff --git a/arch/riscv/kernel/elf_kexe

[PATCH v2 -next 1/6] kexec_file: Fix kexec_file.c build error for riscv platform

2022-03-30 Thread Li Zhengyu
From: Liao Chang When CONFIG_KEXEC_FILE is set for riscv platform, the compilation of kernel/kexec_file.c generate build error: kernel/kexec_file.c: In function 'crash_prepare_elf64_headers': ./arch/riscv/include/asm/page.h:110:71: error: request for member 'virt_addr' in something not a struct