syzbot


DATA RACE in kernel.(*TaskImage).Fork

Status: fixed on 2023/05/22 19:07
Fix commit: 028cf757bbef Clarify comment about copying Task.image in Task.Clone().
First crash: 647d, last: 646d

Sample crash report:
WARNING: DATA RACE
Read at 0x00c004a0e7b8 by goroutine 13643:
  gvisor.dev/gvisor/pkg/sentry/kernel.(*TaskImage).Fork()
      pkg/sentry/kernel/task_image.go:74 +0xe4
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Clone()
      pkg/sentry/kernel/task_clone.go:139 +0x112f
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.clone()
      pkg/sentry/syscalls/linux/sys_thread.go:216 +0x144
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.Clone()
      pkg/sentry/syscalls/linux/sys_clone_amd64.go:36 +0x4d
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:142 +0x9b8
  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:259 +0x1b4a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:94 +0x36a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start.func1()
      pkg/sentry/kernel/task_start.go:377 +0x47

Previous write at 0x00c004a0e7b8 by goroutine 13687:
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).SetName()
      pkg/sentry/kernel/task_acct.go:137 +0xd1
  gvisor.dev/gvisor/pkg/sentry/fsimpl/proc.(*commData).Write()
      pkg/sentry/fsimpl/proc/task_files.go:318 +0x2b1
  gvisor.dev/gvisor/pkg/sentry/vfs.(*DynamicBytesFileDescriptionImpl).pwriteLocked()
      pkg/sentry/vfs/file_description_impl_util.go:391 +0x2b6
  gvisor.dev/gvisor/pkg/sentry/vfs.(*DynamicBytesFileDescriptionImpl).Write()
      pkg/sentry/vfs/file_description_impl_util.go:412 +0x124
  gvisor.dev/gvisor/pkg/sentry/fsimpl/kernfs.(*DynamicBytesFD).Write()
      pkg/sentry/fsimpl/kernfs/dynamic_bytes_file.go:132 +0x9a
  gvisor.dev/gvisor/pkg/sentry/vfs.(*FileDescription).Write()
      pkg/sentry/vfs/file_description.go:674 +0x124
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.write()
      pkg/sentry/syscalls/linux/sys_read_write.go:347 +0x9c
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.Write()
      pkg/sentry/syscalls/linux/sys_read_write.go:316 +0x274
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:142 +0x9b8
  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
D0218 20:10:19.517816   39256 task_acct.go:138] [ 1108: 1108] Set thread name to ""
  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:259 +0x1b4a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:94 +0x36a
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start.func1()
      pkg/sentry/kernel/task_start.go:377 +0x47

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/18 20:10 gvisor f11778abbab6 bcdf85f8 .config console log report syz C ci-gvisor-ptrace-2-race DATA RACE in kernel.(*TaskImage).Fork
2023/02/18 20:01 gvisor f11778abbab6 bcdf85f8 .config console log report syz C ci-gvisor-ptrace-1-race DATA RACE in kernel.(*TaskImage).Fork
2023/02/18 19:44 gvisor f11778abbab6 bcdf85f8 .config console log report syz C ci-gvisor-ptrace-3-race DATA RACE in kernel.(*TaskImage).Fork
2023/02/18 17:48 gvisor f11778abbab6 bcdf85f8 .config console log report syz ci-gvisor-ptrace-3-race DATA RACE in kernel.(*TaskImage).Fork
2023/02/18 11:32 gvisor f11778abbab6 bcdf85f8 .config console log report syz ci-gvisor-ptrace-3-race DATA RACE in kernel.(*TaskImage).Fork
2023/02/18 19:26 gvisor f11778abbab6 bcdf85f8 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in kernel.(*TaskImage).Fork
2023/02/18 17:29 gvisor f11778abbab6 bcdf85f8 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in kernel.(*TaskImage).Fork
2023/02/18 11:14 gvisor f11778abbab6 bcdf85f8 .config console log report info ci-gvisor-ptrace-3-race DATA RACE in kernel.(*TaskImage).Fork
* Struck through repros no longer work on HEAD.