Unsoundness in buffer APIs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 1k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 66
Description
The slice accessors of PyBuffer return &core::cell::Cell (or &ReadOnlyCell) to guard memory which might be written by other threads, but Cell's guarantee is upheld by the fact that it's not Sync and no other threads can access that memory.
https://github.com/rust-lang/rust/blob/8ab9fdff5a91b9f2b5ed57fb0275452d9a0d0280/library/core/src/cell.rs#L322-L328
It looks like the slice accessors may have relied on the GIL for soundness.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the PyBuffer slice accessors and the linked Rust Cell documentation in library/core/src/cell.rs. Trace whether those accessors depend on the GIL for thread-safety; done means the soundness status and required API change are clearly resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100