syzbot


KASAN: slab-out-of-bounds Read in ieee80211_key_free

Status: upstream: reported C repro on 2020/11/18 12:51
Reported-by: syzbot+fd7dd3e81f26543282c3@syzkaller.appspotmail.com
First crash: 1494d, last: 1315d
Fix bisection the fix commit could be any of (bisect log):
  0f1b4cb77d7f Linux 4.19.187
  9a2dc0e6c531 Linux 4.19.194
  
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2021/06/15 16:07 23m bisect fix linux-4.19.y OK (2) job log
2021/05/16 13:38 30m bisect fix linux-4.19.y OK (0) job log log
2021/03/21 16:32 22m bisect fix linux-4.19.y OK (0) job log log
2021/02/19 16:10 21m bisect fix linux-4.19.y OK (0) job log log
2021/02/17 11:35 19m bisect fix linux-4.19.y error job log
2021/01/29 20:03 5m bisect fix linux-4.19.y error job log
2020/12/18 12:51 28m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
==================================================================
BUG: KASAN: slab-out-of-bounds in ieee80211_key_free+0xf0/0x110 net/mac80211/key.c:722
Read of size 2 at addr ffff8880a9757ce8 by task syz-executor537/8133

CPU: 1 PID: 8133 Comm: syz-executor537 Not tainted 4.19.187-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+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load2_noabort+0x88/0x90 mm/kasan/report.c:431
 ieee80211_key_free+0xf0/0x110 net/mac80211/key.c:722
 ieee80211_del_key+0x162/0x3d0 net/mac80211/cfg.c:498
 rdev_del_key net/wireless/rdev-ops.h:106 [inline]
 nl80211_del_key+0x43e/0xc20 net/wireless/nl80211.c:3656
 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
RIP: 0033:0x440f09
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff9efd1268 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000440f09
RDX: 0000000000000000 RSI: 00000000200006c0 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000c00000000 R09: 0000000c00000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000a536
R13: 00007fff9efd12d0 R14: 00007fff9efd12c0 R15: 00007fff9efd128c

Allocated by task 1:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15a/0x3c0 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 kernfs_fop_write+0x32f/0x470 fs/kernfs/file.c:293
 __vfs_write+0xf7/0x770 fs/read_write.c:485
 vfs_write+0x1f3/0x540 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 1:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 kernfs_fop_write+0x188/0x470 fs/kernfs/file.c:330
 __vfs_write+0xf7/0x770 fs/read_write.c:485
 vfs_write+0x1f3/0x540 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 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 ffff8880a9757cc0
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 8 bytes to the right of
 32-byte region [ffff8880a9757cc0, ffff8880a9757ce0)
The buggy address belongs to the page:
page:ffffea0002a5d5c0 count:1 mapcount:0 mapping:ffff88813bff01c0 index:0xffff8880a9757fc1
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002a60388 ffffea0002a5d7c8 ffff88813bff01c0
raw: ffff8880a9757fc1 ffff8880a9757000 000000010000003f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a9757b80: 00 00 00 00 fc fc fc fc 00 00 00 fc fc fc fc fc
 ffff8880a9757c00: fb fb fb fb fc fc fc fc 00 00 06 fc fc fc fc fc
>ffff8880a9757c80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                                                          ^
 ffff8880a9757d00: 00 04 fc fc fc fc fc fc 00 00 00 00 fc fc fc fc
 ffff8880a9757d80: 00 01 fc fc fc fc fc fc 00 05 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/04/16 05:00 linux-4.19.y 0f1b4cb77d7f c59079a6 .config console log report syz C ci2-linux-4-19 KASAN: slab-out-of-bounds Read in ieee80211_key_free
2020/11/18 12:50 linux-4.19.y 31acccdc8774 09323409 .config console log report syz C ci2-linux-4-19
2020/12/30 17:57 linux-4.19.y 3207316b3bee ecb8c012 .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.