summary refs log tree commit diff
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-07-08 14:11:38 +0000
committeredef <edef@unfathomable.blue>2022-07-08 14:11:38 +0000
commit74ca749704c53f96155a6411aca1077096a53b61 (patch)
tree893e2a8c31b02ac1c1eeea233e465fe8d796d4e4
parentdddd01d2d5636aa8ca8aceb3581595be6fa000c2 (diff)
ripple/minitrace: convert openat dirfd correctly
Our conversion always mangled it, *and* our comparison was inverted,
so both bugs remained hidden.

Change-Id: Ied63822001c8700fc71c89ec16d18036fbc33972
-rw-r--r--ripple/minitrace/src/main.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs
index ee09c99..bdf957d 100644
--- a/ripple/minitrace/src/main.rs
+++ b/ripple/minitrace/src/main.rs
@@ -286,7 +286,9 @@ fn check_syscall(process: &Process, entry: SyscallEntry) -> bool {
 		257 => {
 			let [dirfd, pathname, flags, _mode, ..] = entry.args;
 
-			if dirfd.try_into() == Ok(AT_FDCWD) {
+			let dirfd = u32::try_from(dirfd).map(|x| x as i32);
+
+			if dirfd != Ok(AT_FDCWD) {
 				return false;
 			}