Skip to content

Add --fail-path#4

Open
sleirsgoevy wants to merge 1 commit intoMikailBag:masterfrom
sleirsgoevy:master
Open

Add --fail-path#4
sleirsgoevy wants to merge 1 commit intoMikailBag:masterfrom
sleirsgoevy:master

Conversation

@sleirsgoevy
Copy link

No description provided.

}

fn decode_syscall_args(regs: libc::user_regs_struct) -> RawSyscall {
fn decode_syscall_args(regs: &libc::user_regs_struct) -> RawSyscall {
Copy link
Owner

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.

rstack = {version = "0.3.1", default-features = false, features = ["unwind"]}
rustc-demangle = "0.1.16"
cpp_demangle = "0.2.13"
rand = ""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rand = ""
rand = "0.7.3"

exit(1);
}
opt.fail_path = match opt.fail_path {
Some(path) => std::fs::canonicalize(path).ok(),
Copy link
Owner

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*/;
Copy link
Owner

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

};
out.ret = regs.rax;
out.syscall_id = regs.orig_rax;
out.syscall_id = regs.orig_rax & 0xffffffu64;
Copy link
Owner

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;
Copy link
Owner

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?

Some(def) => process_syscall(&params, 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
Copy link
Owner

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 {
   // ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants