linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KASAN: use-after-free Read in io_wqe_worker
@ 2020-09-26 10:58 syzbot
  2020-09-26 11:00 ` Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: syzbot @ 2020-09-26 10:58 UTC (permalink / raw)
  To: axboe, io-uring, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

Hello,

syzbot found the following issue on:

HEAD commit:    98477740 Merge branch 'rcu/urgent' of git://git.kernel.org..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=153e929b900000
kernel config:  https://syzkaller.appspot.com/x/.config?x=af502ec9a451c9fc
dashboard link: https://syzkaller.appspot.com/bug?extid=9af99580130003da82b1
compiler:       clang version 10.0.0 (https://github.com/llvm/llvm-project/ c2443155a0fb245c8f17f2c1c72b6ea391e86e81)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14138009900000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17d0f809900000

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

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x92/0x2ae0 kernel/locking/lockdep.c:4311
Read of size 8 at addr ffff88821ae5f818 by task io_wqe_worker-0/11054

CPU: 1 PID: 11054 Comm: io_wqe_worker-0 Not tainted 5.9.0-rc6-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+0x1d6/0x29e lib/dump_stack.c:118
 print_address_description+0x66/0x620 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report+0x132/0x1d0 mm/kasan/report.c:530
 __lock_acquire+0x92/0x2ae0 kernel/locking/lockdep.c:4311
 lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline]
 _raw_spin_lock_irq+0xa6/0xc0 kernel/locking/spinlock.c:167
 spin_lock_irq include/linux/spinlock.h:379 [inline]
 io_wqe_worker+0x756/0x810 fs/io-wq.c:589
 kthread+0x37e/0x3a0 drivers/block/aoe/aoecmd.c:1234
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Allocated by task 11048:
 kasan_save_stack mm/kasan/common.c:48 [inline]
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc+0x100/0x130 mm/kasan/common.c:461
 kmem_cache_alloc_node_trace+0x1f7/0x2a0 mm/slab.c:3594
 kmalloc_node include/linux/slab.h:572 [inline]
 kzalloc_node include/linux/slab.h:677 [inline]
 io_wq_create+0x295/0x880 fs/io-wq.c:1064
 io_init_wq_offload fs/io_uring.c:7432 [inline]
 io_sq_offload_start fs/io_uring.c:7504 [inline]
 io_uring_create fs/io_uring.c:8625 [inline]
 io_uring_setup fs/io_uring.c:8694 [inline]
 __do_sys_io_uring_setup fs/io_uring.c:8700 [inline]
 __se_sys_io_uring_setup+0x18ed/0x2a00 fs/io_uring.c:8697
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 128:
 kasan_save_stack mm/kasan/common.c:48 [inline]
 kasan_set_track+0x3d/0x70 mm/kasan/common.c:56
 kasan_set_free_info+0x17/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0xdd/0x110 mm/kasan/common.c:422
 __cache_free mm/slab.c:3418 [inline]
 kfree+0x113/0x200 mm/slab.c:3756
 __io_wq_destroy fs/io-wq.c:1138 [inline]
 io_wq_destroy+0x470/0x510 fs/io-wq.c:1146
 io_finish_async fs/io_uring.c:6836 [inline]
 io_ring_ctx_free fs/io_uring.c:7870 [inline]
 io_ring_exit_work+0x195/0x520 fs/io_uring.c:7954
 process_one_work+0x789/0xfc0 kernel/workqueue.c:2269
 worker_thread+0xaa4/0x1460 kernel/workqueue.c:2415
 kthread+0x37e/0x3a0 drivers/block/aoe/aoecmd.c:1234
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

The buggy address belongs to the object at ffff88821ae5f800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 24 bytes inside of
 1024-byte region [ffff88821ae5f800, ffff88821ae5fc00)
The buggy address belongs to the page:
page:000000008e41b1c2 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21ae5f
flags: 0x57ffe0000000200(slab)
raw: 057ffe0000000200 ffffea00086a10c8 ffffea00085d1848 ffff8880aa440700
raw: 0000000000000000 ffff88821ae5f000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88821ae5f700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88821ae5f780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88821ae5f800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88821ae5f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88821ae5f900: 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] 6+ messages in thread

* Re: KASAN: use-after-free Read in io_wqe_worker
  2020-09-26 10:58 KASAN: use-after-free Read in io_wqe_worker syzbot
@ 2020-09-26 11:00 ` Jens Axboe
  2020-09-26 12:22 ` Jens Axboe
  2020-09-26 12:57 ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2020-09-26 11:00 UTC (permalink / raw)
  To: syzbot, io-uring, linux-fsdevel, linux-kernel, syzkaller-bugs,
	viro, Hillf Danton

On 9/26/20 4:58 AM, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    98477740 Merge branch 'rcu/urgent' of git://git.kernel.org..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=153e929b900000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=af502ec9a451c9fc
> dashboard link: https://syzkaller.appspot.com/bug?extid=9af99580130003da82b1
> compiler:       clang version 10.0.0 (https://github.com/llvm/llvm-project/ c2443155a0fb245c8f17f2c1c72b6ea391e86e81)
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14138009900000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17d0f809900000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+9af99580130003da82b1@syzkaller.appspotmail.com
> 
> ==================================================================
> BUG: KASAN: use-after-free in __lock_acquire+0x92/0x2ae0 kernel/locking/lockdep.c:4311
> Read of size 8 at addr ffff88821ae5f818 by task io_wqe_worker-0/11054
> 
> CPU: 1 PID: 11054 Comm: io_wqe_worker-0 Not tainted 5.9.0-rc6-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+0x1d6/0x29e lib/dump_stack.c:118
>  print_address_description+0x66/0x620 mm/kasan/report.c:383
>  __kasan_report mm/kasan/report.c:513 [inline]
>  kasan_report+0x132/0x1d0 mm/kasan/report.c:530
>  __lock_acquire+0x92/0x2ae0 kernel/locking/lockdep.c:4311
>  lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
>  __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline]
>  _raw_spin_lock_irq+0xa6/0xc0 kernel/locking/spinlock.c:167
>  spin_lock_irq include/linux/spinlock.h:379 [inline]
>  io_wqe_worker+0x756/0x810 fs/io-wq.c:589
>  kthread+0x37e/0x3a0 drivers/block/aoe/aoecmd.c:1234
>  ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
> 
> Allocated by task 11048:
>  kasan_save_stack mm/kasan/common.c:48 [inline]
>  kasan_set_track mm/kasan/common.c:56 [inline]
>  __kasan_kmalloc+0x100/0x130 mm/kasan/common.c:461
>  kmem_cache_alloc_node_trace+0x1f7/0x2a0 mm/slab.c:3594
>  kmalloc_node include/linux/slab.h:572 [inline]
>  kzalloc_node include/linux/slab.h:677 [inline]
>  io_wq_create+0x295/0x880 fs/io-wq.c:1064
>  io_init_wq_offload fs/io_uring.c:7432 [inline]
>  io_sq_offload_start fs/io_uring.c:7504 [inline]
>  io_uring_create fs/io_uring.c:8625 [inline]
>  io_uring_setup fs/io_uring.c:8694 [inline]
>  __do_sys_io_uring_setup fs/io_uring.c:8700 [inline]
>  __se_sys_io_uring_setup+0x18ed/0x2a00 fs/io_uring.c:8697
>  do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
>  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> 
> Freed by task 128:
>  kasan_save_stack mm/kasan/common.c:48 [inline]
>  kasan_set_track+0x3d/0x70 mm/kasan/common.c:56
>  kasan_set_free_info+0x17/0x30 mm/kasan/generic.c:355
>  __kasan_slab_free+0xdd/0x110 mm/kasan/common.c:422
>  __cache_free mm/slab.c:3418 [inline]
>  kfree+0x113/0x200 mm/slab.c:3756
>  __io_wq_destroy fs/io-wq.c:1138 [inline]
>  io_wq_destroy+0x470/0x510 fs/io-wq.c:1146
>  io_finish_async fs/io_uring.c:6836 [inline]
>  io_ring_ctx_free fs/io_uring.c:7870 [inline]
>  io_ring_exit_work+0x195/0x520 fs/io_uring.c:7954
>  process_one_work+0x789/0xfc0 kernel/workqueue.c:2269
>  worker_thread+0xaa4/0x1460 kernel/workqueue.c:2415
>  kthread+0x37e/0x3a0 drivers/block/aoe/aoecmd.c:1234
>  ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
> 
> The buggy address belongs to the object at ffff88821ae5f800
>  which belongs to the cache kmalloc-1k of size 1024
> The buggy address is located 24 bytes inside of
>  1024-byte region [ffff88821ae5f800, ffff88821ae5fc00)
> The buggy address belongs to the page:
> page:000000008e41b1c2 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21ae5f
> flags: 0x57ffe0000000200(slab)
> raw: 057ffe0000000200 ffffea00086a10c8 ffffea00085d1848 ffff8880aa440700
> raw: 0000000000000000 ffff88821ae5f000 0000000100000002 0000000000000000
> page dumped because: kasan: bad access detected
> 
> Memory state around the buggy address:
>  ffff88821ae5f700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>  ffff88821ae5f780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>> ffff88821ae5f800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>                             ^
>  ffff88821ae5f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff88821ae5f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ==================================================================

Hillf, you've been looking at this one, care to spend a bit of time on it
and pull it to completion?

-- 
Jens Axboe


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

* Re: KASAN: use-after-free Read in io_wqe_worker
  2020-09-26 10:58 KASAN: use-after-free Read in io_wqe_worker syzbot
  2020-09-26 11:00 ` Jens Axboe
@ 2020-09-26 12:22 ` Jens Axboe
  2020-09-26 13:57   ` syzbot
  2020-09-26 12:57 ` Jens Axboe
  2 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-09-26 12:22 UTC (permalink / raw)
  To: syzbot, io-uring, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

#syz test: git://git.kernel.dk/linux-block io_uring-5.9

-- 
Jens Axboe


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

* Re: KASAN: use-after-free Read in io_wqe_worker
  2020-09-26 10:58 KASAN: use-after-free Read in io_wqe_worker syzbot
  2020-09-26 11:00 ` Jens Axboe
  2020-09-26 12:22 ` Jens Axboe
@ 2020-09-26 12:57 ` Jens Axboe
  2020-09-26 14:15   ` syzbot
  2 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-09-26 12:57 UTC (permalink / raw)
  To: syzbot, io-uring, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

#syz test: git://git.kernel.dk/linux-block.git 41d5f92f60a61e264dafbada79175dad0bc60c5b

-- 
Jens Axboe


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

* Re: KASAN: use-after-free Read in io_wqe_worker
  2020-09-26 12:22 ` Jens Axboe
@ 2020-09-26 13:57   ` syzbot
  0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2020-09-26 13:57 UTC (permalink / raw)
  To: axboe, io-uring, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+9af99580130003da82b1@syzkaller.appspotmail.com

Tested on:

commit:         41d5f92f io-wq: fix worker refcount race
git tree:       git://git.kernel.dk/linux-block io_uring-5.9
kernel config:  https://syzkaller.appspot.com/x/.config?x=d31db37354c30905
dashboard link: https://syzkaller.appspot.com/bug?extid=9af99580130003da82b1
compiler:       clang version 10.0.0 (https://github.com/llvm/llvm-project/ c2443155a0fb245c8f17f2c1c72b6ea391e86e81)

Note: testing is done by a robot and is best-effort only.

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

* Re: KASAN: use-after-free Read in io_wqe_worker
  2020-09-26 12:57 ` Jens Axboe
@ 2020-09-26 14:15   ` syzbot
  0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2020-09-26 14:15 UTC (permalink / raw)
  To: axboe, io-uring, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+9af99580130003da82b1@syzkaller.appspotmail.com

Tested on:

commit:         41d5f92f io-wq: fix worker refcount race
git tree:       git://git.kernel.dk/linux-block.git
kernel config:  https://syzkaller.appspot.com/x/.config?x=d31db37354c30905
dashboard link: https://syzkaller.appspot.com/bug?extid=9af99580130003da82b1
compiler:       clang version 10.0.0 (https://github.com/llvm/llvm-project/ c2443155a0fb245c8f17f2c1c72b6ea391e86e81)

Note: testing is done by a robot and is best-effort only.

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

end of thread, other threads:[~2020-09-26 14:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-26 10:58 KASAN: use-after-free Read in io_wqe_worker syzbot
2020-09-26 11:00 ` Jens Axboe
2020-09-26 12:22 ` Jens Axboe
2020-09-26 13:57   ` syzbot
2020-09-26 12:57 ` Jens Axboe
2020-09-26 14:15   ` 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).