Enable module kfuncs to override vmlinux kfuncs#11995
Enable module kfuncs to override vmlinux kfuncs#11995kernel-patches-daemon-bpf[bot] wants to merge 2 commits intobpf-next_basefrom
Conversation
|
Upstream branch: 9f5b3ff |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 4350146673 via email |
6d81208 to
e299921
Compare
|
Upstream branch: 2ca6723 |
8fbf08e to
447534b
Compare
e299921 to
68b493c
Compare
|
Upstream branch: 2ca6723 |
447534b to
57abfe9
Compare
68b493c to
149211d
Compare
Change the kfunc resolution order in find_ksym_btf_id() to search module BTFs before vmlinux BTF. This allows kernel modules to override vmlinux kfuncs with the same name, enabling a form of live-patching for kfuncs. Previously, vmlinux kfuncs were always preferred, making it impossible for modules to provide enhanced or fixed versions of existing kfuncs. With this change, modules can now override kernel kfuncs, while programs that don't use module BTFs remain unaffected. Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by: Song Chen <chensong_2000@126.com>
…offset Use the instruction's 'off' field to indicate the source of a kfunc. When libbpf resolves a kfunc, it sets insn->off to 0 for vmlinux kfuncs or a non-zero module ID for module kfuncs. The verifier now checks insn->off to determine where to look up the kfunc address: off == 0 searches in vmlinux, while off > 0 searches in the corresponding module BTF. This enables proper resolution of module kfuncs that may override vmlinux kfuncs with the same name. This works in conjunction with the libbpf change that prioritizes module kfuncs during BTF resolution. Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by: Song Chen <chensong_2000@126.com>
|
Upstream branch: 2ca6723 |
57abfe9 to
a6a9980
Compare
Pull request for series with
subject: Enable module kfuncs to override vmlinux kfuncs
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1087894