Skip to content

Commit

Permalink
findings
Browse files Browse the repository at this point in the history
  • Loading branch information
meowjesty committed Aug 28, 2024
1 parent de99caf commit 6e0a585
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
27 changes: 15 additions & 12 deletions mirrord/layer/src/go/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
25 changes: 14 additions & 11 deletions mirrord/layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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) };
Expand All @@ -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"),
Expand Down

0 comments on commit 6e0a585

Please sign in to comment.