-
Notifications
You must be signed in to change notification settings - Fork 145
bpf: Reject negative head_room in __bpf_skb_change_head #10079
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
base: bpf_base
Are you sure you want to change the base?
Conversation
|
Upstream branch: 881a9c9 |
56a8244 to
0630a08
Compare
|
Upstream branch: 7221b9c |
249a276 to
d8cb8d1
Compare
0630a08 to
bf79798
Compare
|
Upstream branch: 7221b9c |
d8cb8d1 to
8f0baba
Compare
bf79798 to
ff7b21a
Compare
|
Upstream branch: 7221b9c |
8f0baba to
a5de900
Compare
ff7b21a to
986b6fd
Compare
|
Upstream branch: 8ce93aa |
Yinhao et al. recently reported: Our fuzzing tool was able to create a BPF program which triggered the below BUG condition inside pskb_expand_head. [ 23.016047][T10006] kernel BUG at net/core/skbuff.c:2232! [...] [ 23.017301][T10006] RIP: 0010:pskb_expand_head+0x1519/0x1530 [...] [ 23.021249][T10006] Call Trace: [ 23.021387][T10006] <TASK> [ 23.021507][T10006] ? __pfx_pskb_expand_head+0x10/0x10 [ 23.021725][T10006] __bpf_skb_change_head+0x22a/0x520 [ 23.021939][T10006] bpf_skb_change_head+0x34/0x1b0 [ 23.022143][T10006] ___bpf_prog_run+0xf70/0xb670 [ 23.022342][T10006] __bpf_prog_run32+0xed/0x140 [...] The problem is that in __bpf_skb_change_head() we need to reject a negative head_room as otherwise this propagates all the way to the pskb_expand_head() from skb_cow(). For example, if the BPF test infra passes a skb with gso_skb:1 to the BPF helper with a negative head_room of -22, then this gets passed into skb_cow(). __skb_cow() in this example calculates a delta of -86 which gets aligned to -64, and then triggers BUG_ON(nhead < 0). Thus, reject malformed negative input. Fixes: 3a0af8f ("bpf: BPF for lightweight tunnel infrastructure") Reported-by: Yinhao Hu <[email protected]> Reported-by: Kaiyan Mei <[email protected]> Reviewed-by: Dongliang Mu <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
a5de900 to
44d9197
Compare
Pull request for series with
subject: bpf: Reject negative head_room in __bpf_skb_change_head
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1015005