syzbot


KASAN: use-after-free Write in batadv_iv_ogm_schedule

Status: auto-closed as invalid on 2020/07/11 11:03
Reported-by: syzbot+5b61e5e7ea0ff1aae244@syzkaller.appspotmail.com
First crash: 1767d, last: 1716d

Sample crash report:
batman_adv: batadv0: Removing interface: batadv_slave_0
==================================================================
BUG: KASAN: use-after-free in batadv_iv_ogm_schedule+0xd9b/0xdf0 net/batman-adv/bat_iv_ogm.c:951
Write of size 2 at addr ffff88808f236796 by task kworker/u4:5/7649

CPU: 1 PID: 7649 Comm: kworker/u4:5 Not tainted 4.14.173-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x13e/0x194 lib/dump_stack.c:58
 print_address_description.cold+0x7c/0x1e2 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2ae mm/kasan/report.c:393
 batadv_iv_ogm_schedule+0xd9b/0xdf0 net/batman-adv/bat_iv_ogm.c:951
 batadv_iv_send_outstanding_bat_ogm_packet+0x4ad/0x6a0 net/batman-adv/bat_iv_ogm.c:1809
 process_one_work+0x813/0x1540 kernel/workqueue.c:2114
 worker_thread+0x5d1/0x1070 kernel/workqueue.c:2248
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 7649:
 save_stack+0x32/0xa0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
 __do_kmalloc mm/slab.c:3720 [inline]
 __kmalloc+0x15b/0x7c0 mm/slab.c:3729
 kmalloc include/linux/slab.h:493 [inline]
 batadv_tvlv_realloc_packet_buff net/batman-adv/tvlv.c:288 [inline]
 batadv_tvlv_container_ogm_append+0x12a/0x490 net/batman-adv/tvlv.c:329
 batadv_iv_ogm_schedule+0xb78/0xdf0 net/batman-adv/bat_iv_ogm.c:945
 batadv_iv_send_outstanding_bat_ogm_packet+0x4ad/0x6a0 net/batman-adv/bat_iv_ogm.c:1809
 process_one_work+0x813/0x1540 kernel/workqueue.c:2114
 worker_thread+0x5d1/0x1070 kernel/workqueue.c:2248
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Freed by task 5:
 save_stack+0x32/0xa0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcb/0x260 mm/slab.c:3815
 batadv_iv_ogm_iface_disable+0x34/0x70 net/batman-adv/bat_iv_ogm.c:393
 batadv_hardif_disable_interface.cold+0x61e/0x867 net/batman-adv/hard-interface.c:836
 batadv_softif_destroy_netlink+0xa3/0x140 net/batman-adv/soft-interface.c:1134
 default_device_exit_batch+0x209/0x380 net/core/dev.c:8734
 ops_exit_list.isra.0+0xef/0x140 net/core/net_namespace.c:145
 cleanup_net+0x3bb/0x820 net/core/net_namespace.c:484
 process_one_work+0x813/0x1540 kernel/workqueue.c:2114
 worker_thread+0x5d1/0x1070 kernel/workqueue.c:2248
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff88808f236780
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 22 bytes inside of
 128-byte region [ffff88808f236780, ffff88808f236800)
The buggy address belongs to the page:
page:ffffea00023c8d80 count:1 mapcount:0 mapping:ffff88808f236000 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffff88808f236000 0000000000000000 0000000100000015
raw: ffffea00025ba5e0 ffffea00023acde0 ffff88812fe56640 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808f236680: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff88808f236700: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff88808f236780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88808f236800: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff88808f236880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/13 11:02 linux-4.14.y 12cd844a39ed fd69032d .config console log report ci2-linux-4-14
2020/03/13 07:13 linux-4.14.y 12cd844a39ed fd69032d .config console log report ci2-linux-4-14
2020/03/12 13:33 linux-4.14.y 12cd844a39ed d850e9d0 .config console log report ci2-linux-4-14
2020/03/11 14:29 linux-4.14.y 78d697fc93f9 e103bc9e .config console log report ci2-linux-4-14
2020/02/05 21:49 linux-4.14.y e0f8b8a65a47 662cf49a .config console log report ci2-linux-4-14
2020/02/01 00:45 linux-4.14.y 9fa690a2a016 0eb59c27 .config console log report ci2-linux-4-14
2020/01/28 14:09 linux-4.14.y 9a95f25269bd 56cd6c9b .config console log report ci2-linux-4-14
2020/01/28 10:58 linux-4.14.y 9a95f25269bd 56cd6c9b .config console log report ci2-linux-4-14
2020/01/27 04:07 linux-4.14.y 8bac50406cca dd56146d .config console log report ci2-linux-4-14
2020/01/26 15:35 linux-4.14.y 8bac50406cca f4e7270e .config console log report ci2-linux-4-14
2020/01/24 17:04 linux-4.14.y 8bac50406cca 2e95ab33 .config console log report ci2-linux-4-14
2020/01/22 08:39 linux-4.14.y c1141b3aab36 8eda0b95 .config console log report ci2-linux-4-14
2020/01/21 16:33 linux-4.14.y c1141b3aab36 8eda0b95 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.