Skip to content

Commit 4b21ce3

Browse files
Florian WestphalsfX-bot
Florian Westphal
authored andcommitted
bpf: Avoid splat in pskb_pull_reason
syzkaller builds (CONFIG_DEBUG_NET=y) frequently trigger a debug hint in pskb_may_pull. We'd like to retain this debug check because it might hint at integer overflows and other issues (kernel code should pull headers, not huge value). In bpf case, this splat isn't interesting at all: such (nonsensical) bpf programs are typically generated by a fuzzer anyway. Do what Eric suggested and suppress such warning. For CONFIG_DEBUG_NET=n we don't need the extra check because pskb_may_pull will do the right thing: return an error without the WARN() backtrace. Fixes: 219eee9c0d16 ("net: skbuff: add overflow debug check to pull/push helpers") Reported-by: [email protected] Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Closes: https://syzkaller.appspot.com/bug?extid=0c4150bff9fff3bf023c Link: https://lore.kernel.org/netdev/[email protected]/ Link: https://lore.kernel.org/bpf/[email protected]
1 parent 6563d3c commit 4b21ce3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/core/filter.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,6 +1652,11 @@ static DEFINE_PER_CPU(struct bpf_scratchpad, bpf_sp);
16521652
static inline int __bpf_try_make_writable(struct sk_buff *skb,
16531653
unsigned int write_len)
16541654
{
1655+
#ifdef CONFIG_DEBUG_NET
1656+
/* Avoid a splat in pskb_may_pull_reason() */
1657+
if (write_len > INT_MAX)
1658+
return -EINVAL;
1659+
#endif
16551660
return skb_ensure_writable(skb, write_len);
16561661
}
16571662

0 commit comments

Comments
 (0)