KASAN: use-after-free Read in ip_check_mc_rcu

Status: auto-closed as invalid on 2020/01/04 09:41
First crash: 1640d, last: 1640d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ip_check_mc_rcu net C inconclusive error 30 909d 1136d 0/26 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 922d 1073d 1/1 fixed on 2021/09/26 12:12
android-54 KASAN: use-after-free Read in ip_check_mc_rcu C 5 889d 1097d 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 542d 1105d 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+0x4db/0x53a net/ipv4/igmp.c:2697
Read of size 8 at addr ffff8881c92c0720 by task syz-executor.0/19893

CPU: 0 PID: 19893 Comm: syz-executor.0 Not tainted 4.14.141+ #0
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xca/0x134 lib/dump_stack.c:53
 print_address_description+0x60/0x226 mm/kasan/report.c:187
 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
 ip_check_mc_rcu+0x4db/0x53a net/ipv4/igmp.c:2697
 __mkroute_output net/ipv4/route.c:2230 [inline]
 ip_route_output_key_hash_rcu+0x18ca/0x20f0 net/ipv4/route.c:2511
 ip_route_output_key_hash+0x1a2/0x2c0 net/ipv4/route.c:2340
 __ip_route_output_key include/net/route.h:126 [inline]
 ip_route_output_flow+0x22/0xb0 net/ipv4/route.c:2595
 udp_sendmsg+0x13a0/0x1bb0 net/ipv4/udp.c:1025
 inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb7/0x100 net/socket.c:656
 SYSC_sendto net/socket.c:1763 [inline]
 SyS_sendto+0x1de/0x2f0 net/socket.c:1731
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
RIP: 0033:0x459879
RSP: 002b:00007ffa6b83ac78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000459879
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 000000000075bf20 R08: 000000002057bff0 R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffa6b83b6d4
R13: 00000000004c783b R14: 00000000004dd0f0 R15: 00000000ffffffff

Allocated by task 19893:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:495
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 ip_mc_add1_src net/ipv4/igmp.c:1960 [inline]
 ip_mc_add_src+0xa79/0xd90 net/ipv4/igmp.c:2084
 ip_mc_source+0x81b/0xd70 net/ipv4/igmp.c:2390
 do_ip_setsockopt.isra.0+0xbc3/0x2d70 net/ipv4/ip_sockglue.c:995
 ip_setsockopt+0x36/0x90 net/ipv4/ip_sockglue.c:1248
 udp_setsockopt+0x45/0x80 net/ipv4/udp.c:2440
 SYSC_setsockopt net/socket.c:1865 [inline]
 SyS_setsockopt+0x12b/0x210 net/socket.c:1844
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292

Freed by task 19891:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x164/0x210 mm/kasan/common.c:457
 slab_free_hook mm/slub.c:1407 [inline]
 slab_free_freelist_hook mm/slub.c:1458 [inline]
 slab_free mm/slub.c:3039 [inline]
 kfree+0x108/0x3a0 mm/slub.c:3976
 ip_mc_del1_src+0x58a/0x6d0 net/ipv4/igmp.c:1873
 ip_mc_del_src+0x436/0x9c0 net/ipv4/igmp.c:1914
 ip_mc_leave_src+0xeb/0x230 net/ipv4/igmp.c:2205
 ip_mc_drop_socket+0x11a/0x240 net/ipv4/igmp.c:2659
 inet_release+0x47/0x1c0 net/ipv4/af_inet.c:409
 __sock_release+0xd2/0x2c0 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1139
 __fput+0x25e/0x710 fs/file_table.c:210
 task_work_run+0x125/0x1a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x13b/0x160 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x3a3/0x520 arch/x86/entry/common.c:297

The buggy address belongs to the object at ffff8881c92c0720
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8881c92c0720, ffff8881c92c0760)
The buggy address belongs to the page:
page:ffffea000724b000 count:1 mapcount:0 mapping:          (null) index:0x0
flags: 0x4000000000000200(slab)
raw: 4000000000000200 0000000000000000 0000000000000000 00000001802a002a
raw: dead000000000100 dead000000000200 ffff8881da803600 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881c92c0600: fb fb fb fb fb fb fb fb fc fc fc fc 00 00 00 00
 ffff8881c92c0680: 00 00 00 00 fc fc fc fc 00 00 00 00 00 00 00 00
>ffff8881c92c0700: fc fc fc fc fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8881c92c0780: fb fb fb fb fb fb fb fb fc fc fc fc 00 00 00 00
 ffff8881c92c0800: 00 00 00 00 fc fc fc fc fb fb fb fb fb fb fb fb

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/09/06 09:40 android-4.14 38733badc0e6 040fda58 .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.