-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): check-clock-usage — enforce the wall-clock allowlist #1861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b3325db
refactor(engine)!: unique names are minted, never read off a wall clock
tato123 11af21a
feat(ci): check-clock-usage enforces the wall-clock allowlist
tato123 2c23ac0
docs(plan): record what the check-clock-usage guard actually landed as
tato123 5939e84
fix(ci): the clock gate refuses prose it cannot delimit
tato123 92319a4
fix(engine): the mint rides the uuid the engine already links
tato123 1815158
fix(ci): the clock gate sees the syscall a session would actually copy
tato123 999fdbf
fix(engine): test sockets take a TempDir, not a long unique name
tato123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
73 changes: 73 additions & 0 deletions
73
runtime/streamlib-engine/src/core/machine_global_unique_name.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // Copyright (c) 2025 Jonathan Fontanez | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
|
|
||
| //! Unique-name minting for machine-global namespaces. | ||
| //! | ||
| //! iceoryx2 service names live in `/dev/shm`, which is machine-global and | ||
| //! outlives the process that created an entry. A name that collides with a | ||
| //! concurrent process — or with a stale entry an earlier run left behind after | ||
| //! the pid was recycled — surfaces as `DoesNotSupportRequestedMinBufferSize` | ||
| //! against the wrong service, not as a clean failure. | ||
| //! | ||
| //! Nothing minted here is a timestamp. A v4 UUID's 122 random bits make every | ||
| //! mint distinct across processes, across runs and across reboots, so no clock | ||
| //! is read and no counter is kept. The pid prefix is diagnostic: it is what lets | ||
| //! someone reading a stale `/dev/shm` entry or a leftover `/tmp` file name the | ||
| //! process that left it. | ||
| //! | ||
| //! The suffix carries no separator a path or a file name would reject, so the | ||
| //! caller composes it into whatever naming convention its namespace uses. | ||
|
|
||
| use uuid::Uuid; | ||
|
|
||
| /// A `<pid>-<uuid>` suffix no concurrent process, and no earlier run, can | ||
| /// collide with. | ||
| pub fn mint_machine_global_unique_name_suffix() -> String { | ||
| format!("{}-{}", std::process::id(), Uuid::new_v4()) | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use std::collections::HashSet; | ||
|
|
||
| #[test] | ||
| fn successive_mints_never_repeat() { | ||
| let minted: HashSet<String> = (0..10_000) | ||
| .map(|_| mint_machine_global_unique_name_suffix()) | ||
| .collect(); | ||
| assert_eq!(minted.len(), 10_000, "two mints collided"); | ||
| } | ||
|
|
||
| /// The pid is a fixed prefix within one process, so distinctness can only | ||
| /// come from the UUID — this fails if that component is ever dropped or | ||
| /// made constant, which a whole-string equality test does not catch. | ||
| #[test] | ||
| fn the_uuid_component_is_what_differs_between_two_mints() { | ||
| let first = mint_machine_global_unique_name_suffix(); | ||
| let second = mint_machine_global_unique_name_suffix(); | ||
|
|
||
| let pid_prefix = format!("{}-", std::process::id()); | ||
| let first_uuid = first.strip_prefix(&pid_prefix).expect(&first); | ||
| let second_uuid = second.strip_prefix(&pid_prefix).expect(&second); | ||
|
|
||
| assert_ne!(first_uuid, second_uuid); | ||
| assert!( | ||
| Uuid::parse_str(first_uuid).is_ok(), | ||
| "a stale entry stays traceable only while the suffix parses: {first}" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn carries_no_separator_a_path_or_file_name_would_reject() { | ||
| let minted = mint_machine_global_unique_name_suffix(); | ||
| assert!( | ||
| !minted.contains(['/', '\\', '.', ' ']), | ||
| "callers compose this into iceoryx2 service paths and into file names: {minted}" | ||
| ); | ||
| assert!( | ||
| minted.starts_with(&format!("{}-", std::process::id())), | ||
| "a stale entry names the process that left it: {minted}" | ||
| ); | ||
| } | ||
| } | ||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.