syzbot


panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:

Status: fixed on 2023/03/22 22:01
Reported-by: syzbot+c58795dc8124b39436a8@syzkaller.appspotmail.com
Fix commit: 758da469f7ed kernel: release kernel.taskSetRWMutex before calling TaskImage.Release
First crash: 903d, last: 621d

Sample crash report:
panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
goroutine 243 [running]:
gvisor.dev/gvisor/pkg/log.Stacks(0xa0)
	pkg/log/log.go:316 +0xd3
gvisor.dev/gvisor/pkg/sync/locking.checkLock(0xc000452d80, 0xc00023f600, {0xc0007460b0, 0x1, 0x1})
	pkg/sync/locking/lockdep.go:56 +0x225
gvisor.dev/gvisor/pkg/sync/locking.checkLock.func1(0xc00023fd20, 0xc0008aa828)
	pkg/sync/locking/lockdep.go:76 +0x7a
gvisor.dev/gvisor/pkg/sync/locking.(*ancestorsAtomicPtrMap).RangeRepeatable(0xc00023fd00, 0xc0008aa940)
	bazel-out/k8-fastbuild-ST-a4501ad48192/bin/pkg/sync/locking/atomicptrmap_ancestors_unsafe.go:441 +0x334
gvisor.dev/gvisor/pkg/sync/locking.checkLock(0xc000452d80, 0xc00023fd00, {0x0, 0x0, 0x0})
	pkg/sync/locking/lockdep.go:73 +0x4aa
gvisor.dev/gvisor/pkg/sync/locking.AddGLock(0xc000452d80, 0x0)
	pkg/sync/locking/lockdep.go:107 +0x33e
gvisor.dev/gvisor/pkg/sentry/kernel.(*taskSetRWMutex).RLock(0xc0003e5560)
	bazel-out/k8-fastbuild-ST-a4501ad48192/bin/pkg/sentry/kernel/taskset_mutex.go:46 +0x53
gvisor.dev/gvisor/pkg/sentry/kernel.(*ThreadGroup).Leader(0xc000915800)
	pkg/sentry/kernel/threads.go:403 +0x8b
gvisor.dev/gvisor/pkg/sentry/kernel/fasync.(*FileAsync).NotifyEvent(0xc0008b0070, 0x41)
	pkg/sentry/kernel/fasync/fasync.go:111 +0x21a
gvisor.dev/gvisor/pkg/waiter.(*Queue).Notify(0xc0003b2930, 0x41)
	pkg/waiter/waiter.go:237 +0xfd
gvisor.dev/gvisor/pkg/sentry/vfs.(*Inotify).queueEvent(0xc0003b28c0, 0x0)
	pkg/sentry/vfs/inotify.go:296 +0xd8
gvisor.dev/gvisor/pkg/sentry/vfs.(*Watch).Notify(0xc000b820a0, {0x0, 0x0}, 0x400, 0x0)
	pkg/sentry/vfs/inotify.go:609 +0x106
gvisor.dev/gvisor/pkg/sentry/vfs.(*Watches).Notify(0xc000799798, {0x1c71890, 0xc000a4ea80}, {0x0, 0x0}, 0xd04f30, 0xc0, 0x1, 0x1)
	pkg/sentry/vfs/inotify.go:481 +0x1c7
gvisor.dev/gvisor/pkg/sentry/vfs.(*Watches).HandleDeletion(0xc000799798, {0x1c71890, 0xc000a4ea80})
	pkg/sentry/vfs/inotify.go:515 +0x92
gvisor.dev/gvisor/pkg/sentry/fsimpl/tmpfs.(*inode).decRef.func1()
	pkg/sentry/fsimpl/tmpfs/tmpfs.go:529 +0x7c
gvisor.dev/gvisor/pkg/sentry/fsimpl/tmpfs.(*inodeRefs).DecRef(0xc000799458, 0xc000d050b0)
	bazel-out/k8-fastbuild-ST-a4501ad48192/bin/pkg/sentry/fsimpl/tmpfs/inode_refs.go:131 +0xb2
gvisor.dev/gvisor/pkg/sentry/fsimpl/tmpfs.(*inode).decRef(0xc000799450, {0x1c71890, 0xc000a4ea80})
	pkg/sentry/fsimpl/tmpfs/tmpfs.go:528 +0x8b
gvisor.dev/gvisor/pkg/sentry/fsimpl/tmpfs.(*inode).decLinksLocked(0xc000799450, {0x1c71890, 0xc000a4ea80})
	pkg/sentry/fsimpl/tmpfs/tmpfs.go:515 +0xa9
gvisor.dev/gvisor/pkg/sentry/fsimpl/tmpfs.(*filesystem).RmdirAt(0xc0003323c0, {0x1c71890, 0xc000a4ea80}, 0xc000981b00)
	pkg/sentry/fsimpl/tmpfs/filesystem.go:699 +0x7e6
gvisor.dev/gvisor/pkg/sentry/vfs.(*VirtualFilesystem).RmdirAt(0xc000a4ea80, {0x1c71890, 0xc000a4ea80}, 0xc0005ca400, 0xc000d05538)
	pkg/sentry/vfs/vfs.go:562 +0x2c6
gvisor.dev/gvisor/pkg/sentry/syscalls/linux/vfs2.rmdirat(0xc000a4ea80, 0x21c3, 0x46fc2c)
	pkg/sentry/syscalls/linux/vfs2/filesystem.go:263 +0x2a5
gvisor.dev/gvisor/pkg/sentry/syscalls/linux/vfs2.Rmdir(0xc000a4ea80, {{0x20000080}, {0x0}, {0x0}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/syscalls/linux/vfs2/filesystem.go:250 +0x67
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall(0xc000a4ea80, 0x54, {{0x20000080}, {0x0}, {0x0}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/kernel/task_syscall.go:142 +0xaf7
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke(0xc000a4ea80, 0x1, {{0x20000080}, {0x0}, {0x0}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/kernel/task_syscall.go:322 +0x8e
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter(0xc0004d2780, 0x1, {{0x20000080}, {0x0}, {0x0}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/kernel/task_syscall.go:282 +0xc5
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscall(0xc000a4ea80)
	pkg/sentry/kernel/task_syscall.go:257 +0x4c7
gvisor.dev/gvisor/pkg/sentry/kernel.(*runApp).execute(0xc000a4ea80, 0xc000a4ea80)
	pkg/sentry/kernel/task_run.go:253 +0x19fc
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run(0xc000a4ea80, 0x18)
	pkg/sentry/kernel/task_run.go:94 +0x2d4
created by gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start
	pkg/sentry/kernel/task_start.go:369 +0x1d1

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/06/11 12:09 gvisor 6294e603c685 0d5abf15 .config console log report syz ci-gvisor-ptrace-3-race-cover panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/10 03:25 gvisor 38b6e9ec938b 0d5abf15 .config console log report syz ci-gvisor-ptrace-1-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/10 03:23 gvisor 38b6e9ec938b 0d5abf15 .config console log report syz ci-gvisor-ptrace-3-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/10 02:54 gvisor 38b6e9ec938b 0d5abf15 .config console log report syz ci-gvisor-ptrace-2-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2023/03/16 09:27 gvisor fedadb093205 18b58603 .config console log report info ci-gvisor-ptrace-3-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/14 22:32 gvisor ebadfe7702fe 127d1faf .config console log report info ci-gvisor-ptrace-2-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/14 07:55 gvisor 82498d087ef8 0f087040 .config console log report info ci-gvisor-ptrace-2-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/10 23:13 gvisor 16a5ced34f90 0d5abf15 .config console log report info ci-gvisor-ptrace-2-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/10 09:59 gvisor 1dad561c8b60 0d5abf15 .config console log report info ci-gvisor-ptrace-2-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/10 02:51 gvisor 38b6e9ec938b 0d5abf15 .config console log report info ci-gvisor-ptrace-3-race-cover panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/10 02:41 gvisor 38b6e9ec938b 0d5abf15 .config console log report info ci-gvisor-ptrace-2-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/09 08:58 gvisor c3a7b477f9f0 0d5abf15 .config console log report info ci-gvisor-ptrace-3-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/07 12:57 gvisor a30c81cd8022 b2706118 .config console log report info ci-gvisor-ptrace-2-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
2022/06/07 00:21 gvisor f13e23932ba1 c8857892 .config console log report info ci-gvisor-ptrace-3-race panic: WARNING: circular locking detected: tmpfs.filesystemRWMutex -> kernel.taskSetRWMutex:
* Struck through repros no longer work on HEAD.