]> Cypherpunks repositories - gostls13.git/commit
[dev.fuzz] internal/fuzz: guard concurrent access to shared memory
authorJay Conrod <jayconrod@google.com>
Wed, 20 Jan 2021 22:09:59 +0000 (17:09 -0500)
committerJay Conrod <jayconrod@google.com>
Thu, 21 Jan 2021 15:00:05 +0000 (15:00 +0000)
commit671dba6c89bc0183982553e0359e0a3b2c00963f
treecd995bd86a5dfecf1592e9fe26a842a301708c7a
parent8e0584c327e429bd010edb28fb9fea6f68a4cccc
[dev.fuzz] internal/fuzz: guard concurrent access to shared memory

This change moves the worker's *sharedMem into a buffered chan that
acts as a mutex. The mutex can be locked by receiving from the chan;
it can be unlocked by sending *sharedMem back to the chan. Multiple
objects (like worker, workerClient, workerServer) may have references
to the chan and may hold the lock across several operations.

This is intended to fix a segfault that occurred when
workerClient.fuzz accessed shared memory after it was already closed
and unmapped by the worker's goroutine. workerClient.fuzz is executed
in a separate goroutine so the worker can still receive messages from
the coordinator (like being told to stop and clean up).

Change-Id: I4eb9079ba9e5bfcfacfecd0fc8ad9bed17b33bba
Reviewed-on: https://go-review.googlesource.com/c/go/+/285054
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
src/internal/fuzz/fuzz.go
src/internal/fuzz/sys_posix.go
src/internal/fuzz/sys_windows.go
src/internal/fuzz/worker.go