Skip to content

Memory management improvements

Jacob Lorentzon requested to merge 4lDO2/kernel:mmap_contiguous into master

This replaces the physalloc and physfree syscalls with another memory: API. This fixes several memory hacks the memory manager had to use, such as ignoring the frame refcount in certain places, and where kernel memory corruption could be caused by driver misuse of the physalloc APIs. All frames are thus properly counted, and this can be checked using cat sys:trigger_debugger. It also fixes a minor memory leak, and a (trivially fixable) kernel panic when running acid scheme_data_leak. The by far most significant benefit, is that the kernel will now EPERM any requests to physically borrow memory, that overlaps with any allocator-owned memory, thus preventing e.g. ACPI AML from reading anything apart from device memory (if that turns out to be too restrictive, that only requires one line to revert).

Blocked on drivers!122 (merged)

Closes #135 (closed)

Edited by Jacob Lorentzon

Merge request reports