KASAN: use-after-free Read in rfcomm_dlc_exists

24 views
Skip to first unread message

syzbot

unread,
Jun 17, 2019, 7:22:06 AM6/17/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 7aa823a9 Linux 4.19.51
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13c6144ea00000
kernel config: https://syzkaller.appspot.com/x/.config?x=57222bc62f28e3a6
dashboard link: https://syzkaller.appspot.com/bug?extid=adf79ce74134c34a39e4
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

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

==================================================================
BUG: KASAN: use-after-free in rfcomm_dlc_get
net/bluetooth/rfcomm/core.c:360 [inline]
BUG: KASAN: use-after-free in rfcomm_dlc_exists+0x17d/0x1a0
net/bluetooth/rfcomm/core.c:549
Read of size 1 at addr ffff888097192984 by task syz-executor.0/31866

CPU: 0 PID: 31866 Comm: syz-executor.0 Not tainted 4.19.51 #23
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+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
rfcomm_dlc_get net/bluetooth/rfcomm/core.c:360 [inline]
rfcomm_dlc_exists+0x17d/0x1a0 net/bluetooth/rfcomm/core.c:549
__rfcomm_create_dev net/bluetooth/rfcomm/tty.c:413 [inline]
rfcomm_create_dev net/bluetooth/rfcomm/tty.c:486 [inline]
rfcomm_dev_ioctl+0x591/0x1b60 net/bluetooth/rfcomm/tty.c:588
rfcomm_sock_ioctl+0x90/0xb0 net/bluetooth/rfcomm/sock.c:902
sock_do_ioctl+0xd8/0x2f0 net/socket.c:950
sock_ioctl+0x325/0x610 net/socket.c:1074
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688
ksys_ioctl+0xab/0xd0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4592c9
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f8c18f78c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004592c9
RDX: 0000000020000100 RSI: 00000000400452c8 RDI: 0000000000000004
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f8c18f796d4
R13: 00000000004c19ba R14: 00000000004d4700 R15: 00000000ffffffff

Allocated by task 11683:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
kmem_cache_alloc_trace+0x152/0x760 mm/slab.c:3625
kmalloc include/linux/slab.h:515 [inline]
kzalloc include/linux/slab.h:709 [inline]
rfcomm_dlc_alloc+0x66/0x3f0 net/bluetooth/rfcomm/core.c:305
rfcomm_sock_alloc.constprop.0+0xb3/0x360 net/bluetooth/rfcomm/sock.c:286
rfcomm_sock_create+0xf3/0x2b0 net/bluetooth/rfcomm/sock.c:329
bt_sock_create+0x16a/0x2d0 net/bluetooth/af_bluetooth.c:130
__sock_create+0x3d8/0x730 net/socket.c:1276
sock_create net/socket.c:1316 [inline]
__sys_socket+0x103/0x220 net/socket.c:1346
__do_sys_socket net/socket.c:1355 [inline]
__se_sys_socket net/socket.c:1353 [inline]
__x64_sys_socket+0x73/0xb0 net/socket.c:1353
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31848:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kfree+0xcf/0x220 mm/slab.c:3822
rfcomm_dlc_free+0x20/0x30 net/bluetooth/rfcomm/core.c:328
rfcomm_dlc_put include/net/bluetooth/rfcomm.h:258 [inline]
__rfcomm_create_dev net/bluetooth/rfcomm/tty.c:417 [inline]
rfcomm_create_dev net/bluetooth/rfcomm/tty.c:486 [inline]
rfcomm_dev_ioctl+0x181f/0x1b60 net/bluetooth/rfcomm/tty.c:588
rfcomm_sock_ioctl+0x90/0xb0 net/bluetooth/rfcomm/sock.c:902
sock_do_ioctl+0xd8/0x2f0 net/socket.c:950
sock_ioctl+0x325/0x610 net/socket.c:1074
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688
ksys_ioctl+0xab/0xd0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888097192840
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 324 bytes inside of
512-byte region [ffff888097192840, ffff888097192a40)
The buggy address belongs to the page:
page:ffffea00025c6480 count:1 mapcount:0 mapping:ffff88812c3f0940 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffffea0002531b48 ffffea00023f1348 ffff88812c3f0940
raw: 0000000000000000 ffff8880971920c0 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888097192880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888097192900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff888097192980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888097192a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888097192a80: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Jun 22, 2019, 4:37:06 AM6/22/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a5758c53 Linux 4.14.129
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11928026a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9116f86b1594833c
dashboard link: https://syzkaller.appspot.com/bug?extid=6864ce6c043bf8072603
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

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

==================================================================
BUG: KASAN: use-after-free in rfcomm_dlc_get
net/bluetooth/rfcomm/core.c:360 [inline]
BUG: KASAN: use-after-free in rfcomm_dlc_exists+0x152/0x170
net/bluetooth/rfcomm/core.c:549
Read of size 1 at addr ffff88808c872bcc by task syz-executor.0/351

CPU: 1 PID: 351 Comm: syz-executor.0 Not tainted 4.14.129 #23
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x19c lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc 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/0x2af mm/kasan/report.c:393
__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427
rfcomm_dlc_get net/bluetooth/rfcomm/core.c:360 [inline]
rfcomm_dlc_exists+0x152/0x170 net/bluetooth/rfcomm/core.c:549
__rfcomm_create_dev net/bluetooth/rfcomm/tty.c:413 [inline]
rfcomm_create_dev net/bluetooth/rfcomm/tty.c:486 [inline]
rfcomm_dev_ioctl+0x4a7/0x18b0 net/bluetooth/rfcomm/tty.c:588
rfcomm_sock_ioctl+0x82/0xa0 net/bluetooth/rfcomm/sock.c:902
sock_do_ioctl+0x64/0xb0 net/socket.c:974
sock_ioctl+0x2a6/0x470 net/socket.c:1071
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4592c9
RSP: 002b:00007f290b2f7c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004592c9
RDX: 0000000020000100 RSI: 00000000400452c8 RDI: 0000000000000004
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f290b2f86d4
R13: 00000000004c19ba R14: 00000000004d4700 R15: 00000000ffffffff

Allocated by task 8123:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
rfcomm_dlc_alloc+0x59/0x440 net/bluetooth/rfcomm/core.c:305
rfcomm_sock_alloc.constprop.0+0xb3/0x360 net/bluetooth/rfcomm/sock.c:285
rfcomm_sock_create+0xdb/0x2a0 net/bluetooth/rfcomm/sock.c:328
bt_sock_create+0x14c/0x2b0 net/bluetooth/af_bluetooth.c:130
__sock_create+0x2f6/0x620 net/socket.c:1275
sock_create net/socket.c:1315 [inline]
SYSC_socket net/socket.c:1345 [inline]
SyS_socket+0xd3/0x170 net/socket.c:1325
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 341:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 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+0xcc/0x270 mm/slab.c:3815
rfcomm_dlc_free+0x20/0x30 net/bluetooth/rfcomm/core.c:328
rfcomm_dlc_put include/net/bluetooth/rfcomm.h:258 [inline]
__rfcomm_create_dev net/bluetooth/rfcomm/tty.c:417 [inline]
rfcomm_create_dev net/bluetooth/rfcomm/tty.c:486 [inline]
rfcomm_dev_ioctl+0x1590/0x18b0 net/bluetooth/rfcomm/tty.c:588
rfcomm_sock_ioctl+0x82/0xa0 net/bluetooth/rfcomm/sock.c:902
sock_do_ioctl+0x64/0xb0 net/socket.c:974
sock_ioctl+0x2a6/0x470 net/socket.c:1071
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x7ae/0x1060 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff88808c872a80
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 332 bytes inside of
512-byte region [ffff88808c872a80, ffff88808c872c80)
The buggy address belongs to the page:
page:ffffea0002321c80 count:1 mapcount:0 mapping:ffff88808c872080
index:0xffff88808c872d00
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff88808c872080 ffff88808c872d00 0000000100000003
raw: ffffea00029648a0 ffffea00022ea8a0 ffff8880aa800940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808c872a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808c872b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88808c872b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88808c872c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808c872c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc

syzbot

unread,
May 12, 2020, 8:00:09 AM5/12/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Jun 13, 2020, 2:12:08 AM6/13/20
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages