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

go-fuzz hangs when the testee forks a subprocess then crashes #310

Open
yasushi-saito opened this issue Dec 3, 2020 · 0 comments
Open

Comments

@yasushi-saito
Copy link

The problem is that the three control FDs (3, 4, 5) used by the testee to communicate with the tester aren't marked close-on-exec. So if the testee forks and dies, the child will keep the tester from completing the reads of the descriptors. Adding

	for _, fd := range []uintptr{3, 4, 5} {
		r1, r2, err := syscall.Syscall(syscall.SYS_FCNTL, fd, syscall.F_GETFD, 0)
		_, _, err = syscall.Syscall(syscall.SYS_FCNTL, fd, syscall.F_SETFD, r1|syscall.FD_CLOEXEC)
	}

at the beginning of Fuzz function fixes this problem. This logic should really be added somewhere go-fuzz-dep/main.go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant