syzbot


KFENCE: memory corruption in pskb_expand_head

Status: upstream: reported C repro on 2024/10/05 07:56
Subsystems: bpf net
[Documentation on labels]
Reported-by: syzbot+80b36e60457a005e0530@syzkaller.appspotmail.com
First crash: 48d, last: 44d
Cause bisection: introduced by (bisect log) :
commit d0a38fad51cc70ab3dd3c59b54d8079ac19220b9
Author: Feng Tang <feng.tang@intel.com>
Date: Wed Sep 11 06:45:34 2024 +0000

  mm/slub: Improve redzone check and zeroing for krealloc()

Crash: KFENCE: memory corruption in pskb_expand_head (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bpf?] [net?] KFENCE: memory corruption in pskb_expand_head 1 (2) 2024/10/05 08:20
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/10/21 13:47 1h14m retest repro linux-next OK log

Sample crash report:
==================================================================
BUG: KFENCE: memory corruption in skb_kfree_head net/core/skbuff.c:1086 [inline]
BUG: KFENCE: memory corruption in skb_free_head net/core/skbuff.c:1098 [inline]
BUG: KFENCE: memory corruption in pskb_expand_head+0x4fc/0x1380 net/core/skbuff.c:2307

Corrupted memory at 0xffff88823bfaafc0 [ 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ] (in kfence-#212):
 skb_kfree_head net/core/skbuff.c:1086 [inline]
 skb_free_head net/core/skbuff.c:1098 [inline]
 pskb_expand_head+0x4fc/0x1380 net/core/skbuff.c:2307
 __skb_cow include/linux/skbuff.h:3702 [inline]
 skb_cow include/linux/skbuff.h:3721 [inline]
 __bpf_skb_change_head+0x227/0x4a0 net/core/filter.c:3850
 ____bpf_skb_change_head net/core/filter.c:3873 [inline]
 bpf_skb_change_head+0x33/0x1b0 net/core/filter.c:3870
 bpf_prog_4a2cba36a3decec5+0x62/0x67
 bpf_dispatcher_nop_func include/linux/bpf.h:1257 [inline]
 __bpf_prog_run include/linux/filter.h:701 [inline]
 bpf_prog_run include/linux/filter.h:708 [inline]
 bpf_test_run+0x4f0/0xa90 net/bpf/test_run.c:433
 bpf_prog_test_run_skb+0xc97/0x1820 net/bpf/test_run.c:1094
 bpf_prog_test_run+0x2e4/0x360 kernel/bpf/syscall.c:4247
 __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5652
 __do_sys_bpf kernel/bpf/syscall.c:5741 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5739 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5739
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

kfence-#212: 0xffff88823bfaae00-0xffff88823bfaafbf, size=448, cache=kmalloc-512

allocated by task 6184 on cpu 1 at 138.694694s (0.101653s ago):
 kmalloc_noprof include/linux/slab.h:882 [inline]
 kzalloc_noprof include/linux/slab.h:1014 [inline]
 bpf_test_init+0xe1/0x180 net/bpf/test_run.c:669
 bpf_prog_test_run_skb+0x2bb/0x1820 net/bpf/test_run.c:1000
 bpf_prog_test_run+0x2e4/0x360 kernel/bpf/syscall.c:4247
 __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5652
 __do_sys_bpf kernel/bpf/syscall.c:5741 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5739 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5739
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

freed by task 6184 on cpu 1 at 138.694821s (0.145668s ago):
 skb_kfree_head net/core/skbuff.c:1086 [inline]
 skb_free_head net/core/skbuff.c:1098 [inline]
 pskb_expand_head+0x4fc/0x1380 net/core/skbuff.c:2307
 __skb_cow include/linux/skbuff.h:3702 [inline]
 skb_cow include/linux/skbuff.h:3721 [inline]
 __bpf_skb_change_head+0x227/0x4a0 net/core/filter.c:3850
 ____bpf_skb_change_head net/core/filter.c:3873 [inline]
 bpf_skb_change_head+0x33/0x1b0 net/core/filter.c:3870
 bpf_prog_4a2cba36a3decec5+0x62/0x67
 bpf_dispatcher_nop_func include/linux/bpf.h:1257 [inline]
 __bpf_prog_run include/linux/filter.h:701 [inline]
 bpf_prog_run include/linux/filter.h:708 [inline]
 bpf_test_run+0x4f0/0xa90 net/bpf/test_run.c:433
 bpf_prog_test_run_skb+0xc97/0x1820 net/bpf/test_run.c:1094
 bpf_prog_test_run+0x2e4/0x360 kernel/bpf/syscall.c:4247
 __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5652
 __do_sys_bpf kernel/bpf/syscall.c:5741 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5739 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5739
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

CPU: 1 UID: 0 PID: 6184 Comm: syz.1.195 Not tainted 6.12.0-rc1-next-20241003-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/07 13:01 linux-next c02d24a5af66 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KFENCE: memory corruption in pskb_expand_head
2024/10/07 12:31 linux-next c02d24a5af66 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KFENCE: memory corruption in pskb_expand_head
2024/10/04 06:12 linux-next c02d24a5af66 d7906eff .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KFENCE: memory corruption in pskb_expand_head
2024/10/03 19:39 linux-next c02d24a5af66 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KFENCE: memory corruption in pskb_expand_head
2024/10/03 18:32 linux-next c02d24a5af66 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KFENCE: memory corruption in pskb_expand_head
* Struck through repros no longer work on HEAD.