1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00
wireguard-go/device
Jason A. Donenfeld ddfad453cf device: SendmsgN mutates the input sockaddr
So we take a new granular lock to prevent concurrent writes from
racing.

WARNING: DATA RACE
Write at 0x00c0011f2740 by goroutine 27:
  golang.org/x/sys/unix.(*SockaddrInet4).sockaddr()
      /go/pkg/mod/golang.org/x/sys@v0.0.0-20191105231009-c1f44814a5cd/unix/syscall_linux.go:384
+0x114
  golang.org/x/sys/unix.SendmsgN()
      /go/pkg/mod/golang.org/x/sys@v0.0.0-20191105231009-c1f44814a5cd/unix/syscall_linux.go:1304
+0x288
  golang.zx2c4.com/wireguard/device.send4()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/conn_linux.go:485
+0x11f
  golang.zx2c4.com/wireguard/device.(*nativeBind).Send()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/conn_linux.go:268
+0x1d6
  golang.zx2c4.com/wireguard/device.(*Peer).SendBuffer()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/peer.go:151
+0x285
  golang.zx2c4.com/wireguard/device.(*Peer).SendHandshakeInitiation()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/send.go:163
+0x692
  golang.zx2c4.com/wireguard/device.(*Device).RoutineReadFromTUN()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/send.go:318
+0x4b8

Previous write at 0x00c0011f2740 by goroutine 386:
  golang.org/x/sys/unix.(*SockaddrInet4).sockaddr()
      /go/pkg/mod/golang.org/x/sys@v0.0.0-20191105231009-c1f44814a5cd/unix/syscall_linux.go:384
+0x114
  golang.org/x/sys/unix.SendmsgN()
      /go/pkg/mod/golang.org/x/sys@v0.0.0-20191105231009-c1f44814a5cd/unix/syscall_linux.go:1304
+0x288
  golang.zx2c4.com/wireguard/device.send4()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/conn_linux.go:485
+0x11f
  golang.zx2c4.com/wireguard/device.(*nativeBind).Send()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/conn_linux.go:268
+0x1d6
  golang.zx2c4.com/wireguard/device.(*Peer).SendBuffer()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/peer.go:151
+0x285
  golang.zx2c4.com/wireguard/device.(*Peer).SendHandshakeInitiation()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/send.go:163
+0x692
  golang.zx2c4.com/wireguard/device.expiredRetransmitHandshake()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/timers.go:110
+0x40c
  golang.zx2c4.com/wireguard/device.(*Peer).NewTimer.func1()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/timers.go:42
+0xd8

Goroutine 27 (running) created at:
  golang.zx2c4.com/wireguard/device.NewDevice()
      /go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.20191012/device/device.go:322
+0x5e8
  main.main()
      /go/src/x/main.go:102 +0x58e

Goroutine 386 (finished) created at:
  time.goFunc()
      /usr/local/go/src/time/sleep.go:168 +0x51

Reported-by: Ben Burkert <ben@benburkert.com>
2019-11-28 11:11:13 +01:00
..
allowedips_rand_test.go global: begin modularization 2019-03-03 05:00:40 +01:00
allowedips_test.go global: begin modularization 2019-03-03 05:00:40 +01:00
allowedips.go global: begin modularization 2019-03-03 05:00:40 +01:00
bind_test.go global: begin modularization 2019-03-03 05:00:40 +01:00
boundif_android.go device: fail to give bind if it doesn't exist 2019-05-17 15:35:20 +02:00
boundif_windows.go device: allow blackholing sockets 2019-10-21 13:29:57 +02:00
conn_default.go device: allow blackholing sockets 2019-10-21 13:29:57 +02:00
conn_linux.go device: SendmsgN mutates the input sockaddr 2019-11-28 11:11:13 +01:00
conn.go global: regroup all imports 2019-05-14 09:09:52 +02:00
constants.go constants: recalculate rekey max based on a one minute flood 2019-10-30 14:29:32 +01:00
cookie_test.go global: begin modularization 2019-03-03 05:00:40 +01:00
cookie.go device, ratelimiter: replace uses of time.Now().Sub() with time.Since() 2019-06-03 22:15:41 +02:00
device_test.go device: test packets between two fake devices 2019-10-16 11:38:28 +02:00
device.go device: drop lock before expiring keys 2019-08-05 17:46:34 +02:00
endpoint_test.go global: begin modularization 2019-03-03 05:00:40 +01:00
indextable.go global: begin modularization 2019-03-03 05:00:40 +01:00
ip.go global: begin modularization 2019-03-03 05:00:40 +01:00
kdf_test.go global: regroup all imports 2019-05-14 09:09:52 +02:00
keypair.go global: regroup all imports 2019-05-14 09:09:52 +02:00
logger.go global: begin modularization 2019-03-03 05:00:40 +01:00
mark_default.go boundif: introduce API for socket binding 2019-03-04 16:37:11 +01:00
mark_unix.go global: regroup all imports 2019-05-14 09:09:52 +02:00
misc.go global: begin modularization 2019-03-03 05:00:40 +01:00
noise_test.go global: begin modularization 2019-03-03 05:00:40 +01:00
noise-helpers.go device: remove redundant return statements 2019-06-04 13:01:52 +02:00
noise-protocol.go global: fix a few typos courtesy of codespell 2019-10-22 11:51:25 +02:00
noise-types.go global: regroup all imports 2019-05-14 09:09:52 +02:00
peer.go uapi: skip peers with invalid keys 2019-08-05 16:57:41 +02:00
pools.go global: begin modularization 2019-03-03 05:00:40 +01:00
queueconstants_android.go receive: implement flush semantics 2019-03-21 14:45:41 -06:00
queueconstants_default.go tun: import mobile particularities 2019-03-04 16:37:11 +01:00
queueconstants_ios.go tun: import mobile particularities 2019-03-04 16:37:11 +01:00
receive.go device: receive: uniform message for source address check 2019-07-01 15:24:50 +02:00
send.go device: remove dead error reporting code 2019-10-21 11:46:54 +02:00
timers.go device: timers: add jitter on ack failure reinitiation 2019-05-24 13:48:25 +02:00
tun_test.go tun: remove TUN prefix from types to reduce stutter elsewhere 2019-06-14 18:35:57 +02:00
tun.go tun: remove TUN prefix from types to reduce stutter elsewhere 2019-06-14 18:35:57 +02:00
uapi.go uapi: allow preventing creation of new peers when updating 2019-10-04 11:41:02 +02:00
version.go version: bump snapshot 2019-10-12 22:34:10 +02:00