Skip to content

Fix: Harden clock interception safety, improve documentation, and enforce CI regression coverage - #9

Open
mertcano wants to merge 2 commits into
SubzeroLabs:mainfrom
mertcano:mertcano-patch-3
Open

Fix: Harden clock interception safety, improve documentation, and enforce CI regression coverage#9
mertcano wants to merge 2 commits into
SubzeroLabs:mainfrom
mertcano:mertcano-patch-3

Conversation

@mertcano

Copy link
Copy Markdown

Description

This PR addresses memory layout safety, documentation maintainability, and testing gaps within the deterministic-simulator repository, as identified in the workspace-wide security audit.

Quality & Security Defects Remediated:

  • Clock Interceptor Memory/Layout Safety (msim/src/sim/time/mod.rs): The Linux monotonic-clock path previously relied on a dangerous transmute operation to convert the opaque std::time::Instant representation directly into libc::timespec. This unstable ABI contract led to invalid timestamp failures under the current Rust toolchain. The interceptor has been refactored to safely and explicitly serialize the simulated duration into the tv_sec and tv_nsec fields.

  • Documentation and Maintainability (msim/src/sim/runtime/mod.rs): Existing inline code comments and documentation have been normalized into complete, grammatically correct English sentences. This improves code readability and ensures better maintainability for future development.

  • Regression Coverage and CI Masking (.github/workflows/ci.yml): The exclusions for the TCP hangup-read tests have been removed from the CI configuration. By re-enabling these tests, the recently repaired TCP connection liveness behavior is now strictly enforced and automatically validated on every future pull request.

…orce CI regression coverage

### Description
This PR addresses memory layout safety, documentation maintainability, and testing gaps within the `deterministic-simulator` repository, as identified in the workspace-wide security audit.

**Quality & Security Defects Remediated:**

* **Clock Interceptor Memory/Layout Safety (`msim/src/sim/time/mod.rs`):** 
  The Linux monotonic-clock path previously relied on a dangerous `transmute` operation to convert the opaque `std::time::Instant` representation directly into `libc::timespec`. This unstable ABI contract led to invalid timestamp failures under the current Rust toolchain. The interceptor has been refactored to safely and explicitly serialize the simulated duration into the `tv_sec` and `tv_nsec` fields.

* **Documentation and Maintainability (`msim/src/sim/runtime/mod.rs`):** 
  Existing inline code comments and documentation have been normalized into complete, grammatically correct English sentences. This improves code readability and ensures better maintainability for future development.

* **Regression Coverage and CI Masking (`.github/workflows/ci.yml`):** 
  The exclusions for the TCP hangup-read tests have been removed from the CI configuration. By re-enabling these tests, the recently repaired TCP connection liveness behavior is now strictly enforced and automatically validated on every future pull request.
Removed exclusions for TCP hangup tests to ensure all tests run, enforcing repaired liveness behavior in simulated CI.
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