syzbot


KASAN: use-after-free Read in ipt_do_table

Status: auto-closed as invalid on 2020/06/06 05:50
Reported-by: syzbot+76e957c2059673086f63@syzkaller.appspotmail.com
First crash: 1533d, last: 1533d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ipt_do_table netfilter syz error error 16 579d 728d 0/26 closed as invalid on 2022/11/17 17:58

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ifname_compare_aligned include/linux/netfilter/x_tables.h:412 [inline]
BUG: KASAN: use-after-free in ip_packet_match net/ipv4/netfilter/ip_tables.c:67 [inline]
BUG: KASAN: use-after-free in ipt_do_table+0x1a5c/0x1b30 net/ipv4/netfilter/ip_tables.c:287
Read of size 8 at addr ffff88804d4a4d40 by task syz-executor.2/30075

CPU: 1 PID: 30075 Comm: syz-executor.2 Not tainted 4.19.102-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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 ifname_compare_aligned include/linux/netfilter/x_tables.h:412 [inline]
 ip_packet_match net/ipv4/netfilter/ip_tables.c:67 [inline]
 ipt_do_table+0x1a5c/0x1b30 net/ipv4/netfilter/ip_tables.c:287
 iptable_mangle_hook+0xb3/0x4f0 net/ipv4/netfilter/iptable_mangle.c:85
 nf_hook_entry_hookfn include/linux/netfilter.h:119 [inline]
 nf_hook_slow+0xbc/0x1e0 net/netfilter/core.c:511
 nf_hook include/linux/netfilter.h:244 [inline]
 NF_HOOK include/linux/netfilter.h:287 [inline]
 ip_mc_output+0x8c9/0xf50 net/ipv4/ip_output.c:385
 dst_output include/net/dst.h:447 [inline]
 ip_local_out+0xbb/0x190 net/ipv4/ip_output.c:124
 ip_send_skb+0x42/0xf0 net/ipv4/ip_output.c:1446
 udp_send_skb.isra.0+0x6de/0x1200 net/ipv4/udp.c:845
 udp_sendmsg+0x1e04/0x25e0 net/ipv4/udp.c:1132
 inet_sendmsg+0x141/0x5d0 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x3e2/0x920 net/socket.c:2115
 __sys_sendmmsg+0x1bf/0x4e0 net/socket.c:2210
 __do_sys_sendmmsg net/socket.c:2239 [inline]
 __se_sys_sendmmsg net/socket.c:2236 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2236
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45b399
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fee82239c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007fee8223a6d4 RCX: 000000000045b399
RDX: 04000000000001a8 RSI: 0000000020007fc0 RDI: 0000000000000006
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000008cc R14: 00000000004ca262 R15: 000000000075bf2c

Allocated by task 30133:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __kmalloc_node+0x51/0x80 mm/slab.c:3696
 kmalloc_node include/linux/slab.h:557 [inline]
 kvmalloc_node+0x68/0x100 mm/util.c:423
 kvmalloc include/linux/mm.h:577 [inline]
 kvzalloc include/linux/mm.h:585 [inline]
 alloc_netdev_mqs+0x98/0xdb0 net/core/dev.c:9122
 rtnl_create_link+0x1dd/0xa40 net/core/rtnetlink.c:2869
 rtnl_newlink+0xf3f/0x1600 net/core/rtnetlink.c:3131
 rtnetlink_rcv_msg+0x463/0xb00 net/core/rtnetlink.c:4777
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4795
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x53a/0x730 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2153
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 30133:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcf/0x220 mm/slab.c:3822
 kvfree+0x61/0x70 mm/util.c:452
 netdev_freemem+0x4c/0x60 net/core/dev.c:9076
 netdev_release+0x86/0xb0 net/core/net-sysfs.c:1654
 device_release+0x7b/0x210 drivers/base/core.c:926
 kobject_cleanup lib/kobject.c:662 [inline]
 kobject_release lib/kobject.c:691 [inline]
 kref_put include/linux/kref.h:70 [inline]
 kobject_put+0x193/0x290 lib/kobject.c:708
 netdev_run_todo+0x53b/0x7a0 net/core/dev.c:8981
 rtnl_unlock net/core/rtnetlink.c:117 [inline]
 rtnetlink_rcv_msg+0x46f/0xb00 net/core/rtnetlink.c:4778
 netlink_rcv_skb+0x17d/0x460 net/netlink/af_netlink.c:2454
 rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4795
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x53a/0x730 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 ___sys_sendmsg+0x803/0x920 net/socket.c:2115
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2153
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2160
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88804d4a4d40
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 0 bytes inside of
 4096-byte region [ffff88804d4a4d40, ffff88804d4a5d40)
The buggy address belongs to the page:
page:ffffea0001352900 count:1 mapcount:0 mapping:ffff88812c31cdc0 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0001340c08 ffffea00027a0b88 ffff88812c31cdc0
raw: 0000000000000000 ffff88804d4a4d40 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88804d4a4c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88804d4a4c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88804d4a4d00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff88804d4a4d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804d4a4e00: fb fb fb fb fb fb fb fb 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
2020/02/07 05:49 linux-4.19.y b499cf4b3a90 06150bf1 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.