Skip to content

Possible soundness issue in JobPort::Drop #19

@gigaroby

Description

@gigaroby

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions