From 01f798f2b2139f28c5a28de51c6ba90cd2a7c2f6 Mon Sep 17 00:00:00 2001 From: edef Date: Wed, 27 Jul 2022 03:09:59 +0000 Subject: ripple/minitrace: fix newfstatat dirfd handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same bug as Ied63822001c8700fc71c89ec16d18036fbc33972, hiding missing behaviour around dirfd. newfstatat(AT_FDCWD, path, …) is used, as is newfstatat(fd, "", …). Change-Id: I03b9dc5118d7a47514abef82c4a577e8362fbb4d --- ripple/minitrace/src/main.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'ripple/minitrace') 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 -- cgit 1.4.1