pty icon indicating copy to clipboard operation
pty copied to clipboard

Data race on ioctl

Open spikecurtis opened this issue 3 years ago • 0 comments

I'm seeing data races when calling pty.Setsize , c.f. https://github.com/coder/coder/issues/3236

I think what's going on here is that calling Fd() on an os.File is inherently racy if multiple goroutines have reference to the file. While Read() and Write() go through the fdmutex, Fd() does not.

I believe the correct fix is to wrap calls like ioctl in SyscallConn.

In testing this out locally, I noticed that it breaks riscv builds, which are apparently still on Go 1.6. I saw #149 mention that it should be possible to get riscv builds natively, so hopefully this isn't a blocker.

Does that sound right to you and would you be interested in a PR?

spikecurtis avatar Jul 26 '22 23:07 spikecurtis