From: bot+bpf-ci@kernel.org
To: piliu@redhat.com,kexec@lists.infradead.org
Cc: piliu@redhat.com,davem@davemloft.net,ast@kernel.org,daniel@iogearbox.net,john.fastabend@gmail.com,andrii@kernel.org,martin.lau@linux.dev,eddyz87@gmail.com,song@kernel.org,yonghong.song@linux.dev,jeremy.linton@arm.com,catalin.marinas@arm.com,will@kernel.org,ardb@kernel.org,horms@kernel.org,kraxel@redhat.com,vkuznets@redhat.com,prudo@redhat.com,vmalik@redhat.com,kernel@jfarr.cc,bhe@redhat.com,dyoung@redhat.com,akpm@linux-foundation.org,bpf@vger.kernel.org,systemd-devel@lists.freedesktop.org,linux-kernel@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCHv7 11/13] tools/kexec: Introduce a bpf-prog to handle zboot image
Date: Sun, 22 Mar 2026 02:26:32 +0000 (UTC) [thread overview]
Message-ID: <92cc512b979dc5f37dcb39e9c2b1d804d3e6153733f29355e96869543deeca31@mail.kernel.org> (raw)
In-Reply-To: <20260322014402.8815-12-piliu@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3664 bytes --]
> diff --git a/tools/kexec/Makefile b/tools/kexec/Makefile
> --- /dev/null
> +++ b/tools/kexec/Makefile
[ ... ]
> +ifeq ($(ARCH),$(filter $(ARCH),arm64 riscv loongarch))
> + EFI_IMAGE := $(srctree)/arch/$(ARCH)/boot/vmlinuz.efi
> + KERNEL_IMAGE := $(srctree)/arch/$(ARCH)/boot/vmlinux.bin
> +else
> + @echo "Unsupported architecture: $(ARCH)"
> + @exit 1
> +endif
The else branch uses recipe syntax (@echo, @exit) at top-level
Makefile scope, outside of any rule. On unsupported architectures
this would produce a confusing GNU Make parse error rather than
the intended message. Should this use $(error ...) instead?
> +zboot: $(HEADERS) $(call BPF_ARTIFACTS,zboot) build_zboot_image
There is no rule or file for the build_zboot_image prerequisite
in this Makefile. Will this cause "make zboot" to fail with
"No rule to make target 'build_zboot_image'"?
[ ... ]
> diff --git a/tools/kexec/zboot_parser_bpf.c b/tools/kexec/zboot_parser_bpf.c
> --- /dev/null
> +++ b/tools/kexec/zboot_parser_bpf.c
[ ... ]
> +/* ringbuf 2,3,4 are useless */
> +#define MIN_BUF_SIZE 1
> +#define MAX_RECORD_SIZE (IMAGE_SIZE + 40960)
> +#define RINGBUF1_SIZE IMAGE_SIZE_POWER2_ALIGN
> +#define RINGBUF2_SIZE MIN_BUF_SIZE
> +#define RINGBUF3_SIZE MIN_BUF_SIZE
> +#define RINGBUF4_SIZE MIN_BUF_SIZE
ringbuf_map_alloc() in kernel/bpf/ringbuf.c requires max_entries
to be both power-of-2 and PAGE_ALIGNED. With MIN_BUF_SIZE set
to 1, ringbufs 2/3/4 will fail map creation with -EINVAL since
PAGE_ALIGNED(1) is false. The minimum valid size would be
PAGE_SIZE (typically 4096). Would the BPF program fail to load
because of this?
[ ... ]
> +static int fill_cmd(char *buf, __u16 cmd, __u16 subcmd,
> + const char *src, __u32 data_len)
> +{
> + struct cmd_hdr *hdr;
> + char *payload;
> +
> + hdr = (struct cmd_hdr *)buf;
> + hdr->cmd = cmd;
> + hdr->subcmd = subcmd;
> + hdr->payload_len = data_len;
> + hdr->num_chunks = 0;
The struct cmd_hdr (in kernel/kexec_bpf_loader.c) also has a
pipeline_flag field at offset 3:
struct cmd_hdr {
uint16_t cmd;
uint8_t subcmd;
uint8_t pipeline_flag;
uint32_t payload_len;
uint16_t num_chunks;
};
This field is not initialized here, and bpf_ringbuf_reserve() does
not zero the returned memory. The kernel's kexec_buff_parser()
reads this field:
fill_pipeline = cmd->pipeline_flag & KEXEC_BPF_PIPELINE_FILL;
If the garbage byte happens to have bit 0x1 set, this would
trigger unintended pipeline fill behavior, causing extra
allocations and copies into next_parsing_buf[]. Should
pipeline_flag be explicitly zeroed?
[ ... ]
> +SEC("fentry.s/kexec_image_parser_anchor")
> +int BPF_PROG(parse_zboot, struct kexec_context *context, unsigned long parser_id)
> +{
> + kexec_sig_enforced sig_mode;
[ ... ]
> + sig_mode = BPF_CORE_READ(context, sig_mode);
The type kexec_sig_enforced does not appear to exist as a type
(enum, typedef, or struct) anywhere in the kernel sources. The
only related symbol is the function set_kexec_sig_enforced().
Similarly, struct kexec_context (in kernel/kexec_bpf_loader.c)
has no sig_mode field.
Since the BPF program includes vmlinux.h generated from the
kernel's BTF, it would fail to compile without this type, and
the BPF_CORE_READ would fail CO-RE relocation without the
struct field. Are these expected to be added by a patch not
yet in this series?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/23393379437
next prev parent reply other threads:[~2026-03-22 2:26 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 1:43 [PATCHv7 00/13] kexec: Use BPF lskel to enable kexec to load PE format boot image Pingfan Liu
2026-03-22 1:43 ` [PATCHv7 01/13] bpf: Introduce kfuncs to parser buffer content Pingfan Liu
2026-03-22 2:14 ` bot+bpf-ci
2026-03-22 1:43 ` [PATCHv7 02/13] kexec_file: Use bpf-prog to decompose image Pingfan Liu
2026-03-22 2:14 ` bot+bpf-ci
2026-03-22 1:43 ` [PATCHv7 03/13] lib/decompress: Keep decompressor when CONFIG_KEEP_DECOMPRESSOR Pingfan Liu
2026-03-22 2:26 ` bot+bpf-ci
2026-03-22 1:43 ` [PATCHv7 04/13] kexec_file: Implement decompress method for parser Pingfan Liu
2026-03-22 2:26 ` bot+bpf-ci
2026-03-22 1:43 ` [PATCHv7 05/13] kexec_file: Implement copy " Pingfan Liu
2026-03-22 1:43 ` [PATCHv7 06/13] kexec_file: Chain the stages into a pipeline Pingfan Liu
2026-03-22 2:14 ` bot+bpf-ci
2026-03-22 1:43 ` [PATCHv7 07/13] kexec_file: Introduce a bpf-prog lskel to run a format parser Pingfan Liu
2026-03-22 1:43 ` [PATCHv7 08/13] kexec_file: Factor out routine to find a symbol in ELF Pingfan Liu
2026-03-22 2:14 ` bot+bpf-ci
2026-03-23 7:07 ` kernel test robot
2026-03-23 10:19 ` kernel test robot
2026-03-22 1:43 ` [PATCHv7 09/13] kexec_file: Integrate bpf light skeleton to load image with bpf-prog Pingfan Liu
2026-03-22 2:14 ` bot+bpf-ci
2026-03-22 1:43 ` [PATCHv7 10/13] arm64/kexec: Select KEXEC_BPF to support UEFI-style kernel image Pingfan Liu
2026-03-22 1:44 ` [PATCHv7 11/13] tools/kexec: Introduce a bpf-prog to handle zboot image Pingfan Liu
2026-03-22 2:26 ` bot+bpf-ci [this message]
2026-03-22 1:44 ` [PATCHv7 12/13] tools/kexec: Introduce a bpf-prog to handle UKI image Pingfan Liu
2026-03-22 1:44 ` [PATCHv7 13/13] tools/kexec: Introduce a tool to build zboot envelop Pingfan Liu
2026-03-23 19:02 ` [PATCHv7 00/13] kexec: Use BPF lskel to enable kexec to load PE format boot image Andrew Morton
2026-03-24 7:09 ` Pingfan Liu
2026-10-11 20:13 ` Jason Gunthorpe
2026-10-13 19:19 ` Ard Biesheuvel
2026-10-14 0:02 ` Jason Gunthorpe
2026-10-14 4:39 ` Ard Biesheuvel
2026-10-16 14:41 ` Jason Gunthorpe
2026-10-16 15:56 ` Ard Biesheuvel
2026-10-16 16:29 ` Jason Gunthorpe
2026-10-19 0:38 ` Pingfan Liu
2026-10-20 17:47 ` Philipp Rudo
2026-10-20 18:36 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92cc512b979dc5f37dcb39e9c2b1d804d3e6153733f29355e96869543deeca31@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ardb@kernel.org \
--cc=ast@kernel.org \
--cc=bhe@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dyoung@redhat.com \
--cc=eddyz87@gmail.com \
--cc=horms@kernel.org \
--cc=ihor.solodrai@linux.dev \
--cc=jeremy.linton@arm.com \
--cc=john.fastabend@gmail.com \
--cc=kernel@jfarr.cc \
--cc=kexec@lists.infradead.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=piliu@redhat.com \
--cc=prudo@redhat.com \
--cc=song@kernel.org \
--cc=systemd-devel@lists.freedesktop.org \
--cc=vkuznets@redhat.com \
--cc=vmalik@redhat.com \
--cc=will@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®