Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall: unchecked overflow in byteq and msgq with GOOS=nacl #21168

Closed
bcmills opened this issue Jul 25, 2017 · 1 comment
Closed

syscall: unchecked overflow in byteq and msgq with GOOS=nacl #21168

bcmills opened this issue Jul 25, 2017 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Jul 25, 2017

In looking at examples for #21165, I noticed an unchecked overflow in the syscall package on the nacl platform.

The queue implementation in syscall/net_nacl.go waits on the difference q.w-q.r, and the read and write methods of byteq and msgq increment those variables without checking for overflow. w and r both have type int, so on a 32-bit build it is quite possible to overflow one or the other and cause the reader and/or writer to deadlock.

This program times out due to the deadlock: https://play.golang.org/p/C_YmUjwXwW
In contrast, stopping the reader just before the overflow causes the program to exit successfully: https://play.golang.org/p/XPEU7FoTes

The difference between the two is just one iteration of the loop: the one that tips the writer across that overflow:

-		for n < maxInt {
+		for n+bufSize < maxInt {

(Proposal #19624 would report the overflow here instead of deadlocking the program.)

@bcmills bcmills changed the title syscall(nacl): unchecked overflow in byteq syscall(nacl): unchecked overflow in byteq and msgq Jul 25, 2017
@bradfitz bradfitz changed the title syscall(nacl): unchecked overflow in byteq and msgq syscall: unchecked overflow in byteq and msgq with GOOS=nacl Jul 25, 2017
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 30, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Mar 30, 2018
@bradfitz
Copy link
Contributor

bradfitz commented Oct 8, 2019

Closing nacl bugs, as we're removing nacl (#30439)

@bradfitz bradfitz closed this as completed Oct 8, 2019
@golang golang locked and limited conversation to collaborators Oct 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants