syzbot


KASAN: use-after-free Read in ip_check_mc_rcu

Status: fixed on 2021/09/26 12:12
Reported-by: syzbot+bb58b36578bed8494f6d@syzkaller.appspotmail.com
Fix commit: 4768973dffed igmp: Add ip_mc_list lock in ip_check_mc_rcu
First crash: 1339d, last: 1188d
Fix bisection: fixed by (bisect log) :
commit 4768973dffed4d0126854514335ed4fe87bec1ab
Author: Liu Jian <liujian56@huawei.com>
Date: Fri Jul 16 04:06:17 2021 +0000

  igmp: Add ip_mc_list lock in ip_check_mc_rcu

  
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 KASAN: use-after-free Read in ip_check_mc_rcu 1 1905d 1905d 0/1 auto-closed as invalid on 2020/01/04 09:41
upstream KASAN: use-after-free Read in ip_check_mc_rcu net C inconclusive error 30 1174d 1401d 0/28 closed as invalid on 2022/11/15 19:19
android-54 KASAN: use-after-free Read in ip_check_mc_rcu C 5 1154d 1362d 0/2 auto-obsoleted due to no activity on 2023/04/22 05:06
linux-4.14 KASAN: use-after-free Read in ip_check_mc_rcu C error 4 807d 1370d 0/1 upstream: reported C repro on 2021/02/22 02:16
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2021/09/22 18:05 3h41m bisect fix linux-4.19.y OK (1) job log
2021/08/23 15:51 35m bisect fix linux-4.19.y OK (0) job log log
2021/07/13 21:47 34m bisect fix linux-4.19.y OK (0) job log log
2021/05/28 13:11 35m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
ieee802154 phy0 wpan0: encryption failed: -22
ieee802154 phy1 wpan1: encryption failed: -22
==================================================================
BUG: KASAN: use-after-free in ip_check_mc_rcu+0x63a/0x6a0 net/ipv4/igmp.c:2739
Read of size 8 at addr ffff8880b4606900 by task syz-executor.1/11179

CPU: 1 PID: 11179 Comm: syz-executor.1 Not tainted 4.19.198-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 ip_check_mc_rcu+0x63a/0x6a0 net/ipv4/igmp.c:2739
 __mkroute_output net/ipv4/route.c:2275 [inline]
 ip_route_output_key_hash_rcu+0x24be/0x3060 net/ipv4/route.c:2555
 ip_route_output_key_hash+0x1c6/0x320 net/ipv4/route.c:2383
 __ip_route_output_key include/net/route.h:124 [inline]
 ip_route_output_flow+0x23/0x150 net/ipv4/route.c:2640
 udp_sendmsg+0x19ce/0x2550 net/ipv4/udp.c:1101
 inet_sendmsg+0x132/0x5a0 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:661
 ___sys_sendmsg+0x3b3/0x8e0 net/socket.c:2225
 __sys_sendmmsg+0x195/0x470 net/socket.c:2320
 __do_sys_sendmmsg net/socket.c:2349 [inline]
 __se_sys_sendmmsg net/socket.c:2346 [inline]
 __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2346
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4665e9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd90cd31188 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 000000000056c0f0 RCX: 00000000004665e9
RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000004
RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056c0f0
R13: 00007ffc9d8857af R14: 00007fd90cd31300 R15: 0000000000022000

Allocated by task 11171:
 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 ip_mc_add1_src net/ipv4/igmp.c:1987 [inline]
 ip_mc_add_src+0x999/0xd50 net/ipv4/igmp.c:2111
 ip_mc_source+0xa49/0x1030 net/ipv4/igmp.c:2432
 do_ip_setsockopt.constprop.0+0x31d/0x3ba0 net/ipv4/ip_sockglue.c:996
 ip_setsockopt+0x44/0xf0 net/ipv4/ip_sockglue.c:1246
 tcp_setsockopt+0x86/0xd0 net/ipv4/tcp.c:3108
 __sys_setsockopt+0x14d/0x240 net/socket.c:2011
 __do_sys_setsockopt net/socket.c:2022 [inline]
 __se_sys_setsockopt net/socket.c:2019 [inline]
 __x64_sys_setsockopt+0xba/0x150 net/socket.c:2019
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 11164:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 ip_mc_del1_src+0x654/0x7a0 net/ipv4/igmp.c:1900
 ip_mc_del_src.isra.0+0x2d8/0x920 net/ipv4/igmp.c:1941
 ip_mc_leave_src.isra.0+0x102/0x240 net/ipv4/igmp.c:2247
 ip_mc_drop_socket+0x11a/0x260 net/ipv4/igmp.c:2701
 inet_release+0x49/0x1e0 net/ipv4/af_inet.c:414
 __sock_release+0xcd/0x2a0 net/socket.c:599
 sock_close+0x15/0x20 net/socket.c:1212
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b4606900
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8880b4606900, ffff8880b4606940)
The buggy address belongs to the page:
page:ffffea0002d18180 count:1 mapcount:0 mapping:ffff88813bff0340 index:0xffff8880b4606500
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea00028df208 ffffea0002449788 ffff88813bff0340
raw: ffff8880b4606500 ffff8880b4606000 0000000100000017 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b4606800: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880b4606880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff8880b4606900: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8880b4606980: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff8880b4606a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/07/24 15:28 linux-4.19.y 4938296e03bd 4d1b57d4 .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in ip_check_mc_rcu
2021/03/30 19:21 linux-4.19.y 2034d6f0838e 6a81331a .config console log report syz ci2-linux-4-19 KASAN: use-after-free Read in ip_check_mc_rcu
2021/07/24 14:23 linux-4.19.y 4938296e03bd 4d1b57d4 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in ip_check_mc_rcu
2021/06/13 21:47 linux-4.19.y 9a2dc0e6c531 1ba81399 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in ip_check_mc_rcu
2021/04/28 12:18 linux-4.19.y 97a8651cadce 77e2b668 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in ip_check_mc_rcu
2021/03/30 13:49 linux-4.19.y 2034d6f0838e 6a81331a .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in ip_check_mc_rcu
2021/03/25 15:26 linux-4.19.y 78fec1611cbf 6a383ecf .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in ip_check_mc_rcu
* Struck through repros no longer work on HEAD.