summary refs log tree commit diff
path: root/ripple/minitrace
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-07-29 16:56:01 +0000
committeredef <edef@unfathomable.blue>2022-07-29 16:56:01 +0000
commitf3ca081e2d4eb1aee45f94fa8977aa7a7807a613 (patch)
tree51855ac36c497c5b8756195fdd278940283b76a9 /ripple/minitrace
parenta9e029f74f58631471c3edfc237fe89fedc368d3 (diff)
downloadunf-legacy-f3ca081e2d4eb1aee45f94fa8977aa7a7807a613.tar.zst
ripple/minitrace: don't impl Copy for SyscallEntry
We'd like to be able to have heap-allocated syscall data,
which means we can't impl Copy.

Change-Id: Ib40dcaf7f99baeaae0dae1153e80deae88d76978
Diffstat (limited to 'ripple/minitrace')
-rw-r--r--ripple/minitrace/src/main.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs
index 7ba6f96..eaabad0 100644
--- a/ripple/minitrace/src/main.rs
+++ b/ripple/minitrace/src/main.rs
@@ -97,7 +97,7 @@ macro_rules! define_syscalls {
 	(enum $SyscallEntry:ident {
 		$(fn $syscall:ident ( $($arg:ident : $Arg:ty),* ) -> $Ret:ty = $nr:literal ;)*
 	}) => {
-		#[derive(Debug, Copy, Clone)]
+		#[derive(Debug, Clone)]
 		#[allow(non_camel_case_types)]
 		// TODO(edef): re-enable dead_code lint when we start fully interpreting syscall args
 		#[allow(dead_code)]
@@ -278,7 +278,7 @@ define_syscalls! {
 	}
 }
 
-#[derive(Debug, Copy, Clone)]
+#[derive(Debug, Clone)]
 enum EntryExit {
 	/// Process is about to enter a syscall
 	Entry(SyscallEntry),
@@ -336,12 +336,12 @@ fn main() -> Result<()> {
 					}
 				};
 
-				syscall_state = Some(EntryExit::Entry(entry));
-
-				if !check_syscall(&process, entry) {
+				if !check_syscall(&process, &entry) {
 					ptrace::kill(event_tid.as_pid())?;
 					panic!("invalid syscall {entry:?}");
 				}
+
+				syscall_state = Some(EntryExit::Entry(entry));
 			}
 			(Some(EntryExit::Entry(entry)), WaitStatus::PtraceSyscall(event_tid)) => {
 				let event_tid = Tid(event_tid.as_raw());
@@ -358,7 +358,9 @@ fn main() -> Result<()> {
 				// TODO(edef): this only works for main thread
 				break;
 			}
-			_ => panic!("unknown status {status:?} with syscall_state = {syscall_state:?}"),
+			(syscall_state, status) => {
+				panic!("unknown status {status:?} with syscall_state = {syscall_state:?}")
+			}
 		}
 	}
 
@@ -367,8 +369,8 @@ fn main() -> Result<()> {
 
 const AT_FDCWD: i32 = -100;
 
-fn check_syscall(process: &Process, entry: SyscallEntry) -> bool {
-	match entry {
+fn check_syscall(process: &Process, entry: &SyscallEntry) -> bool {
+	match *entry {
 		SyscallEntry::mmap {
 			addr: _,
 			len: _,