tokio-rs/tokio · Security
Race condition in tokio
- GHSA ID
- GHSA-2grh-hm3w-w7hv
- CVE ID
- CVE-2021-38191
- Severity
- medium
- Published
- Updated
- CVSS
- 5.9 · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
- CVSS v3
- 5.9 · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Description
When aborting a task with JoinHandle::abort, the future is dropped in the thread calling abort if the task is not currently being executed. This is incorrect for tasks spawned on a LocalSet. This can easily result in race conditions as many projects use Rc or RefCell in their Tokio tasks for better performance.
CWEs
- CWE-362 · Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
- CWE-366 · Race Condition within a Thread