From f7422d4616a8a1deb4516ca5022f4df4bc58a017 Mon Sep 17 00:00:00 2001 From: edef Date: Tue, 8 Feb 2022 01:40:23 +0000 Subject: ripple/minitrace: ensure openat calls use AT_FDCWD only Co-authored-by: V Change-Id: I32ca1947fc9278bdee1b0a8acdc8d5d66b61d736 --- ripple/minitrace/src/main.rs | 12 ++++++++++-- 1 file 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 +// SPDX-FileCopyrightText: V // 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 => {} -- cgit 1.4.1