Repository navigation
Zeroize daemon authentication secrets during module listing - #1050
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| struct SensitiveBytes(Vec<u8>); | ||
|
|
||
| impl SensitiveBytes { | ||
| fn new(bytes: Vec<u8>) -> Self { | ||
| Self(bytes) | ||
| } | ||
|
|
||
| fn to_vec(&self) -> Vec<u8> { | ||
| self.0.clone() | ||
| } | ||
|
|
||
| fn as_slice(&self) -> &[u8] { | ||
| &self.0 | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| impl SensitiveBytes { | ||
| fn into_zeroized_vec(mut self) -> Vec<u8> { | ||
| for byte in &mut self.0 { | ||
| *byte = 0; | ||
| } | ||
| std::mem::take(&mut self.0) | ||
| } | ||
| } | ||
|
|
||
| impl Drop for SensitiveBytes { | ||
| fn drop(&mut self) { | ||
| for byte in &mut self.0 { | ||
| *byte = 0; | ||
| } | ||
| } |
There was a problem hiding this comment.
Use non-optimizable zeroization for secrets
The new SensitiveBytes drop implementation clears the buffer with a plain for loop that writes 0 (impl Drop for SensitiveBytes). Rust does not guarantee that such writes are retained after optimisation if the data is never read again, so compilers may elide the loop and leave the authentication secret in memory. Since this commit’s goal is to reliably wipe passwords, the destructor should use a zeroization primitive that cannot be removed (e.g. the zeroize crate or ptr::write_volatile/zeroize::Zeroizing). Without that, the change does not actually guarantee the secrets are cleared.
Useful? React with 👍 / 👎.
Adds an audit for task #1048 quantifying the path-storage portion of the 100K-files RSS gap (87.5 vs 7.4 MB at v0.5; 42.6 vs 7.9 MB current per the flist-memory baseline). Per-entry breakdown of `name: PathBuf` (24 B inline + heap with capacity slack) and `dirname: Arc<Path>` (16 B inline + 16 B `ArcInner` header), comparison to upstream's pool-allocated `struct file_struct` + `lastdir` cache from `flist.c`/`rsync.h`, and a test/benchmark plan reusing the existing file-entry memory benchmark. Recommends an `Arc<[u8]>` per-flist arena with `(offset, len)` slice fields as the natural shape for #1050, with `Box<[u8]>` post-sort as the smaller mechanical fallback.
Document the container-level RSS gap between oc-rsync's Vec<FileEntry> + segmented file lists and upstream rsync's pool_alloc.c slab arena. Quantify Vec doubling slack, per-segment fragmentation, and pointer-array overhead at 100K and 1M file scales, then propose five remediation paths ranked by effort/payoff: pre-size from getdents count, bumpalo arena, typed-arena, custom slab pool, and inline-string path collapse. Recommend stacking the cheapest two for an estimated 40-50 MiB win at 1M entries.
Static audit comparing upstream rsync's per-flist slab pool (`lib/pool_alloc.c`) against oc-rsync's `Vec<FileEntry>` plus per-entry `PathBuf` and `Box<FileEntryExtras>` heap allocations. Lists bumpalo / typed-arena candidates for collapsing the file list into a single slab and the lifetime, Drop, and signal-cleanup risks that gate the pilot.
Walks current owner sites of FileEntry to confirm the bumpalo arena swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing extras fields, and the Arc<FileEntry> job pipeline. Records the exact code sites that would have to move, recommends pre-size + path-collapse as cheaper prerequisites per the prior #1050 audits.
Walks current owner sites of FileEntry to confirm the bumpalo arena swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing extras fields, and the Arc<FileEntry> job pipeline. Records the exact code sites that would have to move, recommends pre-size + path-collapse as cheaper prerequisites per the prior #1050 audits.
Adds an audit for task #1048 quantifying the path-storage portion of the 100K-files RSS gap (87.5 vs 7.4 MB at v0.5; 42.6 vs 7.9 MB current per the flist-memory baseline). Per-entry breakdown of `name: PathBuf` (24 B inline + heap with capacity slack) and `dirname: Arc<Path>` (16 B inline + 16 B `ArcInner` header), comparison to upstream's pool-allocated `struct file_struct` + `lastdir` cache from `flist.c`/`rsync.h`, and a test/benchmark plan reusing the existing file-entry memory benchmark. Recommends an `Arc<[u8]>` per-flist arena with `(offset, len)` slice fields as the natural shape for #1050, with `Box<[u8]>` post-sort as the smaller mechanical fallback.
Document the container-level RSS gap between oc-rsync's Vec<FileEntry> + segmented file lists and upstream rsync's pool_alloc.c slab arena. Quantify Vec doubling slack, per-segment fragmentation, and pointer-array overhead at 100K and 1M file scales, then propose five remediation paths ranked by effort/payoff: pre-size from getdents count, bumpalo arena, typed-arena, custom slab pool, and inline-string path collapse. Recommend stacking the cheapest two for an estimated 40-50 MiB win at 1M entries.
Static audit comparing upstream rsync's per-flist slab pool (`lib/pool_alloc.c`) against oc-rsync's `Vec<FileEntry>` plus per-entry `PathBuf` and `Box<FileEntryExtras>` heap allocations. Lists bumpalo / typed-arena candidates for collapsing the file list into a single slab and the lifetime, Drop, and signal-cleanup risks that gate the pilot.
Walks current owner sites of FileEntry to confirm the bumpalo arena swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing extras fields, and the Arc<FileEntry> job pipeline. Records the exact code sites that would have to move, recommends pre-size + path-collapse as cheaper prerequisites per the prior #1050 audits.
Walks current owner sites of FileEntry to confirm the bumpalo arena swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing extras fields, and the Arc<FileEntry> job pipeline. Records the exact code sites that would have to move, recommends pre-size + path-collapse as cheaper prerequisites per the prior #1050 audits.
Adds an audit for task #1048 quantifying the path-storage portion of the 100K-files RSS gap (87.5 vs 7.4 MB at v0.5; 42.6 vs 7.9 MB current per the flist-memory baseline). Per-entry breakdown of `name: PathBuf` (24 B inline + heap with capacity slack) and `dirname: Arc<Path>` (16 B inline + 16 B `ArcInner` header), comparison to upstream's pool-allocated `struct file_struct` + `lastdir` cache from `flist.c`/`rsync.h`, and a test/benchmark plan reusing the existing file-entry memory benchmark. Recommends an `Arc<[u8]>` per-flist arena with `(offset, len)` slice fields as the natural shape for #1050, with `Box<[u8]>` post-sort as the smaller mechanical fallback.
Document the container-level RSS gap between oc-rsync's Vec<FileEntry> + segmented file lists and upstream rsync's pool_alloc.c slab arena. Quantify Vec doubling slack, per-segment fragmentation, and pointer-array overhead at 100K and 1M file scales, then propose five remediation paths ranked by effort/payoff: pre-size from getdents count, bumpalo arena, typed-arena, custom slab pool, and inline-string path collapse. Recommend stacking the cheapest two for an estimated 40-50 MiB win at 1M entries.
Walks current owner sites of FileEntry to confirm the bumpalo arena swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing extras fields, and the Arc<FileEntry> job pipeline. Records the exact code sites that would have to move, recommends pre-size + path-collapse as cheaper prerequisites per the prior #1050 audits.
Static audit comparing upstream rsync's per-flist slab pool (`lib/pool_alloc.c`) against oc-rsync's `Vec<FileEntry>` plus per-entry `PathBuf` and `Box<FileEntryExtras>` heap allocations. Lists bumpalo / typed-arena candidates for collapsing the file list into a single slab and the lifetime, Drop, and signal-cleanup risks that gate the pilot.
Summary
Testing