Re: [PATCH] samples/livepatch: Add BPF struct_ops integration sample

From: Song Liu

Date: Wed Apr 15 2026 - 20:18:43 EST


On Wed, Apr 15, 2026 at 5:16 PM Song Liu <song@xxxxxxxxxx> wrote:
>
> Add a sample module that demonstrates how BPF struct_ops can work
> together with kernel livepatch. The module livepatches
> cmdline_proc_show() and delegates the output to a BPF struct_ops
> callback. When no BPF program is attached, a fallback message is
> shown; when a BPF struct_ops program is attached, it controls the
> /proc/cmdline output via the bpf_klp_seq_write kfunc.
>
> This builds on the existing livepatch-sample.c pattern but shows how
> livepatch and BPF struct_ops can be combined to make livepatched
> behavior programmable from userspace.
>
> The module is built when both CONFIG_SAMPLE_LIVEPATCH and
> CONFIG_BPF_JIT are enabled.
>
> Signed-off-by: Song Liu <song@xxxxxxxxxx>

Forgot to add

Assisted-by: Claude:claude-opus-4-6