-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add --fail-path #4
base: master
Are you sure you want to change the base?
Conversation
|
||
struct ChildInfo { | ||
in_syscall: bool, | ||
} | ||
|
||
fn decode_syscall_args(regs: libc::user_regs_struct) -> RawSyscall { | ||
fn decode_syscall_args(regs: &libc::user_regs_struct) -> RawSyscall { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needless reference here, because this struct implements Copy.
@@ -21,3 +21,4 @@ anyhow = "1.0.14" | |||
rstack = {version = "0.3.1", default-features = false, features = ["unwind"]} | |||
rustc-demangle = "0.1.16" | |||
cpp_demangle = "0.2.13" | |||
rand = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rand = "" | |
rand = "0.7.3" |
@@ -196,6 +199,10 @@ fn main() -> anyhow::Result<()> { | |||
eprintln!("executable not provided"); | |||
exit(1); | |||
} | |||
opt.fail_path = match opt.fail_path { | |||
Some(path) => std::fs::canonicalize(path).ok(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why error is ignored here?
}; | ||
children.insert(pid.as_raw() as u32, ci2); | ||
let mut regs = regs; | ||
regs.rax = 39 /*getpid*/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comments that describe what's happening here
let mut out = RawSyscall { | ||
syscall_id: 0, | ||
args: [0; 6], | ||
ret: 0, | ||
}; | ||
out.ret = regs.rax; | ||
out.syscall_id = regs.orig_rax; | ||
out.syscall_id = regs.orig_rax & 0xffffffu64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?
|
||
fn return_eio(pid: Pid, regs: &mut libc::user_regs_struct, syscall: u64) -> Result<(), nix::Error> { | ||
regs.orig_rax = syscall; | ||
regs.rax = -(nix::errno::Errno::EIO as i32 as i64) as u64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is as i32
portion needed?
let def = magic.lookup_syscall_by_id(SyscallId(params.syscall_id as u32)); | ||
let child_pid = Pid::from_raw(pid as i32); | ||
let mut decoded_params = match def { | ||
Some(def) => process_syscall(¶ms, child_pid, magic, def), | ||
None => None, | ||
}; | ||
if started_syscall && decoded_params.is_some() && (params.syscall_id == 2 /*open*/ || params.syscall_id == 257 /*openat*/) { //TODO: x86_64 only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comment that describes what this if does.
Also, you should skip this entire if
if fail_path is disabled:
if let Some(fail_path) = &setting.fail_path {
// ...
}
No description provided.