From da51fae4c331f6a3bdd7926573b7514767e51a27 Mon Sep 17 00:00:00 2001 From: Michael Chesser Date: Fri, 22 Oct 2021 09:38:08 +1030 Subject: [PATCH] Rename executable to already_protected --- cranelift/jit/src/memory.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cranelift/jit/src/memory.rs b/cranelift/jit/src/memory.rs index 3a001ac59f..5adde6d3dc 100644 --- a/cranelift/jit/src/memory.rs +++ b/cranelift/jit/src/memory.rs @@ -109,7 +109,7 @@ impl Drop for PtrLen { /// program's life. pub(crate) struct Memory { allocations: Vec, - executable: usize, + already_protected: usize, current: PtrLen, position: usize, } @@ -118,7 +118,7 @@ impl Memory { pub(crate) fn new() -> Self { Self { allocations: Vec::new(), - executable: 0, + already_protected: 0, current: PtrLen::new(), position: 0, } @@ -158,7 +158,7 @@ impl Memory { #[cfg(feature = "selinux-fix")] { - for &PtrLen { ref map, ptr, len } in &self.allocations[self.executable..] { + for &PtrLen { ref map, ptr, len } in &self.allocations[self.already_protected..] { if len != 0 && map.is_some() { unsafe { region::protect(ptr, len, region::Protection::READ_EXECUTE) @@ -170,7 +170,7 @@ impl Memory { #[cfg(not(feature = "selinux-fix"))] { - for &PtrLen { ptr, len } in &self.allocations[self.executable..] { + for &PtrLen { ptr, len } in &self.allocations[self.already_protected..] { if len != 0 { unsafe { region::protect(ptr, len, region::Protection::READ_EXECUTE) @@ -180,7 +180,7 @@ impl Memory { } } - self.executable = self.allocations.len(); + self.already_protected = self.allocations.len(); } /// Set all memory allocated in this `Memory` up to now as readonly. @@ -189,7 +189,7 @@ impl Memory { #[cfg(feature = "selinux-fix")] { - for &PtrLen { ref map, ptr, len } in &self.allocations[self.executable..] { + for &PtrLen { ref map, ptr, len } in &self.allocations[self.already_protected..] { if len != 0 && map.is_some() { unsafe { region::protect(ptr, len, region::Protection::READ) @@ -201,7 +201,7 @@ impl Memory { #[cfg(not(feature = "selinux-fix"))] { - for &PtrLen { ptr, len } in &self.allocations[self.executable..] { + for &PtrLen { ptr, len } in &self.allocations[self.already_protected..] { if len != 0 { unsafe { region::protect(ptr, len, region::Protection::READ) @@ -211,14 +211,14 @@ impl Memory { } } - self.executable = self.allocations.len(); + self.already_protected = self.allocations.len(); } /// Frees all allocated memory regions that would be leaked otherwise. /// Likely to invalidate existing function pointers, causing unsafety. pub(crate) unsafe fn free_memory(&mut self) { self.allocations.clear(); - self.executable = 0; + self.already_protected = 0; } }