syzbot


DATA RACE in tty.(*queue).WriteFromBlocks

Status: fixed on 2019/04/04 10:15
Fix commit: c79e81bd27cd Addresses data race in tty implementation.
First crash: 2067d, last: 2063d

Sample crash report:
WARNING: DATA RACE
Write at 0x00c00014f0c8 by goroutine 332:
  gvisor.googlesource.com/gvisor/pkg/sentry/fs/tty.(*queue).WriteFromBlocks()
      pkg/sentry/fs/tty/queue.go:246 +0x2a6
  gvisor.googlesource.com/gvisor/pkg/sentry/safemem.Writer.WriteFromBlocks-fm()
      pkg/sentry/safemem/io.go:46 +0x75
  gvisor.googlesource.com/gvisor/pkg/sentry/mm.(*MemoryManager).withInternalMappings()
      pkg/sentry/mm/io.go:503 +0x8ac
  gvisor.googlesource.com/gvisor/pkg/sentry/mm.(*MemoryManager).withVecInternalMappings()
      pkg/sentry/mm/io.go:572 +0x964
  gvisor.googlesource.com/gvisor/pkg/sentry/mm.(*MemoryManager).CopyInTo()
      pkg/sentry/mm/io.go:309 +0x1f1
  gvisor.googlesource.com/gvisor/pkg/sentry/fs/tty.(*queue).write()
      pkg/sentry/usermem/usermem.go:543 +0x164
  gvisor.googlesource.com/gvisor/pkg/sentry/fs/tty.(*lineDiscipline).inputQueueWrite()
      pkg/sentry/fs/tty/line_discipline.go:205 +0x147
  gvisor.googlesource.com/gvisor/pkg/sentry/fs/tty.(*masterFileOperations).Write()
      pkg/sentry/fs/tty/master.go:141 +0x11c
  gvisor.googlesource.com/gvisor/pkg/sentry/fs.(*File).Writev()
      pkg/sentry/fs/file.go:314 +0x1fc
  gvisor.googlesource.com/gvisor/pkg/sentry/syscalls/linux.writev()
      pkg/sentry/syscalls/linux/sys_write.go:261 +0xe0
  gvisor.googlesource.com/gvisor/pkg/sentry/syscalls/linux.Write()
      pkg/sentry/syscalls/linux/sys_write.go:71 +0x293
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:165 +0x407
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke()
      pkg/sentry/kernel/task_syscall.go:283 +0xb4
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter()
      pkg/sentry/kernel/task_syscall.go:244 +0x109
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).doSyscall()
      pkg/sentry/kernel/task_syscall.go:219 +0x1b6
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*runApp).execute()
      pkg/sentry/kernel/task_run.go:215 +0x1852
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:91 +0x2e5

Previous read at 0x00c00014f0c8 by goroutine 113:
  gvisor.googlesource.com/gvisor/pkg/sentry/fs/tty.(*lineDiscipline).masterReadiness()
      pkg/sentry/fs/tty/queue.go:121 +0x43
  gvisor.googlesource.com/gvisor/pkg/sentry/fs/tty.(*masterFileOperations).Readiness()
      pkg/sentry/fs/tty/master.go:131 +0x71
  gvisor.googlesource.com/gvisor/pkg/sentry/syscalls.(*PollFD).initReadiness()
      pkg/sentry/fs/file.go:199 +0x2d0
  gvisor.googlesource.com/gvisor/pkg/sentry/syscalls.Poll()
      pkg/sentry/syscalls/polling.go:96 +0x139
  gvisor.googlesource.com/gvisor/pkg/sentry/syscalls/linux.doPoll()
      pkg/sentry/syscalls/linux/sys_poll.go:70 +0x2ac
  gvisor.googlesource.com/gvisor/pkg/sentry/syscalls/linux.Ppoll()
      pkg/sentry/syscalls/linux/sys_poll.go:343 +0x113
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:165 +0x407
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke()
      pkg/sentry/kernel/task_syscall.go:283 +0xb4
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter()
      pkg/sentry/kernel/task_syscall.go:244 +0x109
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).doSyscall()
      pkg/sentry/kernel/task_syscall.go:219 +0x1b6
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*runApp).execute()
      pkg/sentry/kernel/task_run.go:215 +0x1852
  gvisor.googlesource.com/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:91 +0x2e5

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/03 02:57 https://gvisor.googlesource.com/gvisor master 52a51a8e20b3 dfd3394d .config console log report syz ci-gvisor-kvm-direct-overlay-host-race
2019/04/03 02:50 https://gvisor.googlesource.com/gvisor master 52a51a8e20b3 dfd3394d .config console log report syz ci-gvisor-ptrace-proxy-sandbox-race
2019/03/31 03:36 https://gvisor.googlesource.com/gvisor master a046054ba35e 0c624d4d .config console log report syz ci-gvisor-ptrace-proxy-sandbox-race
2019/03/31 03:22 https://gvisor.googlesource.com/gvisor master a046054ba35e 0c624d4d .config console log report syz ci-gvisor-kvm-direct-overlay-host-race
2019/04/03 16:10 https://gvisor.googlesource.com/gvisor master c4caccd54042 dfd3394d .config console log report ci-gvisor-kvm-direct-overlay-host-race
2019/04/03 02:43 https://gvisor.googlesource.com/gvisor master 52a51a8e20b3 dfd3394d .config console log report ci-gvisor-ptrace-proxy-sandbox-race
2019/03/31 03:06 https://gvisor.googlesource.com/gvisor master a046054ba35e 0c624d4d .config console log report ci-gvisor-kvm-direct-overlay-host-race
* Struck through repros no longer work on HEAD.