summary refs log tree commit diff
path: root/ripple
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-07-29 21:27:58 +0000
committeredef <edef@unfathomable.blue>2022-07-29 21:27:58 +0000
commit95440d3f5355791632adb389e2c4016b63c8d6c0 (patch)
tree2e4d35f5af1ff9bf7838994b5c6b3a99aa89140c /ripple
parente400322ef04999dfd58c444e622b6d7a8327e810 (diff)
downloadunf-legacy-95440d3f5355791632adb389e2c4016b63c8d6c0.tar.zst
ripple/minitrace: verify openat mode strictly
Change-Id: I943054765b764416ebe031535067dd3631c2ddaf
Diffstat (limited to 'ripple')
-rw-r--r--ripple/minitrace/src/main.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs
index 952aaf1..6d5dbc5 100644
--- a/ripple/minitrace/src/main.rs
+++ b/ripple/minitrace/src/main.rs
@@ -356,7 +356,7 @@ define_syscalls! {
 		fn arch_prctl(option: ArchOption, arg2: u64) -> i64 = 158;
 		fn set_tid_address(tidptr: *mut i32) -> i64 = 218;
 		fn exit_group(error_code: i32) -> i64 = 231;
-		fn openat(dfd: FileDesc, filename: CString, flags: OpenFlags, mode: u16) -> i64 = 257;
+		fn openat(dfd: FileDesc, filename: CString, flags: OpenFlags, mode: FileMode) -> i64 = 257;
 		fn newfstatat(dfd: FileDesc, filename: CString, statbuf: *mut Stat, flags: AtFlags) -> i64 = 262;
 		fn set_robust_list(head: *mut RobustListHead, len: usize) -> i64 = 273;
 		fn prlimit64(pid: i32, resource: ResourceLimit, new_rlim: *const RLimit64, old_rlim: *mut RLimit64) -> i64 = 302;
@@ -602,6 +602,20 @@ syscall_bitflags! {
 		const W = 1 << 1 => W_OK;
 		const R = 1 << 2 => R_OK;
 	}
+
+	struct FileMode: u32 {
+		const IRUSR = 0o400 => S_IRUSR;
+		const IWUSR = 0o200 => S_IWUSR;
+		const IXUSR = 0o100 => S_IXUSR;
+
+		const IRGRP = 0o040 => S_IRGRP;
+		const IWGRP = 0o020 => S_IWGRP;
+		const IXGRP = 0o010 => S_IXGRP;
+
+		const IROTH = 0o004 => S_IROTH;
+		const IWOTH = 0o002 => S_IWOTH;
+		const IXOTH = 0o001 => S_IXOTH;
+	}
 }
 
 syscall_enums! {