Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramha committed Oct 15, 2024
1 parent 120ef24 commit ce73f47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions mirrord/layer/src/exec_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ pub(crate) unsafe fn enable_macos_hooks(
#[mirrord_layer_macro::instrument(level = "trace")]
pub(super) fn patch_if_sip(path: &str) -> Detour<String> {
let patch_binaries = PATCH_BINARIES.get().expect("patch binaries not set");
// some binaries don't need to be sip patched, because they don't chain-execute (i.e we don't
// care about the commands they run) for example, "go run" needs to be sip patched because

Check warning on line 66 in mirrord/layer/src/exec_utils.rs

View workflow job for this annotation

GitHub Actions / lint

Diff in /home/runner/work/mirrord/mirrord/mirrord/layer/src/exec_utils.rs

Check warning on line 66 in mirrord/layer/src/exec_utils.rs

View workflow job for this annotation

GitHub Actions / lint

Diff in /home/runner/work/mirrord/mirrord/mirrord/layer/src/exec_utils.rs
// it builds then executes. but gcc never executes the binary, so we don't need to sip patch
// it.
const BYPASS_BINARIES: &[&str] = &[
"/uname",
];
if BYPASS_BINARIES.iter().any(|bin| path.ends_with(bin)) {
return Bypass(NoSipDetected(path.to_string()));
}
match sip_patch(path, patch_binaries) {
Ok(None) => Bypass(NoSipDetected(path.to_string())),
Ok(Some(new_path)) => Success(new_path),
Expand Down
6 changes: 5 additions & 1 deletion mirrord/layer/src/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ static BUILD_TOOL_PROCESSES: LazyLock<HashSet<&str>> = LazyLock::new(|| {
"link",
"math",
"cargo",
"clang",
"compile",
"hpack",
"rustc",
"compile",
"collect2",
"cargo-watch",
"debugserver",
"jspawnhelper",

Check warning on line 37 in mirrord/layer/src/load.rs

View workflow job for this annotation

GitHub Actions / lint

Diff in /home/runner/work/mirrord/mirrord/mirrord/layer/src/load.rs

Check warning on line 37 in mirrord/layer/src/load.rs

View workflow job for this annotation

GitHub Actions / lint

Diff in /home/runner/work/mirrord/mirrord/mirrord/layer/src/load.rs
"strip",
"dsymutil",

])
});

Expand Down

0 comments on commit ce73f47

Please sign in to comment.