From e5a0383bfff3b38930cfaa20417a0f797ffea4b8 Mon Sep 17 00:00:00 2001 From: edef Date: Fri, 29 Jul 2022 20:26:16 +0000 Subject: ripple/minitrace: verify mmap/mprotect page alignment Change-Id: If0d0d68264a2395c7ee746b5bca0c794ca4e4d65 --- ripple/minitrace/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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: _, -- cgit 1.4.1