diff --git a/mirrord/intproxy/protocol/src/lib.rs b/mirrord/intproxy/protocol/src/lib.rs index 8f256efc6ee..35d57c7153c 100644 --- a/mirrord/intproxy/protocol/src/lib.rs +++ b/mirrord/intproxy/protocol/src/lib.rs @@ -53,6 +53,21 @@ pub enum LayerToProxyMessage { GetEnv(GetEnvVarsRequest), } +/// Load Type of mirrord-layer +#[derive(Debug, Encode, Decode)] +pub enum LoadType { + /// Mirrord is loaded fully and layer should connect to agent + Full, + + /// Only load sip patch required hooks + #[cfg(target_os = "macos")] + SIPOnly, + + /// Skip on current process, make only a dummy connection to the internal proxy (to prevent + /// timeouts) + Skip, +} + /// Layer process information #[derive(Encode, Decode, Debug)] pub struct ProcessInfo { @@ -62,8 +77,8 @@ pub struct ProcessInfo { pub name: String, /// Command line pub cmdline: Vec, - /// Is layer loaded? - pub loaded: bool, + /// What kind if loading was done? + pub loaded: LoadType, } /// Unique `layer <-> proxy` session identifier. diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs index 59825cc20ba..086453c19aa 100644 --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -88,7 +88,7 @@ use mirrord_config::{ feature::{fs::FsModeConfig, network::incoming::IncomingMode}, LayerConfig, }; -use mirrord_intproxy_protocol::NewSessionRequest; +use mirrord_intproxy_protocol::{LoadType, NewSessionRequest}; use mirrord_layer_macro::{hook_fn, hook_guard_fn}; use mirrord_protocol::{EnvVars, GetEnvVarsRequest}; use proxy_connection::ProxyConnection; @@ -98,7 +98,6 @@ use tracing_subscriber::{fmt::format::FmtSpan, prelude::*}; use crate::{ common::make_proxy_request_with_response, debugger_ports::DebuggerPorts, detour::DetourGuard, - load::LoadType, }; mod common; diff --git a/mirrord/layer/src/load.rs b/mirrord/layer/src/load.rs index 649e82dd980..ffd4a672674 100644 --- a/mirrord/layer/src/load.rs +++ b/mirrord/layer/src/load.rs @@ -6,7 +6,7 @@ use std::{ }; use mirrord_config::LayerConfig; -use mirrord_intproxy_protocol::ProcessInfo; +use mirrord_intproxy_protocol::{LoadType, ProcessInfo}; use tracing::trace; use crate::error::LayerError; @@ -146,7 +146,7 @@ impl ExecuteArgs { .iter() .map(|arg| arg.to_string_lossy().to_string()) .collect(), - loaded: matches!(self.load_type(config), LoadType::Full), + loaded: self.load_type(config), } } } @@ -165,7 +165,7 @@ mod sip { use super::*; static SIP_ONLY_PROCESSES: LazyLock> = - LazyLock::new(|| HashSet::from(["sh", "bash", "env", "go", "dlv"])); + LazyLock::new(|| HashSet::from(["sh", "bash", "env", "go", "dlv", "cgo"])); pub fn is_sip_only(given_process: &ExecuteArgs) -> bool { given_process.is_build_tool() @@ -174,20 +174,6 @@ mod sip { } } -/// Load Type of mirrord-layer -pub enum LoadType { - /// Mirrord is loaded fully and layer should connect to agent - Full, - - /// Only load sip patch required hooks - #[cfg(target_os = "macos")] - SIPOnly, - - /// Skip on current process, make only a dummy connection to the internal proxy (to prevent - /// timeouts) - Skip, -} - #[cfg(test)] mod tests { use rstest::rstest;