syzbot


WARNING in sock_map_unref

Status: fixed on 2024/05/15 09:17
Reported-by: syzbot+1af199ace22cd0e712aa@syzkaller.appspotmail.com
Fix commit: a44770fed865 bpf, sockmap: Prevent lock inversion deadlock in map delete elem
First crash: 74d, last: 71d
Fix bisection: fixed by (bisect log) :
commit a44770fed86515eedb5a7c00b787f847ebb134a5
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/25 upstream (ToT) e88c4cfcb7b8 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 WARNING in sock_map_unref C done 18 71d 73d 3/3 fixed on 2024/05/13 23:49
upstream WARNING in sock_map_unref bpf net C error 97 55d 69d 26/27 fixed on 2024/05/22 23:36

Sample crash report:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3539 at kernel/softirq.c:376 __local_bh_enable_ip+0x1b3/0x1f0
Modules linked in:
CPU: 0 PID: 3539 Comm: syz-executor105 Not tainted 6.1.84-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:376
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 e4 9e 73 8e 80 e1 07 80 c1 03 38 c1
RSP: 0018:ffffc90003c3f3a0 EFLAGS: 00010046
RAX: 0000000000000000 RBX: 1ffff92000787e78 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000201 RDI: ffffffff88984c11
RBP: ffffc90003c3f460 R08: dffffc0000000000 R09: ffffed1002b58250
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 0000000000000000 R14: ffffc90003c3f3e0 R15: 0000000000000201
FS:  00005555563fb380(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000027572000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 spin_unlock_bh include/linux/spinlock.h:396 [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/0x3e
 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline]
 __bpf_prog_run include/linux/filter.h:603 [inline]
 bpf_prog_run include/linux/filter.h:610 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline]
 bpf_trace_run2+0x1fd/0x410 kernel/trace/bpf_trace.c:2312
 trace_tlb_flush+0x151/0x1a0 include/trace/events/tlb.h:38
 switch_mm_irqs_off+0x84a/0xc20
 unuse_temporary_mm arch/x86/kernel/alternative.c:1087 [inline]
 __text_poke+0x71d/0x9a0 arch/x86/kernel/alternative.c:1197
 text_poke arch/x86/kernel/alternative.c:1240 [inline]
 text_poke_bp_batch+0x153/0x940 arch/x86/kernel/alternative.c:1531
 text_poke_flush arch/x86/kernel/alternative.c:1725 [inline]
 text_poke_finish+0x16/0x30 arch/x86/kernel/alternative.c:1732
 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_tp_link_attach+0x456/0x6b0 kernel/bpf/syscall.c:3372
 bpf_raw_tracepoint_open+0x196/0x210 kernel/bpf/syscall.c:3399
 __sys_bpf+0x4a7/0x6c0 kernel/bpf/syscall.c:5047
 __do_sys_bpf kernel/bpf/syscall.c:5109 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5107 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5107
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f8fa18f69e9
Code: Unable to access opcode bytes at 0x7f8fa18f69bf.
RSP: 002b:00007ffedb1c8368 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ffedb1c8538 RCX: 00007f8fa18f69e9
RDX: 0000000000000010 RSI: 0000000020000040 RDI: 0000000000000011
RBP: 00007f8fa196a610 R08: 00007ffedb1c8538 R09: 00007ffedb1c8538
R10: 00007ffedb1c8538 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffedb1c8528 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/09 04:46 linux-6.1.y 347385861c50 f3234354 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/09 03:47 linux-6.1.y 347385861c50 f3234354 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/09 01:37 linux-6.1.y 347385861c50 53df08b6 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/09 00:55 linux-6.1.y 347385861c50 53df08b6 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/09 00:19 linux-6.1.y 347385861c50 53df08b6 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/08 23:36 linux-6.1.y 347385861c50 53df08b6 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/08 01:47 linux-6.1.y 347385861c50 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan WARNING in sock_map_unref
2024/04/10 10:03 linux-6.1.y 347385861c50 171ec371 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/10 02:13 linux-6.1.y 347385861c50 171ec371 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/09 14:52 linux-6.1.y 347385861c50 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan WARNING in sock_map_unref
2024/04/09 14:45 linux-6.1.y 347385861c50 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/09 14:43 linux-6.1.y 347385861c50 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/09 14:25 linux-6.1.y 347385861c50 f3234354 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan WARNING in sock_map_unref
2024/04/08 22:59 linux-6.1.y 347385861c50 53df08b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/08 06:49 linux-6.1.y 347385861c50 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
2024/04/08 01:24 linux-6.1.y 347385861c50 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan WARNING in sock_map_unref
2024/04/08 01:17 linux-6.1.y 347385861c50 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan WARNING in sock_map_unref
2024/04/07 05:58 linux-6.1.y 347385861c50 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf WARNING in sock_map_unref
* Struck through repros no longer work on HEAD.