Skip to content

fix: add size caps to fs_read and net_send/net_sendto - #60

Merged
danbugs merged 1 commit into
mainfrom
fix/size-caps
May 17, 2026
Merged

fix: add size caps to fs_read and net_send/net_sendto#60
danbugs merged 1 commit into
mainfrom
fix/size-caps

Conversation

@danbugs

@danbugs danbugs commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Caps fs_read at MAX_FS_READ (16 MiB) via metadata check before read_to_string, matching the existing protection on fs_read_bytes — prevents guest-triggered host OOM from large files
  • Adds MAX_NET_SEND (1 MiB) cap on decoded payload in net_send and net_sendto for defense-in-depth parity with the recv cap (65 KiB)
  • Adds test_fs_read_size_cap and test_net_send_size_cap tests

Test plan

  • cargo test --lib passes (53 tests)
  • cargo clippy clean
  • cargo fmt clean

Signed-off-by: danbugs <danilochiarlone@gmail.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux Benchmarks

Details
Benchmark suite Current: 3d13468 Previous: 86d2609 Ratio
hello_world (median) 20 ms 20 ms 1
pandas (median) 110 ms 110 ms 1
density (per VM) 7 MB 7 MB 1
snapshot (disk) 385 MiB 385 MiB 1

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows Benchmarks

Details
Benchmark suite Current: 3d13468 Previous: 86d2609 Ratio
hello_world (median) 301 ms 245 ms 1.23
pandas (median) 979 ms 725 ms 1.35
density (per VM) 6 MB 6 MB 1
snapshot (disk) 392 MiB 392 MiB 1

This comment was automatically generated by workflow using github-action-benchmark.

@danbugs
danbugs merged commit c9d37ee into main May 17, 2026
79 checks passed
@danbugs
danbugs deleted the fix/size-caps branch May 17, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant