syzbot


KASAN: use-after-free Read in ieee80211_ibss_build_presp

Status: upstream: reported C repro on 2020/11/07 02:41
Reported-by: syzbot+bda4a4a700ef2b45ed25@syzkaller.appspotmail.com
First crash: 1266d, last: 949d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in ieee80211_ibss_build_presp C done 2 1129d 1275d 1/1 fixed on 2021/04/22 23:33
upstream KASAN: use-after-free Read in ieee80211_ibss_build_presp wireless C inconclusive done 3 1128d 1235d 0/26 auto-obsoleted due to no activity on 2023/08/06 14:44
Fix bisection attempts (13)
Created Duration User Patch Repo Result
2021/10/19 20:41 10m bisect fix linux-4.19.y error job log (0)
2021/09/19 20:07 34m bisect fix linux-4.19.y job log (0) log
2021/08/20 19:20 42m bisect fix linux-4.19.y job log (0) log
2021/07/21 18:43 37m bisect fix linux-4.19.y job log (0) log
2021/06/21 18:08 34m bisect fix linux-4.19.y job log (0) log
2021/05/22 02:06 35m bisect fix linux-4.19.y job log (0) log
2021/04/22 00:55 32m bisect fix linux-4.19.y job log (0) log
2021/03/23 00:30 24m bisect fix linux-4.19.y job log (0) log
2021/02/21 00:02 23m bisect fix linux-4.19.y job log (0) log
2021/02/18 01:25 19m bisect fix linux-4.19.y error job log (0)
2021/02/05 05:14 0m bisect fix linux-4.19.y error job log (0)
2021/01/06 04:49 25m bisect fix linux-4.19.y job log (0) log
2020/12/07 02:41 30m bisect fix linux-4.19.y job log (0) log

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:373 [inline]
BUG: KASAN: use-after-free in ieee80211_ibss_build_presp+0x109d/0x15c0 net/mac80211/ibss.c:173
Read of size 135 at addr ffff8880b5365d00 by task kworker/u4:4/2963

CPU: 1 PID: 2963 Comm: kworker/u4:4 Not tainted 4.19.155-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: phy0 ieee80211_iface_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report+0x8f/0x96 mm/kasan/report.c:412
 memcpy+0x20/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:373 [inline]
 ieee80211_ibss_build_presp+0x109d/0x15c0 net/mac80211/ibss.c:173
 __ieee80211_sta_join_ibss+0x677/0x1f30 net/mac80211/ibss.c:319
 ieee80211_sta_create_ibss.cold+0xcb/0x12b net/mac80211/ibss.c:1346
 ieee80211_sta_find_ibss net/mac80211/ibss.c:1476 [inline]
 ieee80211_ibss_work.cold+0x53/0x687 net/mac80211/ibss.c:1700
 ieee80211_iface_work+0x7ba/0x8a0 net/mac80211/iface.c:1366
 process_one_work+0x864/0x1570 kernel/workqueue.c:2155
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2298
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 8128:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc_track_caller+0x155/0x3c0 mm/slab.c:3742
 kmemdup+0x23/0x50 mm/util.c:118
 kmemdup include/linux/string.h:446 [inline]
 ieee80211_ibss_join+0x7ee/0xe80 net/mac80211/ibss.c:1811
 rdev_join_ibss net/wireless/rdev-ops.h:521 [inline]
 __cfg80211_join_ibss+0x73a/0x11e0 net/wireless/ibss.c:138
 nl80211_join_ibss+0xd59/0x1300 net/wireless/nl80211.c:9068
 genl_family_rcv_msg+0x642/0xc40 net/netlink/genetlink.c:602
 genl_rcv_msg+0xbf/0x160 net/netlink/genetlink.c:627
 netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:638
 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
 netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344
 netlink_sendmsg+0x6bb/0xc40 net/netlink/af_netlink.c:1909
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:632
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2115
 __sys_sendmsg net/socket.c:2153 [inline]
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8120:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 ieee80211_ibss_leave+0x83/0xd8 net/mac80211/ibss.c:1863
 rdev_leave_ibss net/wireless/rdev-ops.h:531 [inline]
 __cfg80211_leave_ibss+0x191/0x7c0 net/wireless/ibss.c:206
 __cfg80211_leave+0x318/0x430 net/wireless/core.c:1079
 cfg80211_leave net/wireless/core.c:1130 [inline]
 cfg80211_netdev_notifier_call+0xcb0/0x1aa0 net/wireless/core.c:1229
 notifier_call_chain+0xc0/0x230 kernel/notifier.c:93
 call_netdevice_notifiers net/core/dev.c:1762 [inline]
 __dev_close_many+0xee/0x2e0 net/core/dev.c:1459
 __dev_close net/core/dev.c:1497 [inline]
 __dev_change_flags+0x273/0x660 net/core/dev.c:7669
 dev_change_flags+0x7e/0x140 net/core/dev.c:7740
 dev_ifsioc+0x2ce/0x8c0 net/core/dev_ioctl.c:237
 dev_ioctl+0x1ab/0xc4c drivers/usb/gadget/legacy/inode.c:1261
 sock_do_ioctl+0x148/0x2d0 net/socket.c:973
 sock_ioctl+0x2ef/0x5d0 net/socket.c:1074
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b5365d00
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes inside of
 192-byte region [ffff8880b5365d00, ffff8880b5365dc0)
The buggy address belongs to the page:
page:ffffea0002d4d940 count:1 mapcount:0 mapping:ffff88813bff0040 index:0xffff8880b5365000
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002d4df88 ffffea0002d36fc8 ffff88813bff0040
raw: ffff8880b5365000 ffff8880b5365000 0000000100000009 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880b5365c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880b5365c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880b5365d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8880b5365d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8880b5365e00: 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/11/07 02:41 linux-4.19.y b94de4d19498 cba33199 .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.