Theo de Raadt has added a series of patches to the OpenBSD codebase for extra protection of process memory in user space. Developers are offered a new system call and its eponymous library function mimmutable, which allows for the locking of access rights during memory mappings. Once locked, the rights set for the memory area, such as a prohibition on writing and execution, cannot be altered through subsequent calls to the mmap(), mprotect(), and munmap() functions, which will return an EPERM error when modification is attempted.
To control the ability to change the access rights of mapped memory for object files, a new section Mutable BSS (.openbsd.mutable, Mutable Block Starting Symbol) has been proposed, along with new flags PF_MUTABLE and UVM_ET_IMMUTABLE. The linker has been updated to support the definition of the 'openbsd.mutable' sections and place them in a separate area of the BSS, aligned to the page boundary. Through the mimmutable function call, all mapped areas can be marked as immutable, except for the sections flagged as 'openbsd.mutable.' This new capability will be delivered to users in the OpenBSD 7.3 release.
Source: opennet.ru
