lkml.org 
[lkml]   [2019]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectKASAN: use-after-free Read in kfree_skb (3)
From
Hello,

syzbot found the following crash on:

HEAD commit: 085b7755 Linux 5.1-rc6
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15f6876b200000
kernel config: https://syzkaller.appspot.com/x/.config?x=a42d110b47dd6b36
dashboard link: https://syzkaller.appspot.com/bug?extid=dcb1305dd05699c40640
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+dcb1305dd05699c40640@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in atomic_read
include/asm-generic/atomic-instrumented.h:26 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:43
[inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:1022 [inline]
BUG: KASAN: use-after-free in kfree_skb+0x38/0x390 net/core/skbuff.c:659
Read of size 4 at addr ffff888091576a54 by task syz-executor.0/10940

CPU: 0 PID: 10940 Comm: syz-executor.0 Not tainted 5.1.0-rc6 #78
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:187
kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
check_memory_region_inline mm/kasan/generic.c:185 [inline]
check_memory_region+0x123/0x190 mm/kasan/generic.c:191
kasan_check_read+0x11/0x20 mm/kasan/common.c:102
atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
refcount_read include/linux/refcount.h:43 [inline]
skb_unref include/linux/skbuff.h:1022 [inline]
kfree_skb+0x38/0x390 net/core/skbuff.c:659
bcsp_recv+0x66b/0x13e0 drivers/bluetooth/hci_bcsp.c:623
hci_uart_tty_receive+0x22b/0x530 drivers/bluetooth/hci_ldisc.c:607
tiocsti drivers/tty/tty_io.c:2195 [inline]
tty_ioctl+0x4ed/0x15c0 drivers/tty/tty_io.c:2571
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696
ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x458c29
Code: ad b8 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 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f7c0d8adc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f7c0d8adc90 RCX: 0000000000458c29
RDX: 0000000020000200 RSI: 0000000000005412 RDI: 0000000000000003
RBP: 000000000073bfa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f7c0d8ae6d4
R13: 00000000004c3082 R14: 00000000004d6428 R15: 0000000000000004

Allocated by task 21:
save_stack+0x45/0xd0 mm/kasan/common.c:75
set_track mm/kasan/common.c:87 [inline]
__kasan_kmalloc mm/kasan/common.c:497 [inline]
__kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:505
slab_post_alloc_hook mm/slab.h:437 [inline]
slab_alloc_node mm/slab.c:3336 [inline]
kmem_cache_alloc_node+0x131/0x710 mm/slab.c:3646
__alloc_skb+0xd5/0x5e0 net/core/skbuff.c:196
alloc_skb include/linux/skbuff.h:1058 [inline]
bt_skb_alloc include/net/bluetooth/bluetooth.h:339 [inline]
bcsp_recv+0x8fb/0x13e0 drivers/bluetooth/hci_bcsp.c:685
hci_uart_tty_receive+0x22b/0x530 drivers/bluetooth/hci_ldisc.c:607
tty_ldisc_receive_buf+0x164/0x1c0 drivers/tty/tty_buffer.c:465
tty_port_default_receive_buf+0x7d/0xb0 drivers/tty/tty_port.c:38
receive_buf drivers/tty/tty_buffer.c:481 [inline]
flush_to_ldisc+0x228/0x390 drivers/tty/tty_buffer.c:533
process_one_work+0x98e/0x1790 kernel/workqueue.c:2269
worker_thread+0x98/0xe40 kernel/workqueue.c:2415
kthread+0x357/0x430 kernel/kthread.c:253
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

Freed by task 21:
save_stack+0x45/0xd0 mm/kasan/common.c:75
set_track mm/kasan/common.c:87 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
__cache_free mm/slab.c:3499 [inline]
kmem_cache_free+0x86/0x260 mm/slab.c:3765
kfree_skbmem net/core/skbuff.c:589 [inline]
kfree_skbmem+0xc5/0x150 net/core/skbuff.c:583
__kfree_skb net/core/skbuff.c:646 [inline]
kfree_skb net/core/skbuff.c:663 [inline]
kfree_skb+0xf0/0x390 net/core/skbuff.c:657
bcsp_recv+0x66b/0x13e0 drivers/bluetooth/hci_bcsp.c:623
hci_uart_tty_receive+0x22b/0x530 drivers/bluetooth/hci_ldisc.c:607
tty_ldisc_receive_buf+0x164/0x1c0 drivers/tty/tty_buffer.c:465
tty_port_default_receive_buf+0x7d/0xb0 drivers/tty/tty_port.c:38
receive_buf drivers/tty/tty_buffer.c:481 [inline]
flush_to_ldisc+0x228/0x390 drivers/tty/tty_buffer.c:533
process_one_work+0x98e/0x1790 kernel/workqueue.c:2269
worker_thread+0x98/0xe40 kernel/workqueue.c:2415
kthread+0x357/0x430 kernel/kthread.c:253
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff888091576980
which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 212 bytes inside of
224-byte region [ffff888091576980, ffff888091576a60)
The buggy address belongs to the page:
page:ffffea0002455d80 count:1 mapcount:0 mapping:ffff8880aa23bcc0 index:0x0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea00023eb4c8 ffffea00020a7c48 ffff8880aa23bcc0
raw: 0000000000000000 ffff8880915760c0 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888091576900: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
ffff888091576980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff888091576a00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff888091576a80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff888091576b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

\
 
 \ /
  Last update: 2019-05-07 11:36    [W:0.042 / U:2.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site