droyo / styx

Go library for the 9P filesystem protocol
MIT License
64 stars 18 forks source link

Fix race condition in Tread/Rread #22

Closed droyo closed 4 years ago

droyo commented 4 years ago

If we don't pass a copy of the Tread message to the goroutine that generates the Rread response, The next call to Next has permission to ovewrite the area of the shared buffer storing the contents of msg.

Should fix #16 and #20

dcrosta commented 4 years ago

Eek, I guess we never remembered to follow up on this issue -- sorry about that! This is very similar to a patch we applied internally, and in our experience this has effectively fixed the issue in #16. (with credit to @rhalas who discovered and fixed this on our end)