summary refs log tree commit diff
path: root/ripple/minitrace/src
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-07-29 20:26:16 +0000
committeredef <edef@unfathomable.blue>2022-07-29 20:26:16 +0000
commite5a0383bfff3b38930cfaa20417a0f797ffea4b8 (patch)
tree08f86e7fa06b892f7a9db6565b1a6c122c757f97 /ripple/minitrace/src
parent70720e1d46601069afb5fa1b6030c723c2cc492c (diff)
downloadunf-legacy-e5a0383bfff3b38930cfaa20417a0f797ffea4b8.tar.zst
ripple/minitrace: verify mmap/mprotect page alignment
Change-Id: If0d0d68264a2395c7ee746b5bca0c794ca4e4d65
Diffstat (limited to 'ripple/minitrace/src')
-rw-r--r--ripple/minitrace/src/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs
index 4bd544f..24737b0 100644
--- a/ripple/minitrace/src/main.rs
+++ b/ripple/minitrace/src/main.rs
@@ -447,13 +447,16 @@ const AT_FDCWD: i32 = -100;
 fn check_syscall(entry: &SyscallEntry) -> bool {
 	match *entry {
 		SyscallEntry::mmap {
-			addr: _,
+			addr,
 			len: _,
 			prot: _,
 			flags,
 			fd,
 			off: _,
 		} => {
+			if addr % 4096 != 0 {
+				return false;
+			}
 			if fd == !0 {
 				return flags.contains(MapFlags::ANONYMOUS);
 			} else {
@@ -461,6 +464,9 @@ fn check_syscall(entry: &SyscallEntry) -> bool {
 					== MapFlags::PRIVATE;
 			}
 		}
+		SyscallEntry::mprotect { addr, len, prot: _ } => {
+			return addr % 4096 == 0 && len % 4096 == 0;
+		}
 		SyscallEntry::access {
 			ref filename,
 			mode: _,