refactor(fs): refactor path traversal handling#2172
Open
fogti wants to merge 1 commit intohermit-os:mainfrom
Open
refactor(fs): refactor path traversal handling#2172fogti wants to merge 1 commit intohermit-os:mainfrom
fogti wants to merge 1 commit intohermit-os:mainfrom
Conversation
19bd9ce to
aef532d
Compare
Contributor
There was a problem hiding this comment.
Benchmark Results
Details
| Benchmark | Current: 5772705 | Previous: ff18234 | Performance Ratio |
|---|---|---|---|
| startup_benchmark Build Time | 101.22 s |
97.61 s |
1.04 ❗ |
| startup_benchmark File Size | 0.82 MB |
0.86 MB |
0.94 ❗ |
| Startup Time - 1 core | 0.95 s (±0.04 s) |
0.93 s (±0.03 s) |
1.02 |
| Startup Time - 2 cores | 0.96 s (±0.03 s) |
0.95 s (±0.03 s) |
1.02 |
| Startup Time - 4 cores | 0.96 s (±0.03 s) |
0.94 s (±0.03 s) |
1.03 |
| multithreaded_benchmark Build Time | 102.02 s |
99.88 s |
1.02 ❗ |
| multithreaded_benchmark File Size | 0.97 MB |
0.96 MB |
1.01 ❗ |
| Multithreaded Pi Efficiency - 2 Threads | 88.16 % (±9.84 %) |
88.00 % (±9.25 %) |
1.00 |
| Multithreaded Pi Efficiency - 4 Threads | 43.44 % (±3.50 %) |
43.12 % (±4.33 %) |
1.01 |
| Multithreaded Pi Efficiency - 8 Threads | 24.94 % (±2.64 %) |
24.87 % (±2.17 %) |
1.00 |
| micro_benchmarks Build Time | 104.44 s |
95.29 s |
1.10 ❗ |
| micro_benchmarks File Size | 0.97 MB |
0.97 MB |
1.01 ❗ |
| Scheduling time - 1 thread | 68.09 ticks (±3.30 ticks) |
66.64 ticks (±3.71 ticks) |
1.02 |
| Scheduling time - 2 threads | 37.57 ticks (±4.32 ticks) |
38.45 ticks (±5.98 ticks) |
0.98 |
| Micro - Time for syscall (getpid) | 3.40 ticks (±0.52 ticks) |
3.17 ticks (±0.47 ticks) |
1.07 |
| Memcpy speed - (built_in) block size 4096 | 65353.51 MByte/s (±46368.72 MByte/s) |
66568.39 MByte/s (±47388.78 MByte/s) |
0.98 |
| Memcpy speed - (built_in) block size 1048576 | 29215.69 MByte/s (±24112.89 MByte/s) |
29555.04 MByte/s (±24278.48 MByte/s) |
0.99 |
| Memcpy speed - (built_in) block size 16777216 | 25778.04 MByte/s (±21635.47 MByte/s) |
28751.44 MByte/s (±23938.19 MByte/s) |
0.90 |
| Memset speed - (built_in) block size 4096 | 65958.29 MByte/s (±46755.96 MByte/s) |
66780.03 MByte/s (±47520.66 MByte/s) |
0.99 |
| Memset speed - (built_in) block size 1048576 | 29988.24 MByte/s (±24541.59 MByte/s) |
30326.51 MByte/s (±24715.31 MByte/s) |
0.99 |
| Memset speed - (built_in) block size 16777216 | 26547.03 MByte/s (±22113.03 MByte/s) |
29524.28 MByte/s (±24375.39 MByte/s) |
0.90 |
| Memcpy speed - (rust) block size 4096 | 57724.26 MByte/s (±42490.83 MByte/s) |
63679.07 MByte/s (±46857.40 MByte/s) |
0.91 |
| Memcpy speed - (rust) block size 1048576 | 29096.54 MByte/s (±24066.07 MByte/s) |
29550.94 MByte/s (±24294.01 MByte/s) |
0.98 |
| Memcpy speed - (rust) block size 16777216 | 24973.71 MByte/s (±20989.99 MByte/s) |
28708.33 MByte/s (±23916.49 MByte/s) |
0.87 |
| Memset speed - (rust) block size 4096 | 58913.55 MByte/s (±43313.48 MByte/s) |
64665.18 MByte/s (±47525.69 MByte/s) |
0.91 |
| Memset speed - (rust) block size 1048576 | 29872.65 MByte/s (±24506.52 MByte/s) |
30306.68 MByte/s (±24722.80 MByte/s) |
0.99 |
| Memset speed - (rust) block size 16777216 | 25755.98 MByte/s (±21494.84 MByte/s) |
29488.78 MByte/s (±24360.76 MByte/s) |
0.87 |
| alloc_benchmarks Build Time | 93.78 s |
92.78 s |
1.01 ❗ |
| alloc_benchmarks File Size | 0.89 MB |
0.94 MB |
0.95 ❗ |
| Allocations - Allocation success | 100.00 % |
100.00 % |
1 |
| Allocations - Deallocation success | 100.00 % |
100.00 % |
1 |
| Allocations - Pre-fail Allocations | 100.00 % |
100.00 % |
1 |
| Allocations - Average Allocation time | 9296.58 Ticks (±109.53 Ticks) |
9546.98 Ticks (±130.84 Ticks) |
0.97 ❗ |
| Allocations - Average Allocation time (no fail) | 9296.58 Ticks (±109.53 Ticks) |
9546.98 Ticks (±130.84 Ticks) |
0.97 ❗ |
| Allocations - Average Deallocation time | 904.88 Ticks (±423.12 Ticks) |
1180.86 Ticks (±623.01 Ticks) |
0.77 |
| mutex_benchmark Build Time | 93.92 s |
98.39 s |
0.95 ❗ |
| mutex_benchmark File Size | 0.97 MB |
0.97 MB |
1.01 ❗ |
| Mutex Stress Test Average Time per Iteration - 1 Threads | 12.86 ns (±0.60 ns) |
12.90 ns (±0.54 ns) |
1.00 |
| Mutex Stress Test Average Time per Iteration - 2 Threads | 13.10 ns (±0.67 ns) |
13.42 ns (±0.72 ns) |
0.98 |
This comment was automatically generated by workflow using github-action-benchmark.
ddbba05 to
6c0b8d6
Compare
fogti
commented
Jan 14, 2026
| prefix: Option<String>, | ||
| attr: FileAttr, | ||
| original_prefix: Arc<str>, | ||
| prefix: String, |
Contributor
Author
There was a problem hiding this comment.
It might be a good idea to instead only store the part in prefix that is actually "beyond" original_prefix.
fogti
commented
Jan 14, 2026
fogti
commented
Jan 14, 2026
ba1d3f4 to
34a1489
Compare
fogti
commented
Jan 27, 2026
Comment on lines
+1167
to
+1179
| let mut prefix = self.prefix.clone(); | ||
| // this part prevents inserting double-slashes or no slashes between prefix and path | ||
| if !path.is_empty() { | ||
| if let Some(x) = path.strip_prefix("/") { | ||
| path = x; | ||
| } else { | ||
| return Err(Errno::Nosys); | ||
| } | ||
| if !prefix.is_empty() { | ||
| prefix.push('/'); | ||
| } | ||
| } | ||
| prefix.push_str(path); |
Contributor
Author
There was a problem hiding this comment.
This is new, and should be specifically reviewed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I realized that by "just" factoring out all path traversal handling, I don't even need to introduce an
std::path::Pathequivalent.The afaik only disadvantage that this has is the re-allocations during traversal into
fuseanduhyvefilesystems.