summary refs log tree commit diff
path: root/ripple/minitrace
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-02-08 01:40:23 +0000
committeredef <edef@unfathomable.blue>2022-02-08 02:32:05 +0000
commitf7422d4616a8a1deb4516ca5022f4df4bc58a017 (patch)
treeec71a0f1831aa389fa0209be9e3c0f003d674017 /ripple/minitrace
parent06aacbdde07209337c1faad0e0763d3c093400c6 (diff)
ripple/minitrace: ensure openat calls use AT_FDCWD only
Co-authored-by: V <v@unfathomable.blue>
Change-Id: I32ca1947fc9278bdee1b0a8acdc8d5d66b61d736
Diffstat (limited to 'ripple/minitrace')
-rw-r--r--ripple/minitrace/src/main.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs
index f015bf9..5fa35da 100644
--- a/ripple/minitrace/src/main.rs
+++ b/ripple/minitrace/src/main.rs
@@ -1,4 +1,5 @@
 // SPDX-FileCopyrightText: edef <edef@unfathomable.blue>
+// SPDX-FileCopyrightText: V <v@unfathomable.blue>
 // SPDX-License-Identifier: OSL-3.0
 
 use {
@@ -13,7 +14,7 @@ use {
 		},
 		unistd::Pid,
 	},
-	std::{env, os::unix::process::CommandExt, process::Command},
+	std::{convert::TryInto, env, os::unix::process::CommandExt, process::Command},
 };
 
 // TODO(edef): consider implementing this in terms of TID?
@@ -234,7 +235,14 @@ fn check_syscall(entry: SyscallEntry) -> bool {
 		231 => {}
 
 		// openat
-		257 => {}
+		257 => {
+			let [dirfd, _pathname, _flags, _mode, _, _] = entry.args;
+			const AT_FDCWD: i32 = -100;
+
+			if dirfd.try_into() == Ok(AT_FDCWD) {
+				return false;
+			}
+		}
 
 		// newfstatat
 		262 => {}