Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions h_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,8 @@ static void regions_quarantine_deallocate_pages(void *p, size_t size, size_t gua
if (unlikely(memory_purge(p, size))) {
memset(p, 0, size);
}

memory_protect_none(p, size);
} else {
memory_set_name(p, size, "malloc large quarantine");
}
Expand Down
4 changes: 4 additions & 0 deletions memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ static bool memory_protect_prot(void *ptr, size_t size, int prot, UNUSED int pke
return ret;
}

bool memory_protect_none(void *ptr, size_t size) {
return memory_protect_prot(ptr, size, PROT_NONE, -1);
}

bool memory_protect_ro(void *ptr, size_t size) {
return memory_protect_prot(ptr, size, PROT_READ, -1);
}
Expand Down
1 change: 1 addition & 0 deletions memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bool memory_map_fixed(void *ptr, size_t size);
bool memory_map_fixed_mte(void *ptr, size_t size);
#endif
bool memory_unmap(void *ptr, size_t size);
bool memory_protect_none(void *ptr, size_t size);
bool memory_protect_ro(void *ptr, size_t size);
bool memory_protect_rw(void *ptr, size_t size);
bool memory_protect_rw_metadata(void *ptr, size_t size);
Expand Down