mirror of
https://github.com/deepseek-ai/3FS.git
synced 2026-11-05 00:47:47 +00:00
[GH-ISSUE #384] [SAFETY] Memory safety consideration in update_chunk() #225
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/3FS#225
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @red1239109-cmd on GitHub (Jan 20, 2026).
Original GitHub issue: https://github.com/deepseek-ai/3FS/issues/384
Originally assigned to: @SF-Zhou, @Copilot on GitHub.
[SAFETY] Memory safety consideration in update_chunk()
Hi team,
I was studying the Engine module to understand its architecture and noticed a subtle safety constraint in
update_chunk().Observation:
The
unsafe { std::slice::from_raw_parts(...) }inupdate_chunk()assumes thereq.datapointer remains valid only because the slice is consumed immediately withinsafe_write/copy_on_write.Why this matters now:
This is perfectly safe in the current synchronous flow. However, if we ever optimize by making writes asynchronous (write-behind, background flush), this would become a use-after-free hazard.
Low-effort safeguard suggestion:
// SAFETY:comment above the unsafe block documenting this synchronous consumption requirement&[u8]alongside the raw pointer interfaceThis isn't a pressing bug, but documenting this constraint will prevent accidental memory safety issues during future optimizations.
Thoughts?
@SF-Zhou commented on GitHub (Jan 20, 2026):
Thanks for catching this — I'll add a SAFETY comment to document the assumption.