syzbot


DATA RACE in packet.(*endpoint).SetSockOptInt

Status: fixed on 2025/02/07 11:57
Fix commit: da7cd03064d7 Lock around packet mmap fields.
First crash: 205d, last: 204d

Sample crash report:
WARNING: DATA RACE
Read at 0x00c0000409d8 by goroutine 1320:
  gvisor.dev/gvisor/pkg/tcpip/transport/packet.(*endpoint).SetSockOptInt()
      pkg/tcpip/transport/packet/endpoint.go:409 +0x5b
  gvisor.dev/gvisor/pkg/sentry/socket/netstack.setSockOptPacket()
      pkg/sentry/socket/netstack/netstack.go:2763 +0x7d2
  gvisor.dev/gvisor/pkg/sentry/socket/netstack.SetSockOpt()
      pkg/sentry/socket/netstack/netstack.go:1873 +0x2e4
  gvisor.dev/gvisor/pkg/sentry/socket/netstack.(*sock).SetSockOpt()
      pkg/sentry/socket/netstack/netstack.go:634 +0x607
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.SetSockOpt()
      pkg/sentry/syscalls/linux/sys_socket.go:551 +0x3b4
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:143 +0x994
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke()
      pkg/sentry/kernel/task_syscall.go:323 +0x71
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter()
      pkg/sentry/kernel/task_syscall.go:283 +0x93
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscall()
      pkg/sentry/kernel/task_syscall.go:258 +0x4af
  gvisor.dev/gvisor/pkg/sentry/kernel.(*runApp).execute()
      pkg/sentry/kernel/task_run.go:269 +0x1fad
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:97 +0x4fa
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start.gowrap1()
      pkg/sentry/kernel/task_start.go:412 +0x44

Previous write at 0x00c0000409d8 by goroutine 1322:
  gvisor.dev/gvisor/pkg/tcpip/transport/packet.(*endpoint).SetPacketMMapEndpoint()
      pkg/tcpip/transport/packet/endpoint.go:578 +0x44
  gvisor.dev/gvisor/pkg/sentry/socket/netstack.setSockOptPacket()
      pkg/sentry/socket/netstack/netstack.go:2752 +0xae1
  gvisor.dev/gvisor/pkg/sentry/socket/netstack.SetSockOpt()
      pkg/sentry/socket/netstack/netstack.go:1873 +0x2e4
  gvisor.dev/gvisor/pkg/sentry/socket/netstack.(*sock).SetSockOpt()
      pkg/sentry/socket/netstack/netstack.go:634 +0x607
  gvisor.dev/gvisor/pkg/sentry/syscalls/linux.SetSockOpt()
      pkg/sentry/syscalls/linux/sys_socket.go:551 +0x3b4
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).executeSyscall()
      pkg/sentry/kernel/task_syscall.go:143 +0x994
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallInvoke()
      pkg/sentry/kernel/task_syscall.go:323 +0x71
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscallEnter()
      pkg/sentry/kernel/task_syscall.go:283 +0x93
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).doSyscall()
      pkg/sentry/kernel/task_syscall.go:258 +0x4af
  gvisor.dev/gvisor/pkg/sentry/kernel.(*runApp).execute()
      pkg/sentry/kernel/task_run.go:269 +0x1fad
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).run()
      pkg/sentry/kernel/task_run.go:97 +0x4fa
  gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).Start.gowrap1()
      pkg/sentry/kernel/task_start.go:412 +0x44

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/06 23:21 gvisor a4a0e84b5cd5 53657d1b .config console log report syz / log C ci-gvisor-ptrace-2-race DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/07 08:10 gvisor a4a0e84b5cd5 53657d1b .config console log report info ci-gvisor-systrap-1-race-cover DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/07 06:48 gvisor a4a0e84b5cd5 53657d1b .config console log report info ci-gvisor-ptrace-2-race-cover DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/07 06:24 gvisor a4a0e84b5cd5 53657d1b .config console log report info ci-gvisor-systrap-1-race DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/07 06:14 gvisor a4a0e84b5cd5 53657d1b .config console log report info ci-gvisor-ptrace-2-race-cover DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/07 03:10 gvisor a4a0e84b5cd5 53657d1b .config console log report info ci-gvisor-systrap-1-race-cover DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/07 00:48 gvisor a4a0e84b5cd5 53657d1b .config console log report info ci-gvisor-systrap-1-race DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/06 21:13 gvisor 902a56c6c584 1e1faf27 .config console log report info ci-gvisor-ptrace-2-race-cover DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/06 21:00 gvisor 902a56c6c584 1e1faf27 .config console log report info ci-gvisor-ptrace-1-race-cover DATA RACE in packet.(*endpoint).SetSockOptInt
2025/02/06 11:39 gvisor 902a56c6c584 1e1faf27 .config console log report info ci-gvisor-ptrace-1-race-cover DATA RACE in packet.(*endpoint).SetSockOptInt
* Struck through repros no longer work on HEAD.