From 6e0a585cbaa5aa3a44e0c47118dfee31eda75f5d Mon Sep 17 00:00:00 2001 From: meowjesty Date: Wed, 28 Aug 2024 18:39:56 -0300 Subject: [PATCH] findings --- mirrord/layer/src/go/mod.rs | 27 +++++++++++++++------------ mirrord/layer/src/lib.rs | 25 ++++++++++++++----------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/mirrord/layer/src/go/mod.rs b/mirrord/layer/src/go/mod.rs index 99937452a98..9dfef383e64 100644 --- a/mirrord/layer/src/go/mod.rs +++ b/mirrord/layer/src/go/mod.rs @@ -29,17 +29,17 @@ unsafe extern "C" fn c_abi_syscall6_handler( param5: i64, param6: i64, ) -> i64 { - trace!( - "c_abi_syscall6_handler: syscall={} param1={} param2={} param3={} param4={} param5={} - param6={}", - syscall, - param1, - param2, - param3, - param4, - param5, - param6 - ); + // trace!( + // "c_abi_syscall6_handler: syscall={} param1={} param2={} param3={} param4={} param5={} + // param6={}", + // syscall, + // param1, + // param2, + // param3, + // param4, + // param5, + // param6 + // ); let syscall_result = match syscall { libc::SYS_accept4 => { accept4_detour(param1 as _, param2 as _, param3 as _, param4 as _) as i64 @@ -50,7 +50,10 @@ unsafe extern "C" fn c_abi_syscall6_handler( libc::SYS_accept => accept_detour(param1 as _, param2 as _, param3 as _) as i64, libc::SYS_close => close_detour(param1 as _) as i64, libc::SYS_connect => connect_detour(param1 as _, param2 as _, param3 as _) as i64, - libc::SYS_dup3 => dup3_detour(param1 as _, param2 as _, param3 as _) as i64, + libc::SYS_dup3 => { + // trace!("292"); + dup3_detour(param1 as _, param2 as _, param3 as _) as i64 + } _ if crate::setup().fs_config().is_active() => { match syscall { diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs index ad3b05e34ed..7788da97fb9 100644 --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -509,13 +509,14 @@ fn enable_hooks(state: &LayerSetup) { FN___CLOSE_NOCANCEL ); - replace!( - &mut hook_manager, - "__close", - __close_detour, - Fn__close, - FN___CLOSE - ); + // TODO(alex) [high]: 1. It's this one! + // replace!( + // &mut hook_manager, + // "__close", + // __close_detour, + // Fn__close, + // FN___CLOSE + // ); // Solve leak on uvloop which calls the syscall directly. #[cfg(target_os = "linux")] @@ -532,7 +533,8 @@ fn enable_hooks(state: &LayerSetup) { replace!(&mut hook_manager, "fork", fork_detour, FnFork, FN_FORK); }; - unsafe { socket::hooks::enable_socket_hooks(&mut hook_manager, enabled_remote_dns) }; + // TODO(alex) [high]: 2. It's this one (also breaks)! + // unsafe { socket::hooks::enable_socket_hooks(&mut hook_manager, enabled_remote_dns) }; if cfg!(target_os = "macos") || state.experimental().enable_exec_hooks_linux { unsafe { exec_hooks::hooks::enable_exec_hooks(&mut hook_manager) }; @@ -550,9 +552,10 @@ fn enable_hooks(state: &LayerSetup) { } } - if enabled_file_ops { - unsafe { file::hooks::enable_file_hooks(&mut hook_manager) }; - } + // TODO(alex) [high]: 3. It's this one (also breaks)! + // if enabled_file_ops { + // unsafe { file::hooks::enable_file_hooks(&mut hook_manager) }; + // } #[cfg(all( any(target_arch = "x86_64", target_arch = "aarch64"),