diff options
author | edef <edef@unfathomable.blue> | 2022-07-27 03:09:59 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-07-27 03:09:59 +0000 |
commit | 01f798f2b2139f28c5a28de51c6ba90cd2a7c2f6 (patch) | |
tree | 437f3f27360d9b2eba7800bcf6d464f487705056 /ripple | |
parent | 74ca749704c53f96155a6411aca1077096a53b61 (diff) | |
download | unf-legacy-01f798f2b2139f28c5a28de51c6ba90cd2a7c2f6.tar.zst |
ripple/minitrace: fix newfstatat dirfd handling
Same bug as Ied63822001c8700fc71c89ec16d18036fbc33972, hiding missing behaviour around dirfd. newfstatat(AT_FDCWD, path, …) is used, as is newfstatat(fd, "", …). Change-Id: I03b9dc5118d7a47514abef82c4a577e8362fbb4d
Diffstat (limited to 'ripple')
-rw-r--r-- | ripple/minitrace/src/main.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs index bdf957d..cd69094 100644 --- a/ripple/minitrace/src/main.rs +++ b/ripple/minitrace/src/main.rs @@ -304,13 +304,16 @@ fn check_syscall(process: &Process, entry: SyscallEntry) -> bool { 262 => { let [dirfd, pathname, _statbuf, _flags, ..] = entry.args; - if dirfd.try_into() == Ok(AT_FDCWD) { - return false; - } - + let dirfd = u32::try_from(dirfd).map(|x| x as i32); let pathname = process.read_mem_cstr(pathname).unwrap(); - println!("newfstatat(AT_FDCWD, {:?}, ..)", pathname); + if dirfd == Ok(AT_FDCWD) { + println!("newfstatat(AT_FDCWD, {:?}, ..)", pathname); + } else if pathname.as_bytes() == b"" { + println!("newfstatat({dirfd}, {:?}, ..)", pathname); + } else { + return false; + } } // set_robust_list |