syzbot


KASAN: use-after-free Read in ip_check_mc_rcu

Status: upstream: reported C repro on 2021/03/02 03:19
Reported-by: syzbot+ed61c2cf5c6265522941@syzkaller.appspotmail.com
First crash: 645d, last: 437d
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 1188d 1187d 0/1 auto-closed as invalid on 2020/01/04 09:41
upstream KASAN: use-after-free Read in ip_check_mc_rcu C inconclusive error 30 457d 684d 0/24 closed as invalid on 2022/11/15 19:19
linux-4.19 KASAN: use-after-free Read in ip_check_mc_rcu syz done 7 470d 621d 1/1 fixed on 2021/09/26 12:12
linux-4.14 KASAN: use-after-free Read in ip_check_mc_rcu C error 4 89d 653d 0/1 upstream: reported C repro on 2021/02/22 02:16

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ip_check_mc_rcu+0x29d/0x3c0 net/ipv4/igmp.c:2726
Read of size 8 at addr ffff8881ee628c40 by task syz-executor640/536

CPU: 0 PID: 536 Comm: syz-executor640 Not tainted 5.4.101-syzkaller-00451-g000f1f482d2c #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+0x1d8/0x24e lib/dump_stack.c:118
 print_address_description+0x9b/0x650 mm/kasan/report.c:376
 __kasan_report+0x182/0x250 mm/kasan/report.c:508
 kasan_report+0x30/0x60 mm/kasan/common.c:641
 ip_check_mc_rcu+0x29d/0x3c0 net/ipv4/igmp.c:2726
 __mkroute_output+0x372/0x1430 net/ipv4/route.c:2357
 ip_route_output_key_hash net/ipv4/route.c:2465 [inline]
 __ip_route_output_key include/net/route.h:126 [inline]
 ip_route_output_flow+0x13d/0x320 net/ipv4/route.c:2726
 udp_sendmsg+0x17f6/0x2f80 net/ipv4/udp.c:1147
 sock_sendmsg_nosec net/socket.c:638 [inline]
 sock_sendmsg net/socket.c:658 [inline]
 ____sys_sendmsg+0x583/0x8c0 net/socket.c:2298
 ___sys_sendmsg net/socket.c:2352 [inline]
 __sys_sendmmsg+0x3b3/0x730 net/socket.c:2455
 __do_sys_sendmmsg net/socket.c:2484 [inline]
 __se_sys_sendmmsg net/socket.c:2481 [inline]
 __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2481
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x4504b9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 91 18 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd1a9ed6318 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00000000004ce4c8 RCX: 00000000004504b9
RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000003
RBP: 00000000004ce4c0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000049d6e8
R13: 00007fff883f688f R14: 00007fd1a9ed6400 R15: 0000000000022000

Allocated by task 536:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:517
 kmem_cache_alloc_trace+0x139/0x2b0 mm/slub.c:2848
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 ip_mc_add1_src net/ipv4/igmp.c:1973 [inline]
 ip_mc_add_src+0x4dd/0xa90 net/ipv4/igmp.c:2097
 ip_mc_source+0xc44/0x1170 net/ipv4/igmp.c:2418
 do_ip_setsockopt+0x2313/0x3ac0 net/ipv4/ip_sockglue.c:998
 ip_setsockopt+0x4c/0xc0 net/ipv4/ip_sockglue.c:1248
 __sys_setsockopt+0x56a/0x870 net/socket.c:2085
 __do_sys_setsockopt net/socket.c:2101 [inline]
 __se_sys_setsockopt net/socket.c:2098 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2098
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 533:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 kasan_set_free_info mm/kasan/common.c:333 [inline]
 __kasan_slab_free+0x18a/0x240 mm/kasan/common.c:475
 slab_free_hook mm/slub.c:1454 [inline]
 slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1492
 slab_free mm/slub.c:3072 [inline]
 kfree+0xe0/0x660 mm/slub.c:4061
 ip_mc_del1_src+0x6dd/0x7f0 net/ipv4/igmp.c:1886
 ip_mc_del_src+0x398/0x7b0 net/ipv4/igmp.c:1927
 ip_mc_leave_src net/ipv4/igmp.c:2233 [inline]
 ip_mc_drop_socket+0x199/0x3a0 net/ipv4/igmp.c:2687
 inet_release+0x48/0x180 net/ipv4/af_inet.c:414
 __sock_release net/socket.c:591 [inline]
 sock_close+0xd2/0x250 net/socket.c:1269
 __fput+0x27d/0x6c0 fs/file_table.c:281
 task_work_run+0x186/0x1b0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
 prepare_exit_to_usermode+0x2b0/0x310 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881ee628c40
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff8881ee628c40, ffff8881ee628c60)
The buggy address belongs to the page:
page:ffffea0007b98a00 refcount:1 mapcount:0 mapping:ffff8881f5c03400 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea0007bcf5c0 0000000300000003 ffff8881f5c03400
raw: 0000000000000000 0000000080400040 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881ee628b00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8881ee628b80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8881ee628c00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                                           ^
 ffff8881ee628c80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8881ee628d00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (5):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-android-5-4-kasan 2021/03/02 03:18 android12-5.4 000f1f482d2c 183afb6c .config log report syz C KASAN: use-after-free Read in ip_check_mc_rcu
ci2-android-5-4-kasan 2021/03/02 13:48 android12-5.4 13369a790167 92ead296 .config log report syz C KASAN: slab-out-of-bounds Read in ip_check_mc_rcu
ci2-android-5-4-kasan 2021/09/26 06:43 android12-5.4 d52ac987ad2a 8cac236e .config log report info KASAN: use-after-free Read in ip_check_mc_rcu
ci2-android-5-4-kasan 2021/05/04 01:18 android12-5.4 546a6e8726bc 09efdd63 .config log report info KASAN: use-after-free Read in ip_check_mc_rcu
ci2-android-5-4-kasan 2021/04/22 23:57 android12-5.4 d05959f84917 590921a5 .config log report info KASAN: use-after-free Read in ip_check_mc_rcu
* Struck through repros no longer work on HEAD.