syzbot


panic: WARNING: circular locking detected: transport.endpointMutex -> kernfs.filesystemRWMutex:

Status: fixed on 2023/05/15 23:52
Fix commit: a7e1fe92f588 Don't hold baseEndpoint.mu when calling receiver.Recv.
First crash: 568d, last: 568d

Sample crash report:
panic: WARNING: circular locking detected: transport.endpointMutex -> kernfs.filesystemRWMutex:
goroutine 2587 [running]:
gvisor.dev/gvisor/pkg/sync/locking.(*ancestorsAtomicPtrMap).RangeRepeatable(0xc00029cad0, 0xc000885680)
	bazel-out/k8-fastbuild-ST-3dcbe13c9b87/bin/pkg/sync/locking/atomicptrmap_ancestors_unsafe.go:440 +0x31d
gvisor.dev/gvisor/pkg/sync/locking.checkLock(0xc00029c7e0, 0xc00029cab0, {0xc0007a8068, 0x1, 0x1})
	pkg/sync/locking/lockdep.go:112 +0x4e6
gvisor.dev/gvisor/pkg/sync/locking.checkLock.func1(0xc00029c160?, 0xc0008857b0?)
	pkg/sync/locking/lockdep.go:115 +0x7a
gvisor.dev/gvisor/pkg/sync/locking.(*ancestorsAtomicPtrMap).RangeRepeatable(0xc00029c140, 0xc0008858c0)
	bazel-out/k8-fastbuild-ST-3dcbe13c9b87/bin/pkg/sync/locking/atomicptrmap_ancestors_unsafe.go:440 +0x31d
gvisor.dev/gvisor/pkg/sync/locking.checkLock(0xc00029c7e0, 0xc00029c120, {0x0, 0x0, 0x0})
	pkg/sync/locking/lockdep.go:112 +0x4e6
gvisor.dev/gvisor/pkg/sync/locking.AddGLock(0xc00029c7e0, 0xffffffffffffffff)
	pkg/sync/locking/lockdep.go:144 +0x385
gvisor.dev/gvisor/pkg/sentry/fsimpl/kernfs.(*filesystemRWMutex).RLock(0xc000556230)
	bazel-out/k8-fastbuild-ST-3dcbe13c9b87/bin/pkg/sentry/fsimpl/kernfs/filesystem_mutex.go:59 +0x58
gvisor.dev/gvisor/pkg/sentry/fsimpl/kernfs.(*Dentry).InotifyWithParent(0xc0007803f0, {0x75ab98, 0xc0009e3500}, 0x8, 0x0?, 0xd4?)
	pkg/sentry/fsimpl/kernfs/kernfs.go:517 +0xec
gvisor.dev/gvisor/pkg/sentry/vfs.(*Dentry).InotifyWithParent(0xc0007803f0, {0x75ab98, 0xc0009e3500}, 0x3880b1c?, 0x0?, 0x1?)
	pkg/sentry/vfs/dentry.go:187 +0x93
gvisor.dev/gvisor/pkg/sentry/vfs.(*FileDescription).DecRef.func1()
	pkg/sentry/vfs/file_description.go:167 +0x111
gvisor.dev/gvisor/pkg/sentry/vfs.(*FileDescriptionRefs).DecRef(0xc000c4a240, 0xc000885d18)
	bazel-out/k8-fastbuild-ST-3dcbe13c9b87/bin/pkg/sentry/vfs/file_description_refs.go:131 +0xb2
gvisor.dev/gvisor/pkg/sentry/vfs.(*FileDescription).DecRef(0xc000c4a240, {0x75ab98, 0xc0009e3500})
	pkg/sentry/vfs/file_description.go:161 +0x87
gvisor.dev/gvisor/pkg/sentry/socket/control.(*RightsFiles).Release(0xc000963908, {0x75ab98, 0xc0009e3500})
	pkg/sentry/socket/control/control.go:707 +0xb9
gvisor.dev/gvisor/pkg/sentry/socket/unix/transport.(*streamQueueReceiver).Recv(0xc000c9df80, {0x75ab98, 0xc0009e3500}, {0xc000de25e8, 0x1, 0x1}, 0x0, 0x0, 0x0)
	pkg/sentry/socket/unix/transport/unix.go:552 +0x62e
gvisor.dev/gvisor/pkg/sentry/socket/unix/transport.(*baseEndpoint).RecvMsg(0xc00031e160, {0x75ab98, 0xc0009e3500}, {0xc000de25e8, 0x1, 0x1}, 0x0?, 0x0?, 0x0?, 0x0)
	pkg/sentry/socket/unix/transport/unix.go:871 +0x13c
gvisor.dev/gvisor/pkg/sentry/socket/unix.(*EndpointReader).ReadToBlocks.func1({0xc000de25e8, 0x1, 0x1})
	pkg/sentry/socket/unix/io.go:115 +0x15d
gvisor.dev/gvisor/pkg/safemem.FromVecReaderFunc.ReadToBlocks({0x7f79d26003c0?}, {0x7f79d26003c0?, 0x20000000?, 0x20?, 0x1000?})
	pkg/safemem/io.go:282 +0x4d0
gvisor.dev/gvisor/pkg/sentry/socket/unix.(*EndpointReader).ReadToBlocks(0xc000d54c80, {0x7f79d26003c0?, 0x1000?, 0x0?, 0x200013c0?})
	pkg/sentry/socket/unix/io.go:124 +0x90
gvisor.dev/gvisor/pkg/sentry/mm.(*MemoryManager).withInternalMappings(0xc000dd4000, {0x75ab98, 0xc0009e3500}, {0x139f9ec?, 0x122ef05?}, {0xf5?, 0x6d?, 0x8c?}, 0x1?, 0xc0008866d0)
	pkg/sentry/mm/io.go:522 +0x819
gvisor.dev/gvisor/pkg/sentry/mm.(*MemoryManager).withVecInternalMappings(0xc000dd4000, {0x75ab98, 0xc0009e3500}, {0x0?, 0x27f36d4?, 0xc000dd4000?, 0xb79?}, {0x0, 0x1, 0x0}, ...)
	pkg/sentry/mm/io.go:591 +0x83f
gvisor.dev/gvisor/pkg/sentry/mm.(*MemoryManager).CopyOutFrom(0xc000dd4000, {0x75ab98, 0xc0009e3500}, {0x0?, 0x1add9c5?, 0x0?, 0xc0008866c8?}, {0x73ec00?, 0xc000d54c80?}, {0x0, ...})
	pkg/sentry/mm/io.go:273 +0x32b
gvisor.dev/gvisor/pkg/usermem.IOSequence.CopyOutFrom({{0x755010, 0xc000dd4000}, {0x0, 0x1, 0x200003c0, 0x1000}, {0x0, 0x1}}, {0x75ab98, 0xc0009e3500}, ...)
	pkg/usermem/usermem.go:508 +0xd8
gvisor.dev/gvisor/pkg/sentry/socket/unix.(*Socket).RecvMsg.func1()
	pkg/sentry/socket/unix/unix.go:715 +0x125
gvisor.dev/gvisor/pkg/sentry/socket/unix.(*Socket).RecvMsg(0xc000c4a300, 0xc0009e3500, {{0x755010, 0xc000dd4000}, {0x0, 0x1, 0x200003c0, 0x1000}, {0x0, 0x1}}, ...)
	pkg/sentry/socket/unix/unix.go:772 +0xda9
gvisor.dev/gvisor/pkg/sentry/syscalls/linux.recvSingleMsg(0xc0009e3500, {0x76b888, 0xc000c4a300}, 0x20001580, 0x0, 0x0?, {0xc0009e3500?})
	pkg/sentry/syscalls/linux/sys_socket.go:812 +0x2c7
gvisor.dev/gvisor/pkg/sentry/syscalls/linux.RecvMMsg(0xc0009e3500, 0x1?, {{0x4}, {0x20001580}, {0x1}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/syscalls/linux/sys_socket.go:730 +0xb28
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall(0xc0009e3500, 0x12b, {{0x4}, {0x20001580}, {0x1}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/kernel/task_syscall.go:142 +0xabf
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke(0xc0009e3500, 0x1?, {{0x4}, {0x20001580}, {0x1}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/kernel/task_syscall.go:322 +0x8e
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter(0xc0006de3c0?, 0xc000887b37?, {{0x4}, {0x20001580}, {0x1}, {0x0}, {0x0}, {0x0}})
	pkg/sentry/kernel/task_syscall.go:282 +0xc5
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscall(0xc0009e3500)
	pkg/sentry/kernel/task_syscall.go:257 +0x53b
gvisor.dev/gvisor/pkg/sentry/kernel.(*runApp).execute(0xc0009e3500?, 0xc0009e3500)
	pkg/sentry/kernel/task_run.go:269 +0x22b4
gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run(0xc0009e3500, 0x1e)
	pkg/sentry/kernel/task_run.go:98 +0x35b
created by gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start
	pkg/sentry/kernel/task_start.go:377 +0x1da

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/08 11:12 gvisor 0b76fe6c0038 90c93c40 .config console log report syz C ci-gvisor-systrap-1-race-cover panic: WARNING: circular locking detected: transport.endpointMutex -> kernfs.filesystemRWMutex:
* Struck through repros no longer work on HEAD.