2022-08-26 10:58:30

by syzbot

[permalink] [raw]
Subject: [syzbot] BUG: Dentry still in use in unmount

Hello,

syzbot found the following issue on:

HEAD commit: a41a877bc12d Merge branch 'for-next/fixes' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=13901aad080000
kernel config: https://syzkaller.appspot.com/x/.config?x=5cea15779c42821c
dashboard link: https://syzkaller.appspot.com/bug?extid=8608bb4553edb8c78f41
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10d75e95080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15440857080000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

BUG: Dentry 00000000133f9b6b{i=0,n=.reiserfs_priv} still in use (1) [unmount of squashfs loop0]
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3045 at fs/dcache.c:1676 umount_check+0xc0/0xc8 fs/dcache.c:1667
Modules linked in:
CPU: 1 PID: 3045 Comm: syz-executor425 Not tainted 6.0.0-rc2-syzkaller-16455-ga41a877bc12d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : umount_check+0xc0/0xc8 fs/dcache.c:1667
lr : umount_check+0xc0/0xc8 fs/dcache.c:1667
sp : ffff800012ac3bc0
x29: ffff800012ac3bc0 x28: ffff0000c7bb05f8 x27: ffff80000d4e1e20
x26: ffff0000c7bb04e0 x25: 0000000000000001 x24: ffff0000c7bb05f8
x23: ffff0000c7bb0090 x22: ffff0000c7b9d138 x21: ffff8000085edd40
x20: 0000000000000000 x19: ffff0000c7bb0000 x18: 00000000000000c0
x17: 657375206e69206c x16: ffff80000dbb8658 x15: ffff0000c378cf80
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c378cf80
x11: ff808000081c39dc x10: 0000000000000000 x9 : 3f5cf90385ca4900
x8 : 3f5cf90385ca4900 x7 : ffff800008197c8c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0001fefddcd0 x1 : 0000000100000002 x0 : 0000000000000060
Call trace:
umount_check+0xc0/0xc8 fs/dcache.c:1667
d_walk+0x13c/0x55c fs/dcache.c:1386
do_one_tree fs/dcache.c:1683 [inline]
shrink_dcache_for_umount+0x60/0x140 fs/dcache.c:1699
generic_shutdown_super+0x30/0x190 fs/super.c:473
kill_block_super+0x30/0x78 fs/super.c:1427
deactivate_locked_super+0x70/0xd4 fs/super.c:332
deactivate_super+0xb8/0xbc fs/super.c:363
cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0xc4/0x208 kernel/task_work.c:177
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x174/0x1d0 arch/arm64/kernel/signal.c:1127
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:625
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:642
el0t_64_sync+0x18c/0x190
irq event stamp: 168478
hardirqs last enabled at (168477): [<ffff8000081c1c48>] __up_console_sem+0xb0/0xfc kernel/printk/printk.c:264
hardirqs last disabled at (168478): [<ffff80000bffe9cc>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:395
softirqs last enabled at (168132): [<ffff80000801c1f4>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (168130): [<ffff80000801c1c0>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---
BUG: Dentry 00000000133f9b6b{i=0,n=.reiserfs_priv} still in use (1) [unmount of squashfs loop0]
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3045 at fs/dcache.c:1676 umount_check+0xc0/0xc8 fs/dcache.c:1667
Modules linked in:
CPU: 1 PID: 3045 Comm: syz-executor425 Tainted: G W 6.0.0-rc2-syzkaller-16455-ga41a877bc12d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : umount_check+0xc0/0xc8 fs/dcache.c:1667
lr : umount_check+0xc0/0xc8 fs/dcache.c:1667
sp : ffff800012ac3bc0
x29: ffff800012ac3bc0 x28: ffff0000c7bb05f8 x27: ffff80000d4e1e20
x26: ffff0000c7bb04e0 x25: 0000000000000001 x24: ffff0000c7bb05f8
x23: ffff0000c7bb0090 x22: ffff0000c7b9d138 x21: ffff8000085edd40
x20: 0000000000000000 x19: ffff0000c7bb0000 x18: 00000000000000c0
x17: 657375206e69206c x16: ffff80000dbb8658 x15: ffff0000c378cf80
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c378cf80
x11: ff808000081c39dc x10: 0000000000000000 x9 : 3f5cf90385ca4900
x8 : 3f5cf90385ca4900 x7 : ffff800008197c8c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0001fefddcd0 x1 : 0000000100000003 x0 : 0000000000000060
Call trace:
umount_check+0xc0/0xc8 fs/dcache.c:1667
d_walk+0x13c/0x55c fs/dcache.c:1386
do_one_tree fs/dcache.c:1683 [inline]
shrink_dcache_for_umount+0x60/0x140 fs/dcache.c:1699
generic_shutdown_super+0x30/0x190 fs/super.c:473
kill_block_super+0x30/0x78 fs/super.c:1427
deactivate_locked_super+0x70/0xd4 fs/super.c:332
deactivate_super+0xb8/0xbc fs/super.c:363
cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0xc4/0x208 kernel/task_work.c:177
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x174/0x1d0 arch/arm64/kernel/signal.c:1127
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:625
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:642
el0t_64_sync+0x18c/0x190
irq event stamp: 168928
hardirqs last enabled at (168927): [<ffff8000081c1c48>] __up_console_sem+0xb0/0xfc kernel/printk/printk.c:264
hardirqs last disabled at (168928): [<ffff80000bffe9cc>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:395
softirqs last enabled at (168922): [<ffff8000080102e4>] _stext+0x2e4/0x37c
softirqs last disabled at (168635): [<ffff800008104658>] do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
softirqs last disabled at (168635): [<ffff800008104658>] invoke_softirq+0x70/0xbc kernel/softirq.c:452
---[ end trace 0000000000000000 ]---
VFS: Busy inodes after unmount of loop0. Self-destruct in 5 seconds. Have a nice day...
BUG: Dentry 000000005431b8af{i=0,n=.reiserfs_priv} still in use (1) [unmount of squashfs loop0]
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3045 at fs/dcache.c:1676 umount_check+0xc0/0xc8 fs/dcache.c:1667
Modules linked in:
CPU: 0 PID: 3045 Comm: syz-executor425 Tainted: G W 6.0.0-rc2-syzkaller-16455-ga41a877bc12d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : umount_check+0xc0/0xc8 fs/dcache.c:1667
lr : umount_check+0xc0/0xc8 fs/dcache.c:1667
sp : ffff800012ac3bc0
x29: ffff800012ac3bc0 x28: ffff0000c7b98250 x27: ffff80000d4e1e20
x26: ffff0000c7b98138 x25: 0000000000000001 x24: ffff0000c7b98250
x23: ffff0000cc849570 x22: ffff0000cc99d750 x21: ffff8000085edd40
x20: 0000000000000000 x19: ffff0000cc8494e0 x18: 0000000000000350
x17: 657375206e69206c x16: ffff80000dbb8658 x15: ffff0000c378cf80
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c378cf80
x11: ff808000081c39dc x10: 0000000000000000 x9 : 3f5cf90385ca4900
x8 : 3f5cf90385ca4900 x7 : ffff800008197c8c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0001fefbecd0 x1 : 0000000100000002 x0 : 0000000000000060
Call trace:
umount_check+0xc0/0xc8 fs/dcache.c:1667
d_walk+0x13c/0x55c fs/dcache.c:1386
do_one_tree fs/dcache.c:1683 [inline]
shrink_dcache_for_umount+0x60/0x140 fs/dcache.c:1699
generic_shutdown_super+0x30/0x190 fs/super.c:473
kill_block_super+0x30/0x78 fs/super.c:1427
deactivate_locked_super+0x70/0xd4 fs/super.c:332
deactivate_super+0xb8/0xbc fs/super.c:363
cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0xc4/0x208 kernel/task_work.c:177
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x174/0x1d0 arch/arm64/kernel/signal.c:1127
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:625
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:642
el0t_64_sync+0x18c/0x190
irq event stamp: 257288
hardirqs last enabled at (257287): [<ffff8000081c1c48>] __up_console_sem+0xb0/0xfc kernel/printk/printk.c:264
hardirqs last disabled at (257288): [<ffff80000bffe9cc>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:395
softirqs last enabled at (256910): [<ffff80000801c1f4>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (256908): [<ffff80000801c1c0>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---
VFS: Busy inodes after unmount of loop0. Self-destruct in 5 seconds. Have a nice day...
BUG: Dentry 000000005431b8af{i=0,n=.reiserfs_priv} still in use (1) [unmount of squashfs loop0]
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3045 at fs/dcache.c:1676 umount_check+0xc0/0xc8 fs/dcache.c:1667
Modules linked in:
CPU: 1 PID: 3045 Comm: syz-executor425 Tainted: G W 6.0.0-rc2-syzkaller-16455-ga41a877bc12d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : umount_check+0xc0/0xc8 fs/dcache.c:1667
lr : umount_check+0xc0/0xc8 fs/dcache.c:1667
sp : ffff800012ac3bc0
x29: ffff800012ac3bc0 x28: ffff0000c7b98250 x27: ffff80000d4e1e20
x26: ffff0000c7b98138 x25: 0000000000000001 x24: ffff0000c7b98250
x23: ffff0000cc849570 x22: ffff0000cc88d138 x21: ffff8000085edd40
x20: 0000000000000000 x19: ffff0000cc8494e0 x18: 00000000000002ea
x17: 657375206e69206c x16: ffff80000dbb8658 x15: ffff0000c378cf80
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c378cf80
x11: ff808000081c39dc x10: 0000000000000000 x9 : 3f5cf90385ca4900
x8 : 3f5cf90385ca4900 x7 : ffff800008197c8c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0001fefddcd0 x1 : 0000000100000002 x0 : 0000000000000060
Call trace:
umount_check+0xc0/0xc8 fs/dcache.c:1667
d_walk+0x13c/0x55c fs/dcache.c:1386
do_one_tree fs/dcache.c:1683 [inline]
shrink_dcache_for_umount+0x60/0x140 fs/dcache.c:1699
generic_shutdown_super+0x30/0x190 fs/super.c:473
kill_block_super+0x30/0x78 fs/super.c:1427
deactivate_locked_super+0x70/0xd4 fs/super.c:332
deactivate_super+0xb8/0xbc fs/super.c:363
cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0xc4/0x208 kernel/task_work.c:177
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x174/0x1d0 arch/arm64/kernel/signal.c:1127
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:625
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:642
el0t_64_sync+0x18c/0x190
irq event stamp: 283828
hardirqs last enabled at (283827): [<ffff8000081c1c48>] __up_console_sem+0xb0/0xfc kernel/printk/printk.c:264
hardirqs last disabled at (283828): [<ffff80000bffe9cc>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:395
softirqs last enabled at (283438): [<ffff80000801c1f4>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (283436): [<ffff80000801c1c0>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---
VFS: Busy inodes after unmount of loop0. Self-destruct in 5 seconds. Have a nice day...
BUG: Dentry 000000005431b8af{i=0,n=.reiserfs_priv} still in use (1) [unmount of squashfs loop0]
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3045 at fs/dcache.c:1676 umount_check+0xc0/0xc8 fs/dcache.c:1667
Modules linked in:
CPU: 1 PID: 3045 Comm: syz-executor425 Tainted: G W 6.0.0-rc2-syzkaller-16455-ga41a877bc12d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : umount_check+0xc0/0xc8 fs/dcache.c:1667
lr : umount_check+0xc0/0xc8 fs/dcache.c:1667
sp : ffff800012ac3bc0
x29: ffff800012ac3bc0 x28: ffff0000c7b98250 x27: ffff80000d4e1e20
x26: ffff0000c7b98138 x25: 0000000000000001 x24: ffff0000c7b98250
x23: ffff0000cc849570 x22: ffff0000cc88dc30 x21: ffff8000085edd40
x20: 0000000000000000 x19: ffff0000cc8494e0 x18: 0000000000000109
x17: 657375206e69206c x16: ffff80000dbb8658 x15: ffff0000c378cf80
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c378cf80
x11: ff808000081c39dc x10: 0000000000000000 x9 : 3f5cf90385ca4900
x8 : 3f5cf90385ca4900 x7 : ffff800008197c8c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0001fefddcd0 x1 : 0000000000000002 x0 : 0000000000000060
Call trace:
umount_check+0xc0/0xc8 fs/dcache.c:1667
d_walk+0x13c/0x55c fs/dcache.c:1386
do_one_tree fs/dcache.c:1683 [inline]
shrink_dcache_for_umount+0x60/0x140 fs/dcache.c:1699
generic_shutdown_super+0x30/0x190 fs/super.c:473
kill_block_super+0x30/0x78 fs/super.c:1427
deactivate_locked_super+0x70/0xd4 fs/super.c:332
deactivate_super+0xb8/0xbc fs/super.c:363
cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0xc4/0x208 kernel/task_work.c:177
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x174/0x1d0 arch/arm64/kernel/signal.c:1127
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:625
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:642
el0t_64_sync+0x18c/0x190
irq event stamp: 335826
hardirqs last enabled at (335825): [<ffff8000081c1c48>] __up_console_sem+0xb0/0xfc kernel/printk/printk.c:264
hardirqs last disabled at (335826): [<ffff80000bffe9cc>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:395
softirqs last enabled at (335820): [<ffff8000080102e4>] _stext+0x2e4/0x37c
softirqs last disabled at (335803): [<ffff800008104658>] do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
softirqs last disabled at (335803): [<ffff800008104658>] invoke_softirq+0x70/0xbc kernel/softirq.c:452
---[ end trace 0000000000000000 ]---
VFS: Busy inodes after unmount of loop0. Self-destruct in 5 seconds. Have a nice day...
loop0: unable to read partition table
loop0: partition table beyond EOD, truncated
BUG: Dentry 00000000cd442007{i=0,n=.reiserfs_priv} still in use (1) [unmount of squashfs loop0]
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3045 at fs/dcache.c:1676 umount_check+0xc0/0xc8 fs/dcache.c:1667
Modules linked in:
CPU: 1 PID: 3045 Comm: syz-executor425 Tainted: G W 6.0.0-rc2-syzkaller-16455-ga41a877bc12d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : umount_check+0xc0/0xc8 fs/dcache.c:1667
lr : umount_check+0xc0/0xc8 fs/dcache.c:1667
sp : ffff800012ac3bc0
x29: ffff800012ac3bc0 x28: ffff0000cc88d5f8 x27: ffff80000d4e1e20
x26: ffff0000cc88d4e0 x25: 0000000000000001 x24: ffff0000cc88d5f8
x23: ffff0000cc88d438 x22: ffff0000ca0579c0 x21: ffff8000085edd40
x20: 0000000000000000 x19: ffff0000cc88d3a8 x18: 000000000000009d
x17: 657375206e69206c x16: ffff80000dbb8658 x15: ffff0000c378cf80
x14: 0000000000000000 x13: 00000000ffffffff x12: ffff0000c378cf80
x11: ff808000081c39dc x10: 0000000000000000 x9 : 3f5cf90385ca4900
x8 : 3f5cf90385ca4900 x7 : ffff800008197c8c x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0001fefddcd0 x1 : 0000000100000002 x0 : 0000000000000060
Call trace:
umount_check+0xc0/0xc8 fs/dcache.c:1667
d_walk+0x13c/0x55c fs/dcache.c:1386
do_one_tree fs/dcache.c:1683 [inline]
shrink_dcache_for_umount+0x60/0x140 fs/dcache.c:1699
generic_shutdown_super+0x30/0x190 fs/super.c:473
kill_block_super+0x30/0x78 fs/super.c:1427
deactivate_locked_super+0x70/0xd4 fs/super.c:332
deactivate_super+0xb8/0xbc fs/super.c:363
cleanup_mnt+0x1f8/0x234 fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0xc4/0x208 kernel/task_work.c:177
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x174/0x1d0 arch/arm64/kernel/signal.c:1127
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x150 arch/arm64/kernel/entry-common.c:625
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:642
el0t_64_sync+0x18c/0x190
irq event stamp: 366714
hardirqs last enabled at (366713): [<ffff8000081c1c48>] __up_console_sem+0xb0/0xfc kernel/printk/printk.c:264
hardirqs last disabled at (366714): [<ffff80000bffe9cc>] el1_dbg+0x24/0x5c arch/arm64/kernel/entry-common.c:395
softirqs last enabled at (366346): [<ffff80000801c1f4>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (366344): [<ffff80000801c1c0>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---
VFS: Busy inodes after unmount of loop0. Self-destruct in 5 seconds. Have a nice day...
loop0: unable to read partition table
loop0: partition table beyond EOD, truncated


---
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 [email protected].

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


2023-12-16 23:19:19

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [reiserfs?] [squashfs?] BUG: Dentry still in use in unmount

syzbot has bisected this issue to:

commit c63e56a4a6523fcb1358e1878607d77a40b534bb
Author: Amir Goldstein <[email protected]>
Date: Wed Aug 16 09:42:18 2023 +0000

ovl: do not open/llseek lower file with upper sb_writers held

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13723c01e80000
start commit: 3bd7d7488169 Merge tag 'io_uring-6.7-2023-12-15' of git://..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=10f23c01e80000
console output: https://syzkaller.appspot.com/x/log.txt?x=17723c01e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=53ec3da1d259132f
dashboard link: https://syzkaller.appspot.com/bug?extid=8608bb4553edb8c78f41
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17b8b6e1e80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ec773ae80000

Reported-by: [email protected]
Fixes: c63e56a4a652 ("ovl: do not open/llseek lower file with upper sb_writers held")

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

2023-12-17 03:44:55

by Edward Adam Davis

[permalink] [raw]
Subject: Re: [reiserfs?] [squashfs?] BUG: Dentry still in use in unmount

please test BUG: Dentry still in use in unmount

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3bd7d7488169
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 4382881b0709..c366b0c6fad2 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -808,6 +808,7 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
return err;

cleanup:
+ ovl_end_write(c->dentry);
ovl_cleanup(ofs, wdir, temp);
dput(temp);
goto unlock;


2023-12-17 04:04:17

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [reiserfs?] [squashfs?] BUG: Dentry still in use in unmount

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: Dentry still in use in unmount

------------[ cut here ]------------
BUG: Dentry ffff88807d684a48{i=1a,n=#3} still in use (1) [unmount of f2fs loop0]
WARNING: CPU: 0 PID: 5411 at fs/dcache.c:1675 umount_check+0x189/0x1e0 fs/dcache.c:1667
Modules linked in:
CPU: 0 PID: 5411 Comm: syz-executor.0 Not tainted 6.7.0-rc5-syzkaller-00200-g3bd7d7488169-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
RIP: 0010:umount_check+0x189/0x1e0 fs/dcache.c:1667
Code: e8 ff 4c 8b 0b 48 81 c5 60 06 00 00 48 c7 c7 c0 c7 77 8b 4c 89 fe 4c 89 f2 4c 89 f9 45 89 e8 55 e8 8c c8 52 ff 48 83 c4 08 90 <0f> 0b 90 90 31 c0 5b 41 5c 41 5d 41 5e 41 5f 5d c3 89 f9 80 e1 07
RSP: 0018:ffffc90005247af8 EFLAGS: 00010282
RAX: 6b1a0fb562407300 RBX: ffffffff8dec05e0 RCX: ffff88807882bb80
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffff88807eda4660 R08: ffffffff81545d52 R09: 1ffff92000a48eb0
R10: dffffc0000000000 R11: fffff52000a48eb1 R12: dffffc0000000000
R13: 0000000000000001 R14: 000000000000001a R15: ffff88807d684a48
FS: 0000555556544480(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f3d029a6440 CR3: 000000002acc0000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
d_walk+0x1f6/0x6e0 fs/dcache.c:1386
do_one_tree+0x35/0xe0 fs/dcache.c:1682
shrink_dcache_for_umount+0x7d/0x130 fs/dcache.c:1698
generic_shutdown_super+0x6a/0x2c0 fs/super.c:668
kill_block_super+0x44/0x90 fs/super.c:1667
kill_f2fs_super+0x303/0x3b0 fs/f2fs/super.c:4933
deactivate_locked_super+0xc1/0x130 fs/super.c:484
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1256
task_work_run+0x24a/0x300 kernel/task_work.c:180
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x150 kernel/entry/common.c:204
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x69/0x2a0 kernel/entry/common.c:296
do_syscall_64+0x52/0x110 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f5ed4c7ded7
Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffdf73a1ae8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f5ed4c7ded7
RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffdf73a1ba0
RBP: 00007ffdf73a1ba0 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffdf73a2c60
R13: 00007f5ed4cc73b9 R14: 0000000000015340 R15: 000000000000000d
</TASK>


Tested on:

commit: 3bd7d748 Merge tag 'io_uring-6.7-2023-12-15' of git://..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=169fe8f1e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=53ec3da1d259132f
dashboard link: https://syzkaller.appspot.com/bug?extid=8608bb4553edb8c78f41
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=171fe8f1e80000


2023-12-17 06:52:38

by Edward Adam Davis

[permalink] [raw]
Subject: Re: [reiserfs?] [squashfs?] BUG: Dentry still in use in unmount

please test BUG: Dentry still in use in unmount

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3bd7d7488169

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 4382881b0709..0348ff4374fa 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -731,10 +731,13 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
.rdev = c->stat.rdev,
.link = c->link
};
+ err = -EIO;
+ if (lock_rename(c->workdir, c->destdir) != NULL)
+ goto unlock;

err = ovl_prep_cu_creds(c->dentry, &cc);
if (err)
- return err;
+ goto unlock;

ovl_start_write(c->dentry);
inode_lock(wdir);
@@ -743,8 +746,9 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
ovl_end_write(c->dentry);
ovl_revert_cu_creds(&cc);

+ err = PTR_ERR(temp);
if (IS_ERR(temp))
- return PTR_ERR(temp);
+ goto unlock;

/*
* Copy up data first and then xattrs. Writing data after
@@ -760,10 +764,9 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
* If temp was moved, abort without the cleanup.
*/
ovl_start_write(c->dentry);
- if (lock_rename(c->workdir, c->destdir) != NULL ||
- temp->d_parent != c->workdir) {
+ if (temp->d_parent != c->workdir) {
err = -EIO;
- goto unlock;
+ goto unlockcd;
} else if (err) {
goto cleanup;
}
@@ -801,16 +804,18 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
ovl_inode_update(inode, temp);
if (S_ISDIR(inode->i_mode))
ovl_set_flag(OVL_WHITEOUTS, inode);
+
+unlockcd:
+ ovl_end_write(c->dentry);
unlock:
unlock_rename(c->workdir, c->destdir);
- ovl_end_write(c->dentry);

return err;

cleanup:
ovl_cleanup(ofs, wdir, temp);
dput(temp);
- goto unlock;
+ goto unlockcd;
}

/* Copyup using O_TMPFILE which does not require cross dir locking */


2023-12-17 08:30:21

by Edward Adam Davis

[permalink] [raw]
Subject: [PATCH] ovl: fix BUG: Dentry still in use in unmount

workdir and destdir could be the same when copying up to indexdir.

Fixes: c63e56a4a652 ("ovl: do not open/llseek lower file with upper sb_writers held")
Reported-and-tested-by: [email protected]
Signed-off-by: Edward Adam Davis <[email protected]>
---
fs/overlayfs/copy_up.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 4382881b0709..ae5eb442025d 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -731,10 +731,14 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
.rdev = c->stat.rdev,
.link = c->link
};
+ err = -EIO;
+ /* workdir and destdir could be the same when copying up to indexdir */
+ if (lock_rename(c->workdir, c->destdir) != NULL)
+ goto unlock;

err = ovl_prep_cu_creds(c->dentry, &cc);
if (err)
- return err;
+ goto unlock;

ovl_start_write(c->dentry);
inode_lock(wdir);
@@ -743,8 +747,9 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
ovl_end_write(c->dentry);
ovl_revert_cu_creds(&cc);

+ err = PTR_ERR(temp);
if (IS_ERR(temp))
- return PTR_ERR(temp);
+ goto unlock;

/*
* Copy up data first and then xattrs. Writing data after
@@ -760,10 +765,9 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
* If temp was moved, abort without the cleanup.
*/
ovl_start_write(c->dentry);
- if (lock_rename(c->workdir, c->destdir) != NULL ||
- temp->d_parent != c->workdir) {
+ if (temp->d_parent != c->workdir) {
err = -EIO;
- goto unlock;
+ goto unlockcd;
} else if (err) {
goto cleanup;
}
@@ -801,16 +805,18 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
ovl_inode_update(inode, temp);
if (S_ISDIR(inode->i_mode))
ovl_set_flag(OVL_WHITEOUTS, inode);
+
+unlockcd:
+ ovl_end_write(c->dentry);
unlock:
unlock_rename(c->workdir, c->destdir);
- ovl_end_write(c->dentry);

return err;

cleanup:
ovl_cleanup(ofs, wdir, temp);
dput(temp);
- goto unlock;
+ goto unlockcd;
}

/* Copyup using O_TMPFILE which does not require cross dir locking */
--
2.43.0


2023-12-17 09:16:33

by Amir Goldstein

[permalink] [raw]
Subject: Re: [syzbot] [reiserfs?] [squashfs?] BUG: Dentry still in use in unmount

On Sun, Dec 17, 2023 at 1:19 AM syzbot
<[email protected]> wrote:
>
> syzbot has bisected this issue to:
>
> commit c63e56a4a6523fcb1358e1878607d77a40b534bb
> Author: Amir Goldstein <[email protected]>
> Date: Wed Aug 16 09:42:18 2023 +0000
>
> ovl: do not open/llseek lower file with upper sb_writers held
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13723c01e80000
> start commit: 3bd7d7488169 Merge tag 'io_uring-6.7-2023-12-15' of git://..
> git tree: upstream
> final oops: https://syzkaller.appspot.com/x/report.txt?x=10f23c01e80000
> console output: https://syzkaller.appspot.com/x/log.txt?x=17723c01e80000
> kernel config: https://syzkaller.appspot.com/x/.config?x=53ec3da1d259132f
> dashboard link: https://syzkaller.appspot.com/bug?extid=8608bb4553edb8c78f41
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17b8b6e1e80000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ec773ae80000
>
> Reported-by: [email protected]
> Fixes: c63e56a4a652 ("ovl: do not open/llseek lower file with upper sb_writers held")
>

#syz test: https://github.com/amir73il/linux ovl-fixes

2023-12-17 09:32:44

by Amir Goldstein

[permalink] [raw]
Subject: Re: [PATCH] ovl: fix BUG: Dentry still in use in unmount

Hi Edward,

Thanks for the quick fix, but it is incorrect.

On Sun, Dec 17, 2023 at 10:11 AM Edward Adam Davis <[email protected]> wrote:
>
> workdir and destdir could be the same when copying up to indexdir.

This is not the reason for the bug, the reason is:

syzbot exercised the forbidden practice of moving the workdir under
lowerdir while overlayfs is mounted and tripped a dentry reference leak.

>
> Fixes: c63e56a4a652 ("ovl: do not open/llseek lower file with upper sb_writers held")
> Reported-and-tested-by: [email protected]
> Signed-off-by: Edward Adam Davis <[email protected]>
> ---
> fs/overlayfs/copy_up.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index 4382881b0709..ae5eb442025d 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -731,10 +731,14 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
> .rdev = c->stat.rdev,
> .link = c->link
> };
> + err = -EIO;
> + /* workdir and destdir could be the same when copying up to indexdir */
> + if (lock_rename(c->workdir, c->destdir) != NULL)
> + goto unlock;

You can't do that. See comment below ovl_copy_up_data().

>
> err = ovl_prep_cu_creds(c->dentry, &cc);
> if (err)
> - return err;
> + goto unlock;
>
> ovl_start_write(c->dentry);
> inode_lock(wdir);
> @@ -743,8 +747,9 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
> ovl_end_write(c->dentry);
> ovl_revert_cu_creds(&cc);
>
> + err = PTR_ERR(temp);
> if (IS_ERR(temp))
> - return PTR_ERR(temp);
> + goto unlock;
>
> /*
> * Copy up data first and then xattrs. Writing data after
> @@ -760,10 +765,9 @@ static int ovl_copy_up_workdir(struct ovl_copy_up_ctx *c)
> * If temp was moved, abort without the cleanup.
> */
> ovl_start_write(c->dentry);
> - if (lock_rename(c->workdir, c->destdir) != NULL ||
> - temp->d_parent != c->workdir) {
> + if (temp->d_parent != c->workdir) {

dput(temp);

here is all that should be needed to fix the leak.


> err = -EIO;
> - goto unlock;
> + goto unlockcd;
> } else if (err) {
> goto cleanup;
> }

See my suggested fix at https://github.com/amir73il/linux/commits/ovl-fixes

Al,

Heads up.
This fix will have a minor conflict with a8b0026847b8 ("rename(): avoid
a deadlock in the case of parents having no common ancestor")
on your work.rename branch.

I plan to push my fix to linux-next soon, but I see that work.rename
is not in linux-next yet.

Thanks,
Amir.

2023-12-17 09:36:15

by syzbot

[permalink] [raw]
Subject: Re: [syzbot] [reiserfs?] [squashfs?] BUG: Dentry still in use in unmount

Hello,

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

Reported-and-tested-by: [email protected]

Tested on:

commit: 79f938ea ovl: fix dentry reference leak after changes ..
git tree: https://github.com/amir73il/linux ovl-fixes
console output: https://syzkaller.appspot.com/x/log.txt?x=171ae01ae80000
kernel config: https://syzkaller.appspot.com/x/.config?x=52c9552def2a0fdd
dashboard link: https://syzkaller.appspot.com/bug?extid=8608bb4553edb8c78f41
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.