about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-03-09 11:19:52 +0100
committerptitSeb <sebastien.chev@gmail.com>2025-03-09 11:19:52 +0100
commit41bee356344a25439c688338275ca7604961939c (patch)
tree7cc85ab5f5b76f62917ef64db5deb3e06894f0fa /src
parente764029cae2861a5a9e8c7f8185023df0baf6215 (diff)
downloadbox64-41bee356344a25439c688338275ca7604961939c.tar.gz
box64-41bee356344a25439c688338275ca7604961939c.zip
[DYNAREC] Fixed some potential issue with NEVERCLEAN on memory mapping tracking
Diffstat (limited to 'src')
-rw-r--r--src/custommem.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/custommem.c b/src/custommem.c
index 940280bf..51a14f61 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -1523,7 +1523,8 @@ void updateProtection(uintptr_t addr, size_t size, uint32_t prot)
         rb_get_end(memprot, cur, &oprot, &bend);
         if(bend>end) bend = end;
         uint32_t dyn=(oprot&PROT_DYN);
-        if(!(dyn&PROT_NEVERPROT)) {
+        uint32_t never = dyn&PROT_NEVERPROT;
+        if(!(never)) {
             if(dyn && (prot&PROT_WRITE)) {   // need to remove the write protection from this block
                 dyn = PROT_DYNAREC;
                 int ret = mprotect((void*)cur, bend-cur, prot&~PROT_WRITE);
@@ -1532,7 +1533,7 @@ void updateProtection(uintptr_t addr, size_t size, uint32_t prot)
                 dyn = PROT_DYNAREC_R;
             }
         }
-        uint32_t new_prot = prot?(prot|dyn):prot;
+        uint32_t new_prot = prot?(prot|dyn):(prot|never);
         if (new_prot != oprot)
             rb_set(memprot, cur, bend, new_prot);
         cur = bend;