syzbot


WARNING in sock_map_unref

Status: fixed on 2024/05/13 23:49
Reported-by: syzbot+5dda2639cfdda8065e17@syzkaller.appspotmail.com
Fix commit: d1e73fb19a4c bpf, sockmap: Prevent lock inversion deadlock in map delete elem
First crash: 227d, last: 225d
Fix bisection: fixed by (bisect log) :
commit d1e73fb19a4c872d7a399ad3c66e8ca30e0875ec
Author: Jakub Sitnicki <jakub@cloudflare.com>
Date: Tue Apr 2 10:46:21 2024 +0000

  bpf, sockmap: Prevent lock inversion deadlock in map delete elem

  
Bug presence (1)
Date Name Commit Repro Result
2024/04/24 upstream (ToT) 9d1ddab261f3 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING in sock_map_unref bpf net C error 97 210d 223d 25/28 fixed on 2024/05/22 23:36
linux-6.1 WARNING in sock_map_unref C done 18 225d 228d 3/3 fixed on 2024/05/15 09:17

Sample crash report:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3499 at kernel/softirq.c:363 __local_bh_enable_ip+0x1b3/0x1f0
Modules linked in:
CPU: 0 PID: 3499 Comm: syz-executor303 Not tainted 5.15.153-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
RIP: 0010:__local_bh_enable_ip+0x1b3/0x1f0 kernel/softirq.c:363
Code: 04 25 28 00 00 00 48 3b 44 24 60 75 4a 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b e9 d0 fe ff ff e8 3f 00 00 00 eb a2 <0f> 0b e9 02 ff ff ff 48 c7 c1 c4 c8 e3 8d 80 e1 07 80 c1 03 38 c1
RSP: 0018:ffffc90002e97460 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 1ffff920005d2e90 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000201 RDI: ffffffff884f04a1
RBP: ffffc90002e97520 R08: dffffc0000000000 R09: ffffed100fe9e650
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 0000000000000000 R14: ffffc90002e974a0 R15: 0000000000000201
FS:  00005555574f6380(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000019cc6000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 spin_unlock_bh include/linux/spinlock.h:408 [inline]
 sock_map_del_link net/core/sock_map.c:163 [inline]
 sock_map_unref+0x401/0x5d0 net/core/sock_map.c:182
 __sock_map_delete net/core/sock_map.c:422 [inline]
 sock_map_delete_elem+0xc3/0x130 net/core/sock_map.c:448
 bpf_prog_2c29ac5cdc6b1842+0x3a/0x580
 bpf_dispatcher_nop_func include/linux/bpf.h:785 [inline]
 __bpf_prog_run include/linux/filter.h:628 [inline]
 bpf_prog_run include/linux/filter.h:635 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline]
 bpf_trace_run2+0x19e/0x340 kernel/trace/bpf_trace.c:1917
 trace_tlb_flush+0xed/0x110 include/trace/events/tlb.h:38
 switch_mm_irqs_off+0x748/0xa30
 unuse_temporary_mm arch/x86/kernel/alternative.c:1035 [inline]
 __text_poke+0x764/0x9e0 arch/x86/kernel/alternative.c:1131
 text_poke arch/x86/kernel/alternative.c:1172 [inline]
 text_poke_bp_batch+0x145/0x830 arch/x86/kernel/alternative.c:1389
 text_poke_flush arch/x86/kernel/alternative.c:1560 [inline]
 text_poke_finish+0x16/0x30 arch/x86/kernel/alternative.c:1567
 arch_jump_label_transform_apply+0x13/0x20 arch/x86/kernel/jump_label.c:146
 static_key_enable_cpuslocked+0x12e/0x250 kernel/jump_label.c:177
 static_key_enable+0x16/0x20 kernel/jump_label.c:190
 tracepoint_add_func+0x947/0x9d0 kernel/tracepoint.c:361
 tracepoint_probe_register_prio_may_exist+0x11e/0x190 kernel/tracepoint.c:482
 bpf_raw_tracepoint_open+0x65a/0x750 kernel/bpf/syscall.c:3113
 __sys_bpf+0x468/0x670 kernel/bpf/syscall.c:4693
 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:4753 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f901277f9e9
Code: Unable to access opcode bytes at RIP 0x7f901277f9bf.
RSP: 002b:00007ffe8719f1a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ffe8719f378 RCX: 00007f901277f9e9
RDX: 0000000000000010 RSI: 0000000020000040 RDI: 0000000000000011
RBP: 00007f90127f3610 R08: 00007ffe8719f378 R09: 00007ffe8719f378
R10: 00007ffe8719f378 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffe8719f368 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Crashes (18):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/08 09:04 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 08:16 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 07:36 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 06:53 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 06:14 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 05:35 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 04:56 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 03:05 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan WARNING in sock_map_unref
2024/04/10 09:43 linux-5.15.y 9465fef4ae35 171ec371 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/10 04:56 linux-5.15.y 9465fef4ae35 171ec371 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan WARNING in sock_map_unref
2024/04/09 17:36 linux-5.15.y 9465fef4ae35 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/09 17:06 linux-5.15.y 9465fef4ae35 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/09 14:40 linux-5.15.y 9465fef4ae35 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan WARNING in sock_map_unref
2024/04/09 14:32 linux-5.15.y 9465fef4ae35 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan WARNING in sock_map_unref
2024/04/08 04:02 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 03:49 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf WARNING in sock_map_unref
2024/04/08 01:24 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan WARNING in sock_map_unref
2024/04/08 01:14 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan WARNING in sock_map_unref
* Struck through repros no longer work on HEAD.