Skip to content

bpf: Fix UAF in bpf_trampoline_multi_attach_free on update failure - #8672

Open
kernel-patches-daemon-bpf-rc[bot] wants to merge 1 commit into
bpf-next_basefrom
series/1143043=>bpf-next
Open

bpf: Fix UAF in bpf_trampoline_multi_attach_free on update failure#8672
kernel-patches-daemon-bpf-rc[bot] wants to merge 1 commit into
bpf-next_basefrom
series/1143043=>bpf-next

Conversation

@kernel-patches-daemon-bpf-rc

Copy link
Copy Markdown

Pull request for series with
subject: bpf: Fix UAF in bpf_trampoline_multi_attach_free on update failure
version: 3
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1143043

When bpf_trampoline_update() fails before modify_fentry_multi()/
unregister_fentry_multi() is called, cur_image is unchanged
(cur_image == old_image) and ftrace still calls into it.  Freeing
old_image in that case causes a UAF.

Only free old_image when it differs from cur_image.

Also change bpf_trampoline_multi_detach() to return void and drop
the WARN_ON_ONCE at its call site.

Signed-off-by: Hui Zhu <zhuhui@kylinos.cn>
@kernel-patches-daemon-bpf-rc

Copy link
Copy Markdown
Author

Upstream branch: d114bb9
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1143043
version: 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant