-
Notifications
You must be signed in to change notification settings - Fork 172
fix(fspy): improve seccomp_unotify ipc #255
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
branchseer
merged 11 commits into
main
from
10-24-fix_fspy_fix_ipc_of_seccomp_filter_fd
Oct 25, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
045ce54
fix(fspy): fix ipc of seccomp filter fd
branchseer 752b10b
fix path overflow test
branchseer 58cf52d
add open_read test for static_executable
branchseer c8f8f4d
remove unused imports
branchseer e64860c
enable typeaware linting test on Linux
branchseer 19bdd89
remove dbg!
branchseer a9eb1b6
ci: add x86_64-unknown-linux-musl target
branchseer c330310
check ldd exit code
branchseer e00701c
ensure static executable using `fspy_shared_unix::is_dynamically_link…
branchseer a90e272
panic with detailed message in assert_contains
branchseer 687857f
handle syscall open in x86_64
branchseer 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #![cfg(target_os = "linux")] | ||
|
|
||
| use std::{ | ||
| fs::{self, Permissions}, | ||
| os::unix::fs::PermissionsExt as _, | ||
| path::{Path, PathBuf}, | ||
| sync::LazyLock, | ||
| }; | ||
|
|
||
| use fspy::PathAccessIterable; | ||
| use fspy_shared_unix::is_dynamically_linked_to_libc; | ||
|
|
||
| use crate::test_utils::assert_contains; | ||
|
|
||
| mod test_utils; | ||
|
|
||
| const TEST_BIN_CONTENT: &[u8] = include_bytes!(env!("CARGO_BIN_FILE_FSPY_TEST_BIN")); | ||
|
|
||
| fn test_bin_path() -> &'static Path { | ||
| static TEST_BIN_PATH: LazyLock<PathBuf> = LazyLock::new(|| { | ||
| assert_eq!( | ||
| is_dynamically_linked_to_libc(&TEST_BIN_CONTENT), | ||
| Ok(false), | ||
| "Test binary is not a static executable" | ||
| ); | ||
|
|
||
| let tmp_dir = env!("CARGO_TARGET_TMPDIR"); | ||
| let test_bin_path = PathBuf::from(tmp_dir).join("fspy-test-bin"); | ||
| fs::write(&test_bin_path, TEST_BIN_CONTENT).expect("failed to write test binary"); | ||
| fs::set_permissions(&test_bin_path, Permissions::from_mode(0o755)) | ||
| .expect("failed to set permissions on test binary"); | ||
|
|
||
| test_bin_path | ||
| }); | ||
| TEST_BIN_PATH.as_path() | ||
| } | ||
|
|
||
| async fn track_test_bin(args: &[&str]) -> PathAccessIterable { | ||
| let mut cmd = fspy::Spy::global().unwrap().new_command(test_bin_path()); | ||
| cmd.args(args); | ||
| let mut tracked_child = cmd.spawn().await.unwrap(); | ||
|
|
||
| let output = tracked_child.tokio_child.wait().await.unwrap(); | ||
| assert!(output.success()); | ||
|
|
||
| tracked_child.accesses_future.await.unwrap() | ||
| } | ||
|
|
||
| #[tokio::test] | ||
| async fn open_read() { | ||
| let accesses = track_test_bin(&["open_read", "/hello"]).await; | ||
| assert_contains(&accesses, Path::new("/hello"), fspy::AccessMode::Read); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,9 @@ | ||
| use std::os::fd::RawFd; | ||
| mod filter; | ||
| use bincode::{Decode, Encode}; | ||
| pub use filter::Filter; | ||
|
|
||
| #[derive(Debug, Encode, Decode, Clone)] | ||
| pub struct SeccompPayload { | ||
| pub(crate) ipc_fd: RawFd, | ||
| pub(crate) ipc_path: Vec<u8>, | ||
| pub(crate) filter: Filter, | ||
| } |
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.