syzbot


KASAN: use-after-free Read in ieee80211_ibss_build_presp

Status: auto-obsoleted due to no activity on 2023/08/06 14:44
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+cd25350b5fe5b8ed143c@syzkaller.appspotmail.com
First crash: 1200d, last: 1090d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: WARNING in sysfs_warn_dup (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit 3bd801b14e0c5d29eeddc7336558beb3344efaa3
Author: Markus Theil <markus.theil@tu-ilmenau.de>
Date: Sat Feb 13 13:36:53 2021 +0000

  mac80211: fix double free in ibss_leave

  
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in ieee80211_ibss_build_presp 0 (1) 2020/12/07 19:03
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 1091d 1237d 1/1 fixed on 2021/04/22 23:33
linux-4.19 KASAN: use-after-free Read in ieee80211_ibss_build_presp C error 1 911d 1228d 0/1 upstream: reported C repro on 2020/11/07 02:41
Last patch testing requests (7)
Created Duration User Patch Repo Result
2023/06/21 19:48 20m retest repro upstream report log
2023/04/12 18:11 19m retest repro upstream report log
2022/12/31 02:31 18m retest repro upstream report log
2022/09/21 22:29 17m retest repro upstream report log
2022/09/21 20:29 20m retest repro upstream OK log
2022/09/14 20:29 18m retest repro upstream OK log
2021/08/13 15:32 18m phind.uet@gmail.com linux-next OK
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2023/08/06 08:05 6h39m bisect fix upstream job log (1)
2021/04/23 20:26 3h59m bisect fix upstream job log (1)
marked invalid by nogikh@google.com
2021/03/07 02:57 25m bisect fix upstream job log (0) log
2021/02/03 03:58 1m bisect fix upstream error job log (0)
2021/01/04 03:34 23m bisect fix upstream job log (0) log

Sample crash report:
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 ieee80211_ibss_build_presp+0xfdb/0x1850 net/mac80211/ibss.c:171
Read of size 4 at addr ffff88801ce26fc8 by task kworker/u4:4/197

CPU: 1 PID: 197 Comm: kworker/u4:4 Not tainted 5.12.0-rc4-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:79 [inline]
 dump_stack+0x176/0x24e lib/dump_stack.c:120
 print_address_description+0x5f/0x3a0 mm/kasan/report.c:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report+0x15c/0x200 mm/kasan/report.c:416
 check_region_inline mm/kasan/generic.c:135 [inline]
 kasan_check_range+0x2b5/0x2f0 mm/kasan/generic.c:186
 memcpy+0x25/0x60 mm/kasan/shadow.c:65
 ieee80211_ibss_build_presp+0xfdb/0x1850 net/mac80211/ibss.c:171
 __ieee80211_sta_join_ibss+0x70d/0x12f0 net/mac80211/ibss.c:317
 ieee80211_sta_create_ibss+0x312/0x530 net/mac80211/ibss.c:1354
 ieee80211_sta_find_ibss net/mac80211/ibss.c:1484 [inline]
 ieee80211_ibss_work+0xdb1/0x1450 net/mac80211/ibss.c:1708
 process_one_work+0x789/0xfd0 kernel/workqueue.c:2275
 worker_thread+0xac1/0x1300 kernel/workqueue.c:2421
 kthread+0x39a/0x3c0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Allocated by task 6461:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 ____kasan_kmalloc+0xc2/0xf0 mm/kasan/common.c:506
 kasan_kmalloc include/linux/kasan.h:233 [inline]
 __kmalloc+0xb4/0x380 mm/slub.c:4055
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:684 [inline]
 smk_parse_smack+0x18e/0x220 security/smack/smack_access.c:468
 smk_import_entry+0x22/0x400 security/smack/smack_access.c:564
 smk_fetch security/smack/smack_lsm.c:298 [inline]
 smack_d_instantiate+0x6af/0xcc0 security/smack/smack_lsm.c:3411
 security_d_instantiate+0xa5/0x100 security/security.c:1987
 d_instantiate+0x51/0x90 fs/dcache.c:2006
 shmem_symlink+0x53f/0x6f0 mm/shmem.c:3131
 vfs_symlink+0x3a0/0x540 fs/namei.c:4176
 do_symlinkat+0x1c9/0x440 fs/namei.c:4206
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 8417:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x3d/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:357
 ____kasan_slab_free+0x100/0x140 mm/kasan/common.c:360
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x171/0x270 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kfree+0xcf/0x2d0 mm/slub.c:4213
 ieee80211_ibss_leave+0x80/0xf0 net/mac80211/ibss.c:1876
 rdev_leave_ibss net/wireless/rdev-ops.h:545 [inline]
 __cfg80211_leave_ibss+0x11c/0x200 net/wireless/ibss.c:213
 cfg80211_leave_ibss+0x5c/0x70 net/wireless/ibss.c:231
 cfg80211_change_iface+0x46c/0xb40 net/wireless/util.c:1047
 nl80211_set_interface+0x497/0x7f0 net/wireless/nl80211.c:3912
 genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]
 genl_rcv_msg+0xe4e/0x1280 net/netlink/genetlink.c:800
 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2502
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x786/0x940 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x9ae/0xd50 net/netlink/af_netlink.c:1927
 sock_sendmsg_nosec net/socket.c:654 [inline]
 sock_sendmsg net/socket.c:674 [inline]
 ____sys_sendmsg+0x519/0x800 net/socket.c:2350
 ___sys_sendmsg net/socket.c:2404 [inline]
 __sys_sendmsg+0x2bf/0x370 net/socket.c:2433
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88801ce26fc8
 which belongs to the cache kmalloc-8 of size 8
The buggy address is located 0 bytes inside of
 8-byte region [ffff88801ce26fc8, ffff88801ce26fd0)
The buggy address belongs to the page:
page:ffffea0000738980 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ce26
flags: 0xfff00000000200(slab)
raw: 00fff00000000200 ffffea0000421d80 0000000e0000000e ffff888010841280
raw: 0000000000000000 0000000080660066 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88801ce26e80: fc 00 fc fc fc fc 00 fc fc fc fc fb fc fc fc fc
 ffff88801ce26f00: fb fc fc fc fc fb fc fc fc fc 00 fc fc fc fc 00
>ffff88801ce26f80: fc fc fc fc 00 fc fc fc fc fa fc fc fc fc fc fc
                                              ^
 ffff88801ce27000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88801ce27080: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/03/24 20:26 upstream 7acac4b3196c 607e3baf .config console log report syz C ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ieee80211_ibss_build_presp
2021/02/04 22:48 upstream 61556703b610 42b90a7c .config console log report syz C ci-upstream-kasan-gce-smack-root KASAN: use-after-free Read in ieee80211_ibss_build_presp
2020/12/05 03:34 upstream e87297fa080a 20366b87 .config console log report syz C ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.