Linux Kernel /proc/*/mem Pseudofile: Understanding Punch Through Semantics for Unwritable Memory
By
medbar
A baker's-dozen of insight crammed into one ring.
Summary
This article explores the Linux kernel's /proc/*/mem pseudofile and its unique 'punch through' semantics that allow writes to succeed even when destination virtual memory is marked unwritable. The behavior is intentional and used by projects like Julia JIT compiler and rr debugger. The article examines the relationship between kernel memory access and hardware virtual memory permissions, questioning to what degree hardware can inhibit kernel memory access.
Key quotes
· 3 pulledWrites performed through this file will succeed even if the destination virtual memory is marked unwritable.
This behavior is intentional and actively used by projects such as the Julia JIT compiler and rr debugger.
Is privileged code subject to virtual memory permissions? In general, to what degree can the hardware inhibit kernel memory access?
You might also wanna read
Restartable Sequences: A Linux Kernel Feature for Lock-Free Thread-Safe Programming
This article explores restartable sequences (rseq), a Linux kernel feature introduced in version 4.18 (circa 2018) that enables creation of
Linux Kernel Development: Introducing the Swap Table for Modernized Memory Management
The article discusses a new Linux kernel feature called the 'swap table' that aims to modernize the swap subsystem. The swap subsystem is de
Challenges of Implementing Linux Kernel's READ_ONCE() and WRITE_ONCE() Macros in Rust
The article discusses the challenges of implementing READ_ONCE() and WRITE_ONCE() macros from the Linux kernel in Rust code. These macros ar
Zig Days: Collaborative Full-Day Programming Events for the Zig Community
Zig Days are full-day collaborative programming events organized by the Zig community, typically held on Saturdays. Participants meet in the
Spectre Programming Language Documentation: A Contract-Based Approach to Safe Low-Level Systems Programming
Spectre is a contract-based programming language designed for safe low-level systems programming. It enforces correctness through type-level
Linux kernel patch proposes per-function "killswitch" for runtime short-circuit mitigation
A Linux kernel patch proposal by Sasha Levin introduces a "killswitch" mechanism — a per-function short-circuit mitigation primitive designe
