All of lore.kernel.org
 help / color / mirror / Atom feed
* KASAN: use-after-free Read in kfree_skb (3)
@ 2019-05-07  9:36 syzbot
  2019-06-10 14:54 ` syzbot
  2019-06-11  0:03 ` syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2019-05-07  9:36 UTC (permalink / raw)
  To: johan.hedberg, linux-bluetooth, linux-kernel, marcel, syzkaller-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: KASAN: use-after-free Read in kfree_skb (3)
  2019-05-07  9:36 KASAN: use-after-free Read in kfree_skb (3) syzbot
@ 2019-06-10 14:54 ` syzbot
  2019-06-11  0:03 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2019-06-10 14:54 UTC (permalink / raw)
  To: johan.hedberg, linux-bluetooth, linux-kernel, marcel, syzkaller-bugs

syzbot has found a reproducer for the following crash on:

HEAD commit:    d1fdb6d8 Linux 5.2-rc4
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=138bdc01a00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fa9f7e1b6a8bb586
dashboard link: https://syzkaller.appspot.com/bug?extid=dcb1305dd05699c40640
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=13c787f2a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10e32801a00000

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:1016 [inline]
BUG: KASAN: use-after-free in kfree_skb+0x38/0x390 net/core/skbuff.c:690
Read of size 4 at addr ffff88808d7fb2d4 by task kworker/u4:3/189

CPU: 0 PID: 189 Comm: kworker/u4:3 Not tainted 5.2.0-rc4 #25
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
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:188
  __kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
  kasan_report+0x12/0x20 mm/kasan/common.c:614
  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:94
  atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
  refcount_read include/linux/refcount.h:43 [inline]
  skb_unref include/linux/skbuff.h:1016 [inline]
  kfree_skb+0x38/0x390 net/core/skbuff.c:690
  bcsp_recv+0x2d8/0x13a0 drivers/bluetooth/hci_bcsp.c:608
  hci_uart_tty_receive+0x225/0x530 drivers/bluetooth/hci_ldisc.c:592
  tty_ldisc_receive_buf+0x15f/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+0x222/0x390 drivers/tty/tty_buffer.c:533
  process_one_work+0x989/0x1790 kernel/workqueue.c:2269
  worker_thread+0x98/0xe40 kernel/workqueue.c:2415
  kthread+0x354/0x420 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 189:
  save_stack+0x23/0x90 mm/kasan/common.c:71
  set_track mm/kasan/common.c:79 [inline]
  __kasan_kmalloc mm/kasan/common.c:489 [inline]
  __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:462
  kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:497
  slab_post_alloc_hook mm/slab.h:437 [inline]
  slab_alloc_node mm/slab.c:3269 [inline]
  kmem_cache_alloc_node+0x131/0x710 mm/slab.c:3579
  __alloc_skb+0xd5/0x5e0 net/core/skbuff.c:194
  alloc_skb include/linux/skbuff.h:1054 [inline]
  bt_skb_alloc include/net/bluetooth/bluetooth.h:339 [inline]
  bcsp_recv+0x8c1/0x13a0 drivers/bluetooth/hci_bcsp.c:670
  hci_uart_tty_receive+0x225/0x530 drivers/bluetooth/hci_ldisc.c:592
  tty_ldisc_receive_buf+0x15f/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+0x222/0x390 drivers/tty/tty_buffer.c:533
  process_one_work+0x989/0x1790 kernel/workqueue.c:2269
  worker_thread+0x98/0xe40 kernel/workqueue.c:2415
  kthread+0x354/0x420 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Freed by task 8808:
  save_stack+0x23/0x90 mm/kasan/common.c:71
  set_track mm/kasan/common.c:79 [inline]
  __kasan_slab_free+0x102/0x150 mm/kasan/common.c:451
  kasan_slab_free+0xe/0x10 mm/kasan/common.c:459
  __cache_free mm/slab.c:3432 [inline]
  kmem_cache_free+0x86/0x260 mm/slab.c:3698
  kfree_skbmem net/core/skbuff.c:620 [inline]
  kfree_skbmem+0xc5/0x150 net/core/skbuff.c:614
  __kfree_skb net/core/skbuff.c:677 [inline]
  kfree_skb net/core/skbuff.c:694 [inline]
  kfree_skb+0xf0/0x390 net/core/skbuff.c:688
  bcsp_recv+0x2d8/0x13a0 drivers/bluetooth/hci_bcsp.c:608
  hci_uart_tty_receive+0x225/0x530 drivers/bluetooth/hci_ldisc.c:592
  tiocsti drivers/tty/tty_io.c:2195 [inline]
  tty_ioctl+0x921/0x14a0 drivers/tty/tty_io.c:2571
  vfs_ioctl fs/ioctl.c:46 [inline]
  file_ioctl fs/ioctl.c:509 [inline]
  do_vfs_ioctl+0xd5f/0x1380 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+0xfd/0x680 arch/x86/entry/common.c:301
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88808d7fb200
  which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 212 bytes inside of
  224-byte region [ffff88808d7fb200, ffff88808d7fb2e0)
The buggy address belongs to the page:
page:ffffea000235fec0 refcount:1 mapcount:0 mapping:ffff88821b6f6540  
index:0x0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea000256f0c8 ffffea0002a49888 ffff88821b6f6540
raw: 0000000000000000 ffff88808d7fb0c0 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff88808d7fb180: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
  ffff88808d7fb200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88808d7fb280: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                                                  ^
  ffff88808d7fb300: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
  ffff88808d7fb380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: KASAN: use-after-free Read in kfree_skb (3)
  2019-05-07  9:36 KASAN: use-after-free Read in kfree_skb (3) syzbot
  2019-06-10 14:54 ` syzbot
@ 2019-06-11  0:03 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2019-06-11  0:03 UTC (permalink / raw)
  To: johan.hedberg, linux-bluetooth, linux-kernel, marcel,
	syzkaller-bugs, thierry.reding

syzbot has bisected this bug to:

commit 5ec8c48a6235175f7ff59ed1acbe91d4d0398026
Author: Thierry Reding <thierry.reding@gmail.com>
Date:   Thu Jul 6 15:16:47 2017 +0000

     Merge branch 'for-4.13/drivers' into for-next

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=14ef22daa00000
start commit:   d1fdb6d8 Linux 5.2-rc4
git tree:       upstream
final crash:    https://syzkaller.appspot.com/x/report.txt?x=16ef22daa00000
console output: https://syzkaller.appspot.com/x/log.txt?x=12ef22daa00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fa9f7e1b6a8bb586
dashboard link: https://syzkaller.appspot.com/bug?extid=dcb1305dd05699c40640
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=13c787f2a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10e32801a00000

Reported-by: syzbot+dcb1305dd05699c40640@syzkaller.appspotmail.com
Fixes: 5ec8c48a6235 ("Merge branch 'for-4.13/drivers' into for-next")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-11  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-07  9:36 KASAN: use-after-free Read in kfree_skb (3) syzbot
2019-06-10 14:54 ` syzbot
2019-06-11  0:03 ` syzbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.