mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-24 00:41:11 -04:00
linux: make use of mseal(2)
Instead of protecting the global read-only data structure after startup via the read-only flag, which can be reverted, use the in Linux 6.10 introduced irreversible syscall mseal(2).
This commit is contained in:
parent
749640c274
commit
96836f463b
3 changed files with 24 additions and 0 deletions
|
@ -1285,7 +1285,12 @@ COLD static void init_slow_path(void) {
|
|||
|
||||
atomic_store_explicit(&ro.slab_region_end, slab_region_end, memory_order_release);
|
||||
|
||||
#if defined(__ANDROID__) && defined(HAS_ARM_MTE)
|
||||
/* Do not seal to support disabling memory tagging */
|
||||
if (unlikely(memory_protect_ro(&ro, sizeof(ro)))) {
|
||||
#else
|
||||
if (unlikely(memory_protect_seal(&ro, sizeof(ro)))) {
|
||||
#endif
|
||||
fatal_error("failed to protect allocator data");
|
||||
}
|
||||
memory_set_name(&ro, sizeof(ro), "malloc read-only after init");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue