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

Possible soundness issue in JobPort::Drop #19

Open
gigaroby opened this issue Sep 7, 2023 · 1 comment
Open

Possible soundness issue in JobPort::Drop #19

gigaroby opened this issue Sep 7, 2023 · 1 comment

Comments

@gigaroby
Copy link

gigaroby commented Sep 7, 2023

While conducting an internal unsafe review, we identified a possible soundness issue in JobPort::Drop

unsafe { CloseHandle(self.completion_port) };

This is highly suspect when combined with #[derive(Clone)] on the struct: any use of Clone is likely to lead to a double-free. This will usually produce a harmless "invalid handle" error which this code will silently ignore, but if either HANDLE value is reused by the kernel before the second clone is dropped, undefined behavior seems possible.

@passcod
Copy link
Member

passcod commented Sep 7, 2023

Huh, yeah, that does look likely. Unfortunately very busy elsewhere currently but if you want to submit a PR to clear that I'll merge and release asap.

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

2 participants