Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdp: check prog type before updating BPF link #2384

Closed
wants to merge 4 commits into from

Conversation

kernel-patches-bot
Copy link

Pull request for series with
subject: xdp: check prog type before updating BPF link
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=603638

@kernel-patches-bot
Copy link
Author

Master branch: d6d8683
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603638
version: 1

@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=603638 expired. Closing PR.

@kernel-patches-bot
Copy link
Author

Master branch: d6d8683
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603680
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: dd3ca4c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603680
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: dd3ca4c
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603680
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: 7d6019b
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603680
version: 2

@kernel-patches-bot
Copy link
Author

Master branch: 1e9d746
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=603680
version: 2

The bpf_xdp_link_update() function didn't check the program type before
updating the program, which made it possible to install any program type as
an XDP program, which is obviously not good. Syzbot managed to trigger this
by swapping in an LWT program on the XDP hook which would crash in a helper
call.

Fix this by adding a check and bailing out if the types don't match.

Fixes: 026a4c2 ("bpf, xdp: Implement LINK_UPDATE for BPF XDP link")
Reported-by: syzbot+983941aa85af6ded1fd9@syzkaller.appspotmail.com
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Convert the selftest to use the preferred ASSERT_* macros instead of the
deprecated CHECK().

v2:
- Don't add if statements around checks if they weren't there before.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
… type

Add a check to the xdp_link selftest that the kernel rejects replacing an
XDP program with a different program type on link update.

v2:
- Split this out into its own patch.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
@kernel-patches-bot
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=603680 irrelevant now. Closing PR.

@kernel-patches-bot kernel-patches-bot deleted the series/603638=>bpf branch January 11, 2022 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants