Re: [systemd-devel] [PATCHv5 10/12] arm64/kexec: Add PE image format support

2025-08-19 Thread Pingfan Liu
On Tue, Aug 19, 2025 at 09:24:26AM +0800, Pingfan Liu wrote: > Now everything is ready for kexec PE image parser. Select it on arm64 > for zboot and UKI image support. > > Signed-off-by: Pingfan Liu > Acked-by: Catalin Marinas > Cc: Will Deacon > To: linux-arm-ker..

[systemd-devel] [PATCHv5 12/12] tools/kexec: Add a zboot image building tool

2025-08-18 Thread Pingfan Liu
.data section remains unchanged. Therefore, the .data section offset in the new PE file, plus the payload offset within that section, yields the payload offset within the new PE file. Finally, the new PE file 'zboot.efi' can be got by the command: make -C tools/kexec zboot Signed-off-by:

[systemd-devel] [PATCHv5 11/12] tools/kexec: Introduce a bpf-prog to parse zboot image format

2025-08-18 Thread Pingfan Liu
ced from the size of the uncompressed file 'vmlinux.bin', which is usually less than 64MB. With the help of a group of bpf kfuncs: bpf_decompress(), bpf_copy_to_kernel(), bpf_mem_range_result_put(), this bpf-prog stores the uncompressed kernel image inside the kernel space. Signed-o

[systemd-devel] [PATCHv5 10/12] arm64/kexec: Add PE image format support

2025-08-18 Thread Pingfan Liu
Now everything is ready for kexec PE image parser. Select it on arm64 for zboot and UKI image support. Signed-off-by: Pingfan Liu Acked-by: Catalin Marinas Cc: Will Deacon To: linux-arm-ker...@lists.infradead.org --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/kexec.h

[systemd-devel] [PATCHv5 08/12] kexec: Factor out routine to find a symbol in ELF

2025-08-18 Thread Pingfan Liu
The routine to search a symbol in ELF can be shared, so split it out. Signed-off-by: Pingfan Liu Cc: Baoquan He Cc: Dave Young Cc: Andrew Morton Cc: Philipp Rudo To: ke...@lists.infradead.org --- include/linux/kexec.h | 8 kernel/kexec_file.c | 86

[systemd-devel] [PATCHv5 09/12] kexec: Integrate bpf light skeleton to load zboot image

2025-08-18 Thread Pingfan Liu
ation of the ringbuf size, the bpf-prog writer can change its proper size according to the kernel image size without modifying the kernel code) Signed-off-by: Pingfan Liu Cc: Alexei Starovoitov Cc: Baoquan He Cc: Dave Young Cc: Andrew Morton Cc: Philipp Rudo Cc: b...@vg

[systemd-devel] [PATCHv5 07/12] kexec: Introduce a bpf-prog lskel to parse PE file

2025-08-18 Thread Pingfan Liu
SEC("fentry.s/bpf_post_handle_pefile") They are fixed and provided for all kinds of bpf-prog which interacts with the kexec kernel component. Signed-off-by: Pingfan Liu Cc: Alexei Starovoitov Cc: Baoquan He Cc: Dave Young Cc: Andrew Morton Cc: Philipp Rudo Cc: b...@vger.kernel.org

[systemd-devel] [PATCHv5 06/12] kexec: Integrate with the introduced bpf kfuncs

2025-08-18 Thread Pingfan Liu
This patch does two things: First, register as a listener on bpf_copy_to_kernel() Second, in order that the hooked bpf-prog can call the sleepable kfuncs, bpf_handle_pefile and bpf_post_handle_pefile are marked as KF_SLEEPABLE. Signed-off-by: Pingfan Liu Cc: Alexei Starovoitov Cc: Philipp Rudo

[systemd-devel] [PATCHv5 05/12] kexec: Introduce kexec_pe_image to parse and load PE file

2025-08-18 Thread Pingfan Liu
the bpf bytecode is extracted from the '.bpf' section in the PE file. Signed-off-by: Pingfan Liu Cc: Baoquan He Cc: Dave Young Cc: Andrew Morton Cc: Philipp Rudo To: ke...@lists.infradead.org --- include/linux/kexec.h | 1 + kernel/Kconfig.kexec| 9 ++ kernel/Ma

[systemd-devel] [PATCHv5 04/12] bpf: Introduce decompressor kfunc

2025-08-18 Thread Pingfan Liu
e 2MB each time with a transient virtual address, up to a 1GB limit. After decompression finishes, it presents all of the decompressed data in a new unified virtual address space. Signed-off-by: Pingfan Liu Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: John Fastabend Cc: Andrii Nakryiko Cc: M

[systemd-devel] [PATCHv5 03/12] bpf: Introduce bpf_copy_to_kernel() to buffer the content from bpf-prog

2025-08-18 Thread Pingfan Liu
parsed and then forwarded to the kernel for subsequent parsing stages. This necessitates a mechanism to channel the intermedia data from the BPF program directly to the kernel. bpf_kexec_carrier() is introduced to serve that purpose. Signed-off-by: Pingfan Liu Cc: Alexei Starovoitov Cc: Daniel

[systemd-devel] [PATCHv5 02/12] lib/decompress: Keep decompressor when CONFIG_KEEP_COMPRESSOR

2025-08-18 Thread Pingfan Liu
The KEXE PE format parser needs the kernel built-in decompressor to decompress the kernel image. So moving the decompressor out of __init sections. Signed-off-by: Pingfan Liu Cc: Andrew Morton To: linux-ker...@vger.kernel.org --- include/linux/decompress/mm.h | 7 +++ lib/Kconfig

[systemd-devel] [PATCHv5 01/12] kexec_file: Make kexec_image_load_default global visible

2025-08-18 Thread Pingfan Liu
In latter patches, PE format parser will extract the linux kernel inside and try its real format parser. So making kexec_image_load_default global. Signed-off-by: Pingfan Liu Cc: Baoquan He Cc: Dave Young Cc: Andrew Morton To: ke...@lists.infradead.org --- include/linux/kexec.h | 1 + kernel

[systemd-devel] [PATCHv5 00/12] kexec: Use BPF lskel to enable kexec to load PE format boot image

2025-08-18 Thread Pingfan Liu
and mark them sleepable - use listener and publisher model to implement bpf_copy_to_kernel() - keep each introduced kfunc under the control of memcg RFCv1 -> RFCv2 - Use bpf kfunc instead of helper - Use C source code to generate the light skeleton file *** BLURB HERE *** Pingfan Liu (12)