KASAN: use-after-free Read in ieee80211_ibss_build_presp

14 views
Skip to first unread message

syzbot

unread,
Oct 28, 2020, 12:05:24 PM10/28/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 5b7a52cd Linux 4.14.202
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=126ed99c500000
kernel config: https://syzkaller.appspot.com/x/.config?x=fa386e02ca459165
dashboard link: https://syzkaller.appspot.com/bug?extid=11659667bfe36d2e7868
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11ab39d2500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11ae7702500000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+116596...@syzkaller.appspotmail.com

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:372 [inline]
BUG: KASAN: use-after-free in ieee80211_ibss_build_presp+0xf55/0x14b0 net/mac80211/ibss.c:173
Read of size 135 at addr ffff8880a9968800 by task kworker/u4:1/22

CPU: 1 PID: 22 Comm: kworker/u4:1 Not tainted 4.14.202-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: phy2 ieee80211_iface_work
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report+0x6f/0x7b mm/kasan/report.c:409
memcpy+0x20/0x50 mm/kasan/kasan.c:302
memcpy include/linux/string.h:372 [inline]
ieee80211_ibss_build_presp+0xf55/0x14b0 net/mac80211/ibss.c:173
__ieee80211_sta_join_ibss+0x5d1/0x1c80 net/mac80211/ibss.c:319
ieee80211_sta_create_ibss.cold+0xbb/0xf1 net/mac80211/ibss.c:1346
ieee80211_sta_find_ibss net/mac80211/ibss.c:1476 [inline]
ieee80211_ibss_work.cold+0x266/0x565 net/mac80211/ibss.c:1700
ieee80211_iface_work+0x690/0x770 net/mac80211/iface.c:1383
process_one_work+0x793/0x14a0 kernel/workqueue.c:2116
worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
kthread+0x30d/0x420 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

Allocated by task 8322:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc_track_caller+0x155/0x400 mm/slab.c:3735
kmemdup+0x23/0x50 mm/util.c:118
kmemdup include/linux/string.h:445 [inline]
ieee80211_ibss_join+0x761/0xd70 net/mac80211/ibss.c:1812
rdev_join_ibss net/wireless/rdev-ops.h:521 [inline]
__cfg80211_join_ibss+0x5bc/0xd90 net/wireless/ibss.c:132
cfg80211_join_ibss+0x70/0x90 net/wireless/ibss.c:155
nl80211_join_ibss+0xb4f/0xf00 net/wireless/nl80211.c:8623
genl_family_rcv_msg+0x572/0xb20 net/netlink/genetlink.c:600
genl_rcv_msg+0xaf/0x140 net/netlink/genetlink.c:625
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2433
genl_rcv+0x24/0x40 net/netlink/genetlink.c:636
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 8323:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
ieee80211_ibss_leave+0x83/0xd8 net/mac80211/ibss.c:1863
rdev_leave_ibss net/wireless/rdev-ops.h:531 [inline]
__cfg80211_leave_ibss+0x14c/0x6d0 net/wireless/ibss.c:217
__cfg80211_leave+0x2e4/0x3b0 net/wireless/core.c:1055
cfg80211_leave net/wireless/core.c:1106 [inline]
cfg80211_netdev_notifier_call+0xbfe/0x1b50 net/wireless/core.c:1205
notifier_call_chain+0x108/0x1a0 kernel/notifier.c:93
call_netdevice_notifiers_info net/core/dev.c:1667 [inline]
call_netdevice_notifiers net/core/dev.c:1683 [inline]
__dev_close_many+0xe3/0x270 net/core/dev.c:1424
__dev_close net/core/dev.c:1462 [inline]
__dev_change_flags+0x21f/0x540 net/core/dev.c:6792
dev_change_flags+0x7e/0x130 net/core/dev.c:6860
dev_ifsioc+0x23c/0x7d0 net/core/dev_ioctl.c:257
dev_ioctl+0x222/0xbe0 net/core/dev_ioctl.c:566
sock_do_ioctl net/socket.c:981 [inline]
sock_ioctl+0x164/0x4c0 net/socket.c:1071
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880a9968800
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes inside of
192-byte region [ffff8880a9968800, ffff8880a99688c0)
The buggy address belongs to the page:
page:ffffea0002a65a00 count:1 mapcount:0 mapping:ffff8880a9968000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a9968000 0000000000000000 0000000100000010
raw: ffffea0002a639e0 ffffea0002a69de0 ffff88813fe80040 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a9968700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a9968780: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8880a9968800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a9968880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880a9968900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Nov 6, 2020, 9:41:18 PM11/6/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: b94de4d1 Linux 4.19.155
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17980184500000
kernel config: https://syzkaller.appspot.com/x/.config?x=252047157acf1cb1
dashboard link: https://syzkaller.appspot.com/bug?extid=bda4a4a700ef2b45ed25
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=155d5792500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=104fccfa500000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+bda4a4...@syzkaller.appspotmail.com

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

syzbot

unread,
Apr 22, 2021, 6:26:09 PM4/22/21
to syzkaller...@googlegroups.com
syzbot suspects this issue was fixed by commit:

commit d2ddd5417f6d5be4421068434408e716787cf1b3
Author: Markus Theil <markus...@tu-ilmenau.de>
Date: Sat Feb 13 13:36:53 2021 +0000

mac80211: fix double free in ibss_leave

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16c8f8c1d00000
start commit: 6b6446ef Linux 4.14.204
git tree: linux-4.14.y
kernel config: https://syzkaller.appspot.com/x/.config?x=3b2e3745f25cbc4e
dashboard link: https://syzkaller.appspot.com/bug?extid=11659667bfe36d2e7868
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12ff8062500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16375792500000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: mac80211: fix double free in ibss_leave

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages