Re: [PATCH 2/3] RISC-V: use memcpy for kexec_file mode

2021-10-29 Thread Eric W. Biederman
Liao Chang writes: > 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

[PATCH 2/3] RISC-V: use memcpy for kexec_file mode

2021-10-29 Thread 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, unsigned long

[PATCH 1/3] kexec_file: Fix kexec_file.c build error for riscv platform

2021-10-29 Thread 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 structure or union 110

[PATCH 0/3] riscv: kexec: add kexec_file_load() support

2021-10-29 Thread Liao Chang
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.

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

2021-10-29 Thread 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 firmware, it also

Re: [PATCH] s390/kexec: fix memory leak of ipl report buffer

2021-10-29 Thread Philipp Rudo
Hi Baoquan, On Fri, 29 Oct 2021 17:26:35 +0800 Baoquan He wrote: > A memory leak is reported by kmemleak scanning: > > unreferenced object 0x38000195000 (size 4096): > comm "kexec", pid 8548, jiffies 4294953647 (age 32443.270s) > hex dump (first 32 bytes): > 00 00 00 c8 20 00 00 00 00

Re: [PATCH] crash_dump: fix boolreturn.cocci warning

2021-10-29 Thread Baoquan He
On 10/20/21 at 08:39am, cgel@gmail.com wrote: > From: Changcheng Deng > > ./include/linux/crash_dump.h: 119: 50-51: WARNING: return of 0/1 in > function 'is_kdump_kernel' with return type bool > > Return statements in functions returning bool should use true/false > instead of 1/0. > >

Re: [PATCH v2] crash_dump: remove duplicate include in crash_dump.h

2021-10-29 Thread Baoquan He
On 10/20/21 at 09:06am, cgel@gmail.com wrote: > From: Ye Guojin > > In crash_dump.h, header file is included twice. This > duplication was introduced in commit 65fddcfca8ad("mm: reorder includes > after introduction of linux/pgtable.h") where the order of the header > files is adjusted,

[PATCH] s390/kexec: fix memory leak of ipl report buffer

2021-10-29 Thread Baoquan He
A memory leak is reported by kmemleak scanning: unreferenced object 0x38000195000 (size 4096): comm "kexec", pid 8548, jiffies 4294953647 (age 32443.270s) hex dump (first 32 bytes): 00 00 00 c8 20 00 00 00 00 00 00 c0 02 80 00 00 ... 40 40 40 40 40 40 40 40 00 00 00 00

[PATCH 3/3] kexec_file: clean up arch_kexec_kernel_image_load

2021-10-29 Thread Baoquan He
Function arch_kexec_kernel_image_load() has a common weak version which is a wrapper of kexec_image_load_default() , and has only one arch dependent version in x86_64. Now the x86_64 dependent function is not needed any more. So clean it up. And also rename kexec_image_load_default() to

[PATCH 1/3] x86/kexec: fix memory leak of elf header buffer

2021-10-29 Thread Baoquan He
This is reported by kmemleak detector: unreferenced object 0xc92a9000 (size 4096): comm "kexec", pid 14950, jiffies 4295110793 (age 373.951s) hex dump (first 32 bytes): 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 .ELF 04 00 3e 00 01 00 00 00 00 00 00 00 00 00

[PATCH 0/3] x86/kexec: fix memory leak of elf header buffer

2021-10-29 Thread Baoquan He
The memory leak is reported by kmemleak detector, has been existing for very long time. It could casue much memory loss on large machine with huge memory hotplug which will trigger kdump kernel reloading many times, with kexec_file_load interface. And in patch 2, 3, clean up is done to remove

[PATCH 2/3] x86/kexec: remove incorrect elf header buffer freeing

2021-10-29 Thread Baoquan He
Before calling arch specific kexec_file loading function, the image instance has been initialized. So 'image->elf_headers' must be NULL. It doesn't make sense to free the elf header buffer in the place. So remove it. Signed-off-by: Baoquan He --- arch/x86/kernel/machine_kexec_64.c | 3 --- 1