syzbot


DATA RACE in fasync.(*FileAsync).SetOwnerTask

Status: fixed on 2023/06/09 02:12
Fix commit: 5fed8c81b89a Fix data race by acquiring lock before accessing fields of FileAsync.
First crash: 538d, last: 537d

Sample crash report:
WARNING: DATA RACE
Write at 0x00c001535380 by goroutine 8787:
  gvisor.dev/gvisor/pkg/sentry/kernel/fasync.(*FileAsync).SetOwnerTask()
      pkg/sentry/kernel/fasync/fasync.go:189 +0xe4
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.setAsyncOwner()
      pkg/sentry/syscalls/linux/sys_file.go:767 +0x250
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.Fcntl()
      pkg/sentry/syscalls/linux/sys_file.go:657 +0xc25
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:142 +0x9c1
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke()
      pkg/sentry/kernel/task_syscall.go:322 +0x7c
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter()
      pkg/sentry/kernel/task_syscall.go:282 +0x8e
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscall()
      pkg/sentry/kernel/task_syscall.go:257 +0x4c4
  gvisor.dev/gvisor/pkg/sentry/kernel.(*runApp).execute()
      pkg/sentry/kernel/task_run.go:269 +0x1d4a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:98 +0x41a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start.func1()
      pkg/sentry/kernel/task_start.go:377 +0x47

Previous read at 0x00c001535380 by goroutine 8781:
  gvisor.dev/gvisor/pkg/sentry/kernel/fasync.(*FileAsync).NotifyEvent()
      pkg/sentry/kernel/fasync/fasync.go:114 +0x92
  gvisor.dev/gvisor/pkg/waiter.(*Queue).Notify()
      pkg/waiter/waiter.go:238 +0xad
  gvisor.dev/gvisor/pkg/sentry/vfs.(*Inotify).queueEvent()
      pkg/sentry/vfs/inotify.go:296 +0x26b
  gvisor.dev/gvisor/pkg/sentry/vfs.(*Watch).Notify()
      pkg/sentry/vfs/inotify.go:604 +0x298
  gvisor.dev/gvisor/pkg/sentry/vfs.(*Watches).Notify()
      pkg/sentry/vfs/inotify.go:476 +0x1a4
  gvisor.dev/gvisor/pkg/sentry/fsimpl/tmpfs.(*dentry).InotifyWithParent()
      pkg/sentry/fsimpl/tmpfs/tmpfs.go:429 +0x1d9
  gvisor.dev/gvisor/pkg/sentry/vfs.(*Dentry).InotifyWithParent()
      pkg/sentry/vfs/dentry.go:187 +0x79a
  gvisor.dev/gvisor/pkg/sentry/vfs.(*VirtualFilesystem).OpenAt()
      pkg/sentry/vfs/vfs.go:482 +0x75b
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.openat()
      pkg/sentry/syscalls/linux/sys_file.go:112 +0x2b1
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.Creat()
      pkg/sentry/syscalls/linux/sys_file.go:98 +0x44
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:142 +0x9c1
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke()
      pkg/sentry/kernel/task_syscall.go:322 +0x7c
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter()
      pkg/sentry/kernel/task_syscall.go:282 +0x8e
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscall()
      pkg/sentry/kernel/task_syscall.go:257 +0x4c4
  gvisor.dev/gvisor/pkg/sentry/kernel.(*runApp).execute()
      pkg/sentry/kernel/task_run.go:269 +0x1d4a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:98 +0x41a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start.func1()
      pkg/sentry/kernel/task_start.go:377 +0x47

Crashes (11):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/06 20:16 gvisor 3c67b2652f56 a4ae4f42 .config console log report syz C ci-gvisor-ptrace-1-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/06 20:16 gvisor 3c67b2652f56 a4ae4f42 .config console log report syz C ci-gvisor-systrap-1-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/06 20:16 gvisor 3c67b2652f56 a4ae4f42 .config console log report syz C ci-gvisor-ptrace-2-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/06 19:56 gvisor 3c67b2652f56 a4ae4f42 .config console log report syz C ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/08 05:22 gvisor 60e4fec168d6 058b3a5a .config console log report info ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/08 01:22 gvisor 60e4fec168d6 058b3a5a .config console log report info ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/07 20:01 gvisor f815fa9079b9 7086cdb9 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/07 13:23 gvisor f815fa9079b9 7086cdb9 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/07 04:34 gvisor e99c6835d089 a4ae4f42 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/06 23:55 gvisor e99c6835d089 a4ae4f42 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
2023/06/06 18:52 gvisor 3c67b2652f56 a4ae4f42 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in fasync.(*FileAsync).SetOwnerTask
* Struck through repros no longer work on HEAD.