linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KASAN: use-after-free Read in relay_switch_subbuf
@ 2018-09-26  7:41 syzbot
  2019-11-06  7:58 ` syzbot
  2019-11-18  6:59 ` syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2018-09-26  7:41 UTC (permalink / raw)
  To: akpm, ebiggers, jrdr.linux, keescook, linux-kernel, mawilcox,
	rientjes, syzkaller-bugs, viro

Hello,

syzbot found the following crash on:

HEAD commit:    2dd68cc7fd8c Merge gitolite.kernel.org:/pub/scm/linux/kern..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=105fe676400000
kernel config:  https://syzkaller.appspot.com/x/.config?x=22a62640793a83c9
dashboard link: https://syzkaller.appspot.com/bug?extid=29093015c21333d1c46d
compiler:       gcc (GCC) 8.0.1 20180413 (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+29093015c21333d1c46d@syzkaller.appspotmail.com

8021q: adding VLAN 0 to HW filter on device team0
device team0 left promiscuous mode
device team_slave_0 left promiscuous mode
device team_slave_1 left promiscuous mode
==================================================================
BUG: KASAN: use-after-free in relay_switch_subbuf+0xa0e/0xa70  
kernel/relay.c:753
Read of size 8 at addr ffff8801b3c10778 by task kworker/0:3/5668

CPU: 0 PID: 5668 Comm: kworker/0:3 Not tainted 4.19.0-rc5+ #30
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Workqueue: events __blk_release_queue
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x1c4/0x2b4 lib/dump_stack.c:113
  print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
  kasan_report_error mm/kasan/report.c:354 [inline]
  kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
  __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
  relay_switch_subbuf+0xa0e/0xa70 kernel/relay.c:753
  relay_flush+0x1c6/0x280 kernel/relay.c:881
  __blk_trace_startstop.isra.20+0x2ae/0x8c0 kernel/trace/blktrace.c:668
  blk_trace_shutdown+0x5b/0x80 kernel/trace/blktrace.c:751
  __blk_release_queue+0x22d/0x500 block/blk-sysfs.c:852
  process_one_work+0xc90/0x1b90 kernel/workqueue.c:2153
device team0 entered promiscuous mode
  worker_thread+0x17f/0x1390 kernel/workqueue.c:2296
device team_slave_0 entered promiscuous mode
device team_slave_1 entered promiscuous mode
  kthread+0x35a/0x420 kernel/kthread.c:246
  ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413

Allocated by task 26646:
  save_stack+0x43/0xd0 mm/kasan/kasan.c:448
  set_track mm/kasan/kasan.c:460 [inline]
  kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
  kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
  kmem_cache_alloc+0x12e/0x730 mm/slab.c:3554
8021q: adding VLAN 0 to HW filter on device team0
  __d_alloc+0xc8/0xcc0 fs/dcache.c:1614
  d_alloc+0x96/0x380 fs/dcache.c:1698
  d_alloc_parallel+0x15a/0x1f40 fs/dcache.c:2441
  __lookup_slow+0x1e6/0x540 fs/namei.c:1654
  lookup_one_len+0x1d8/0x220 fs/namei.c:2543
  start_creating+0xf2/0x220 fs/debugfs/inode.c:308
  __debugfs_create_file+0x63/0x400 fs/debugfs/inode.c:347
  debugfs_create_file+0x57/0x70 fs/debugfs/inode.c:399
  blk_create_buf_file_callback+0x33/0x40 kernel/trace/blktrace.c:444
  relay_create_buf_file+0xf6/0x150 kernel/relay.c:428
  relay_open_buf.part.10+0x753/0xb20 kernel/relay.c:455
  relay_open_buf kernel/relay.c:447 [inline]
  relay_open+0x5e9/0xac0 kernel/relay.c:597
  do_blk_trace_setup+0x4fb/0xda0 kernel/trace/blktrace.c:532
  __blk_trace_setup+0xd5/0x180 kernel/trace/blktrace.c:577
  blk_trace_ioctl+0x17a/0x2f0 kernel/trace/blktrace.c:716
  blkdev_ioctl+0x8bc/0x2010 block/ioctl.c:587
  block_ioctl+0xee/0x130 fs/block_dev.c:1883
  vfs_ioctl fs/ioctl.c:46 [inline]
  file_ioctl fs/ioctl.c:501 [inline]
  do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
  ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
  __do_sys_ioctl fs/ioctl.c:709 [inline]
  __se_sys_ioctl fs/ioctl.c:707 [inline]
  __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
  do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 26604:
  save_stack+0x43/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:3498 [inline]
  kmem_cache_free+0x83/0x290 mm/slab.c:3756
  __d_free+0x20/0x30 fs/dcache.c:257
  __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
  rcu_do_batch kernel/rcu/tree.c:2576 [inline]
  invoke_rcu_callbacks kernel/rcu/tree.c:2880 [inline]
  __rcu_process_callbacks kernel/rcu/tree.c:2847 [inline]
  rcu_process_callbacks+0xf23/0x2670 kernel/rcu/tree.c:2864
  __do_softirq+0x30b/0xad8 kernel/softirq.c:292

The buggy address belongs to the object at ffff8801b3c10720
  which belongs to the cache dentry(81:syz1) of size 288
The buggy address is located 88 bytes inside of
  288-byte region [ffff8801b3c10720, ffff8801b3c10840)
The buggy address belongs to the page:
page:ffffea0006cf0400 count:1 mapcount:0 mapping:ffff8801bb6ce300 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00072adb88 ffffea0006800c48 ffff8801bb6ce300
raw: 0000000000000000 ffff8801b3c10040 000000010000000b ffff8801c7eb6100
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8801c7eb6100

Memory state around the buggy address:
  ffff8801b3c10600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff8801b3c10680: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
> ffff8801b3c10700: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
                                                                 ^
  ffff8801b3c10780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff8801b3c10800: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================
kobject: 'loop1' (00000000f4503744): kobject_uevent_env
device team0 left promiscuous mode
kobject: 'loop1' (00000000f4503744): fill_kobj_path: path  
= '/devices/virtual/block/loop1'
device team_slave_0 left promiscuous mode
kobject: 'cpu0' (000000004fdcedbb): kobject_add_internal: parent: '0',  
set: '<NULL>'
device team_slave_1 left promiscuous mode
kobject: 'cpu1' (00000000e70df734): kobject_add_internal: parent: '0',  
set: '<NULL>'
kobject: 'kvm' (000000009a7db5f0): kobject_uevent_env
kobject: 'queue' (0000000084fcdfca): kobject_uevent_env
kobject: 'kvm' (000000009a7db5f0): fill_kobj_path: path  
= '/devices/virtual/misc/kvm'
kobject: 'queue' (0000000084fcdfca): kobject_uevent_env: filter function  
caused the event to drop!
device team0 entered promiscuous mode


---
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#bug-status-tracking for how to communicate with  
syzbot.

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

* Re: KASAN: use-after-free Read in relay_switch_subbuf
  2018-09-26  7:41 KASAN: use-after-free Read in relay_switch_subbuf syzbot
@ 2019-11-06  7:58 ` syzbot
  2019-11-18  6:59 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2019-11-06  7:58 UTC (permalink / raw)
  To: akpm, ebiggers, gregkh, jannh, jrdr.linux, keescook,
	linux-kernel, mawilcox, rientjes, syzkaller-bugs, viro

syzbot has found a reproducer for the following crash on:

HEAD commit:    26bc6721 Merge tag 'for-linus-2019-11-05' of git://git.ker..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17b7b7cce00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8c5e2eca3f31f9bf
dashboard link: https://syzkaller.appspot.com/bug?extid=29093015c21333d1c46d
compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=132afbcce00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=179a1f8ae00000

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

==================================================================
BUG: KASAN: use-after-free in relay_switch_subbuf+0x8be/0x920  
kernel/relay.c:755
Read of size 8 at addr ffff88808d5054f8 by task kworker/1:3/3760

CPU: 1 PID: 3760 Comm: kworker/1:3 Not tainted 5.4.0-rc6+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Workqueue: events __blk_release_queue
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x172/0x1f0 lib/dump_stack.c:113
  print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
  __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
  kasan_report+0x12/0x20 mm/kasan/common.c:634
  __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
  relay_switch_subbuf+0x8be/0x920 kernel/relay.c:755
  relay_flush kernel/relay.c:883 [inline]
  relay_flush+0x1c4/0x280 kernel/relay.c:867
  __blk_trace_startstop.isra.0+0x216/0x630 kernel/trace/blktrace.c:662
  blk_trace_shutdown+0x5f/0x90 kernel/trace/blktrace.c:746
  __blk_release_queue+0x219/0x380 block/blk-sysfs.c:904
  process_one_work+0x9af/0x1740 kernel/workqueue.c:2269
  worker_thread+0x98/0xe40 kernel/workqueue.c:2415
  kthread+0x361/0x430 kernel/kthread.c:255
  ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Allocated by task 11279:
  save_stack+0x23/0x90 mm/kasan/common.c:69
  set_track mm/kasan/common.c:77 [inline]
  __kasan_kmalloc mm/kasan/common.c:510 [inline]
  __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:483
  kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:518
  slab_post_alloc_hook mm/slab.h:584 [inline]
  slab_alloc mm/slab.c:3319 [inline]
  kmem_cache_alloc+0x121/0x710 mm/slab.c:3483
  __d_alloc+0x2e/0x8c0 fs/dcache.c:1688
  d_alloc+0x4d/0x280 fs/dcache.c:1767
  d_alloc_parallel+0xf4/0x1c30 fs/dcache.c:2519
  __lookup_slow+0x1ab/0x500 fs/namei.c:1646
  lookup_one_len+0x16d/0x1a0 fs/namei.c:2533
  start_creating+0xc5/0x1d0 fs/debugfs/inode.c:339
  __debugfs_create_file+0x65/0x3f0 fs/debugfs/inode.c:384
  debugfs_create_file+0x5a/0x70 fs/debugfs/inode.c:441
  blk_create_buf_file_callback+0x33/0x40 kernel/trace/blktrace.c:444
  relay_create_buf_file+0xf9/0x180 kernel/relay.c:428
  relay_open_buf.part.0+0x76e/0xb60 kernel/relay.c:457
  relay_open_buf kernel/relay.c:449 [inline]
  relay_open kernel/relay.c:599 [inline]
  relay_open+0x523/0x980 kernel/relay.c:563
  do_blk_trace_setup+0x3f0/0xb50 kernel/trace/blktrace.c:526
  __blk_trace_setup+0xe3/0x190 kernel/trace/blktrace.c:571
  blk_trace_ioctl+0x170/0x300 kernel/trace/blktrace.c:710
  blkdev_ioctl+0x126/0x1c20 block/ioctl.c:592
  block_ioctl+0xee/0x130 fs/block_dev.c:1954
  vfs_ioctl fs/ioctl.c:46 [inline]
  file_ioctl fs/ioctl.c:509 [inline]
  do_vfs_ioctl+0xdb6/0x13e0 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+0xfa/0x760 arch/x86/entry/common.c:290
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 11303:
  save_stack+0x23/0x90 mm/kasan/common.c:69
  set_track mm/kasan/common.c:77 [inline]
  kasan_set_free_info mm/kasan/common.c:332 [inline]
  __kasan_slab_free+0x102/0x150 mm/kasan/common.c:471
  kasan_slab_free+0xe/0x10 mm/kasan/common.c:480
  __cache_free mm/slab.c:3425 [inline]
  kmem_cache_free+0x86/0x320 mm/slab.c:3693
  __d_free+0x20/0x30 fs/dcache.c:271
  __rcu_reclaim kernel/rcu/rcu.h:222 [inline]
  rcu_do_batch kernel/rcu/tree.c:2157 [inline]
  rcu_core+0x581/0x1560 kernel/rcu/tree.c:2377
  rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2386
  __do_softirq+0x262/0x98c kernel/softirq.c:292

The buggy address belongs to the object at ffff88808d5054a0
  which belongs to the cache dentry of size 288
The buggy address is located 88 bytes inside of
  288-byte region [ffff88808d5054a0, ffff88808d5055c0)
The buggy address belongs to the page:
page:ffffea0002354140 refcount:1 mapcount:0 mapping:ffff8880aa57b000  
index:0xffff88808d505e40
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea000299b6c8 ffffea0002353f08 ffff8880aa57b000
raw: ffff88808d505e40 ffff88808d505080 0000000100000009 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
  ffff88808d505380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff88808d505400: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
> ffff88808d505480: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
                                                                 ^
  ffff88808d505500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
  ffff88808d505580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


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

* Re: KASAN: use-after-free Read in relay_switch_subbuf
  2018-09-26  7:41 KASAN: use-after-free Read in relay_switch_subbuf syzbot
  2019-11-06  7:58 ` syzbot
@ 2019-11-18  6:59 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2019-11-18  6:59 UTC (permalink / raw)
  To: akpm, bunk, ebiggers, gregkh, jannh, jrdr.linux, keescook,
	linux-kernel, linux, mawilcox, mojha, rientjes, sudipm.mukherjee,
	syzkaller-bugs, viro, yuehaibing

syzbot has bisected this bug to:

commit 21c75ad65f8e5213ec542d99c259ffe3e3671e81
Author: YueHaibing <yuehaibing@huawei.com>
Date:   Thu Mar 21 08:26:28 2019 +0000

     parport_cs: Fix memory leak in parport_config

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=11480c6ae00000
start commit:   26bc6721 Merge tag 'for-linus-2019-11-05' of git://git.ker..
git tree:       upstream
final crash:    https://syzkaller.appspot.com/x/report.txt?x=13480c6ae00000
console output: https://syzkaller.appspot.com/x/log.txt?x=15480c6ae00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8c5e2eca3f31f9bf
dashboard link: https://syzkaller.appspot.com/bug?extid=29093015c21333d1c46d
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=132afbcce00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=179a1f8ae00000

Reported-by: syzbot+29093015c21333d1c46d@syzkaller.appspotmail.com
Fixes: 21c75ad65f8e ("parport_cs: Fix memory leak in parport_config")

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-11-18  6:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26  7:41 KASAN: use-after-free Read in relay_switch_subbuf syzbot
2019-11-06  7:58 ` syzbot
2019-11-18  6:59 ` syzbot

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).