-- Leo's gemini proxy

-- Connecting to gemini.tuxmachines.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en-GB

Tux Machines


mimmutable() for OpenBSD


Posted by Roy Schestowitz on Dec 22, 2022


NuTyX 22.12.0 available with cards 2.6.3

Tokodon 22.11.2 release


Virtual-memory systems provide a great deal of flexibility in how memory can be mapped and protected. Unfortunately, memory-management flexibility can also be useful to attackers bent on compromising a system. In the OpenBSD world, a new system call is being added to reduce this flexibility; it is, though, a system call that almost no code is expected to use.


[...]


A call to mimmutable() will render the mapping of the len bytes of memory starting at addr immutable, meaning that the kernel will not allow any changes to either the memory protections or the mapping in that range. As a result, system calls like mmap() or mprotect() that would affect that range will, instead, fail.


At first glance, mimmutable() looks similar in spirit to OpenBSD's pledge(), which restricts the system calls that the calling process may use. But, while pledge() calls appear in numerous programs in the OpenBSD repository, mimmutable() calls will be rare indeed. Most developers lack a detailed understanding of the memory layout of their programs and are not well placed to render portions of their address space immutable, but the kernel and the linker are a different story.


The details of how mimmutable() will be used are described in detail in this email from De Raadt. In simplified form, it starts when the kernel loads a new executable image; once the text, stack, and data areas have been mapped, they will be made immutable before the program even starts running. For static binaries, the C runtime will do a bit of fixup and then use mimmutable() to make most of the rest of the mapped address space immutable as well. For dynamically linked binaries, the shared-library linker (ld.so) performs a similar set of tasks, mapping each library into the address space, then making most of those mappings immutable.


Read on


↺ Read On: LWN


Also: Valuable News – 2022/12/19 ["The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems."]


↺ Valuable News – 2022/12/19




gemini.tuxmachines.org

-- Response ended

-- Page fetched on Sat Jun 1 06:39:13 2024