Skip to content

Commit

Permalink
Remove PROT_EXEC on mprotect.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel-Durov committed Mar 29, 2024
1 parent 86e404b commit 3725c71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ykrt/src/trace/swt/patch.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use libc::{mprotect, size_t, sysconf, PROT_EXEC, PROT_READ, PROT_WRITE};
use libc::{mprotect, size_t, sysconf, PROT_READ, PROT_WRITE};
use std::mem;
use std::{ffi::c_void, sync::Once};

Expand Down Expand Up @@ -50,7 +50,7 @@ unsafe fn patch_function(function_ptr: usize, code: *const u8, size: size_t) {
let result = mprotect(
func_address,
page_size_aligned,
PROT_READ | PROT_WRITE | PROT_EXEC,
PROT_READ | PROT_WRITE,
);
if result != 0 {
panic!("Failed to change memory protection to be writable");
Expand Down

0 comments on commit 3725c71

Please sign in to comment.