netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KASAN: use-after-free Write in hci_conn_del
@ 2020-08-04 15:45 syzbot
  2020-08-11  3:35 ` syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2020-08-04 15:45 UTC (permalink / raw)
  To: davem, johan.hedberg, kuba, linux-bluetooth, linux-kernel,
	marcel, netdev, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    bcf87687 Linux 5.8
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14184392900000
kernel config:  https://syzkaller.appspot.com/x/.config?x=19b11af1e394136d
dashboard link: https://syzkaller.appspot.com/bug?extid=7b1677fecb5976b0a099
compiler:       gcc (GCC) 10.1.0-syz 20200507
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15e1ff04900000

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

==================================================================
BUG: KASAN: use-after-free in hci_conn_del+0x64e/0x6a0 net/bluetooth/hci_conn.c:630
Write of size 8 at addr ffff888089f54938 by task syz-executor.1/6870

CPU: 0 PID: 6870 Comm: syz-executor.1 Not tainted 5.8.0-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+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 hci_conn_del+0x64e/0x6a0 net/bluetooth/hci_conn.c:630
 hci_conn_hash_flush+0x189/0x220 net/bluetooth/hci_conn.c:1537
 hci_dev_do_close+0x5c6/0x1080 net/bluetooth/hci_core.c:1761
 hci_unregister_dev+0x1a3/0xe20 net/bluetooth/hci_core.c:3606
 vhci_release+0x70/0xe0 drivers/bluetooth/hci_vhci.c:340
 __fput+0x33c/0x880 fs/file_table.c:281
 task_work_run+0xdd/0x190 kernel/task_work.c:135
 exit_task_work include/linux/task_work.h:25 [inline]
 do_exit+0xb72/0x2a40 kernel/exit.c:805
 do_group_exit+0x125/0x310 kernel/exit.c:903
 __do_sys_exit_group kernel/exit.c:914 [inline]
 __se_sys_exit_group kernel/exit.c:912 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:912
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45cce9
Code: Bad RIP value.
RSP: 002b:00007ffd598b2c88 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045cce9
RDX: 0000000000416741 RSI: 0000000000ca85f0 RDI: 0000000000000043
RBP: 00000000004c2983 R08: 000000000000000b R09: 0000000000000000
R10: 0000000002936940 R11: 0000000000000246 R12: 0000000000000008
R13: 00007ffd598b2dd0 R14: 0000000000136032 R15: 00007ffd598b2de0

Allocated by task 12376:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc+0x17a/0x340 mm/slab.c:3665
 kmalloc include/linux/slab.h:560 [inline]
 tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771
 tomoyo_file_open security/tomoyo/tomoyo.c:313 [inline]
 tomoyo_file_open+0xa3/0xd0 security/tomoyo/tomoyo.c:308
 security_file_open+0x52/0x3f0 security/security.c:1574
 do_dentry_open+0x3a0/0x1290 fs/open.c:815
 do_open fs/namei.c:3243 [inline]
 path_openat+0x1bb9/0x2750 fs/namei.c:3360
 do_filp_open+0x17e/0x3c0 fs/namei.c:3387
 do_sys_openat2+0x16f/0x3b0 fs/open.c:1179
 do_sys_open fs/open.c:1195 [inline]
 ksys_open include/linux/syscalls.h:1388 [inline]
 __do_sys_open fs/open.c:1201 [inline]
 __se_sys_open fs/open.c:1199 [inline]
 __x64_sys_open+0x119/0x1c0 fs/open.c:1199
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 12376:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3757
 tomoyo_realpath_from_path+0x191/0x620 security/tomoyo/realpath.c:291
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771
 tomoyo_file_open security/tomoyo/tomoyo.c:313 [inline]
 tomoyo_file_open+0xa3/0xd0 security/tomoyo/tomoyo.c:308
 security_file_open+0x52/0x3f0 security/security.c:1574
 do_dentry_open+0x3a0/0x1290 fs/open.c:815
 do_open fs/namei.c:3243 [inline]
 path_openat+0x1bb9/0x2750 fs/namei.c:3360
 do_filp_open+0x17e/0x3c0 fs/namei.c:3387
 do_sys_openat2+0x16f/0x3b0 fs/open.c:1179
 do_sys_open fs/open.c:1195 [inline]
 ksys_open include/linux/syscalls.h:1388 [inline]
 __do_sys_open fs/open.c:1201 [inline]
 __se_sys_open fs/open.c:1199 [inline]
 __x64_sys_open+0x119/0x1c0 fs/open.c:1199
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff888089f54000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 2360 bytes inside of
 4096-byte region [ffff888089f54000, ffff888089f55000)
The buggy address belongs to the page:
page:ffffea000227d500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea000227d500 order:1 compound_mapcount:0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea0001e59308 ffffea00028b3908 ffff8880aa002000
raw: 0000000000000000 ffff888089f54000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888089f54800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888089f54880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888089f54900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff888089f54980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888089f54a00: 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 syzkaller@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

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

* Re: KASAN: use-after-free Write in hci_conn_del
  2020-08-04 15:45 KASAN: use-after-free Write in hci_conn_del syzbot
@ 2020-08-11  3:35 ` syzbot
  2020-08-11  6:50   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2020-08-11  3:35 UTC (permalink / raw)
  To: clm, davem, dsterba, johan.hedberg, josef, kuba, linux-bluetooth,
	linux-btrfs, linux-kernel, marcel, nborisov, netdev,
	syzkaller-bugs

syzbot has bisected this issue to:

commit 6a3c7f5c87854e948c3c234e5f5e745c7c553722
Author: Nikolay Borisov <nborisov@suse.com>
Date:   Thu May 28 08:05:13 2020 +0000

    btrfs: don't balance btree inode pages from buffered write path

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=14f973c2900000
start commit:   5631c5e0 Merge tag 'xfs-5.9-merge-7' of git://git.kernel.o..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=16f973c2900000
console output: https://syzkaller.appspot.com/x/log.txt?x=12f973c2900000
kernel config:  https://syzkaller.appspot.com/x/.config?x=afba7c06f91e56eb
dashboard link: https://syzkaller.appspot.com/bug?extid=7b1677fecb5976b0a099
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=155d73fa900000

Reported-by: syzbot+7b1677fecb5976b0a099@syzkaller.appspotmail.com
Fixes: 6a3c7f5c8785 ("btrfs: don't balance btree inode pages from buffered write path")

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

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

* Re: KASAN: use-after-free Write in hci_conn_del
  2020-08-11  3:35 ` syzbot
@ 2020-08-11  6:50   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-08-11  6:50 UTC (permalink / raw)
  To: syzbot
  Cc: clm, davem, dsterba, johan.hedberg, josef, kuba, linux-bluetooth,
	linux-btrfs, linux-kernel, marcel, nborisov, netdev,
	syzkaller-bugs

On Mon, Aug 10, 2020 at 08:35:08PM -0700, syzbot wrote:
> syzbot has bisected this issue to:
> 
> commit 6a3c7f5c87854e948c3c234e5f5e745c7c553722
> Author: Nikolay Borisov <nborisov@suse.com>
> Date:   Thu May 28 08:05:13 2020 +0000
> 
>     btrfs: don't balance btree inode pages from buffered write path

This does not make sense wrt use-after-free in HCI, which is completely
unrelated subsystem.

The patch removes a call to function doing some potentially heavy work,
so this likely affects timing and making the bisection unreliable.

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

end of thread, other threads:[~2020-08-11  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 15:45 KASAN: use-after-free Write in hci_conn_del syzbot
2020-08-11  3:35 ` syzbot
2020-08-11  6:50   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).