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

2025-08-18 Thread Pingfan Liu
The objcopy binary can append an section into PE file, but it disregards the DOS header. While the zboot format carries important information: payload offset and size in the DOS header. In order to keep track and update such information, here introducing a dedicated binary tool to build zboot imag

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

2025-08-18 Thread Pingfan Liu
This BPF program aligns with the convention defined in the kernel file kexec_pe_parser_bpf.lskel.h, where the interface between the BPF program and the kernel is established, and is composed of: four maps: struct bpf_map_desc ringbuf_1; struct bpf_map_des

[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
All kexec PE bpf prog should align with the interface exposed by the light skeleton four maps: struct bpf_map_desc ringbuf_1; struct bpf_map_desc ringbuf_2; struct bpf_map_desc ringbuf_3; struct bpf_map_desc ringbuf

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

2025-08-18 Thread Pingfan Liu
Analague to kernel/bpf/preload/iterators/Makefile, this Makefile is not invoked by the Kbuild system. It needs to be invoked manually when kexec_pe_parser_bpf.c is changed so that kexec_pe_parser_bpf.lskel.h can be re-generated by the command "bpftool gen skeleton -L kexec_pe_parser_bpf.o". kexec_

[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
As UEFI becomes popular, a few architectures support to boot a PE format kernel image directly. But the internal of PE format varies, which means each parser for each format. This patch (with the rest in this series) introduces a common skeleton to all parsers, and leave the format parsing in bpf-

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

2025-08-18 Thread Pingfan Liu
This commit bridges the gap between bpf-prog and the kernel decompression routines. At present, only a global memory allocator is used for the decompression. Later, if needed, the decompress_fn's prototype can be changed to pass in a task related allocator. This memory allocator can allocate 2MB e

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

2025-08-18 Thread Pingfan Liu
In the security kexec_file_load case, the buffer which holds the kernel image should not be accessible from the userspace. Typically, BPF data flow occurs between user space and kernel space in either direction. However, kexec_file_load presents a unique case where user-originated data must be pa

[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
Cc systemd-devel@lists.freedesktop.org so any UKI expert can comment *** Review the history *** Nowadays UEFI PE bootable image is more and more popular on the distribution. But it is still an open issue to load that kind of image by kexec with IMA enabled There are several approaches to reslov

Re: [systemd-devel] systemd-logind fails to start if /etc is read-only

2025-08-18 Thread Lennart Poettering
On Sa, 16.08.25 22:47, Demi Marie Obenour (demioben...@gmail.com) wrote: > On a system where /etc is read-only, systemd-logind fails to start. > I have tried making / a writable overlayfs without any success so > far. The code is at https://github.com/DemiMarie/spectrum (branch > b4/systemd) and