A web tool to visualize page tables, early draft.
Page table basics are commonly taught in university courses and labs as well as strategies to handle their size and applied in the wider context of generally managing memory.
Students learn what the entries in page tables look like, usually with a given architecture to simplify the example, and how a memory management unit (MMU) translates a virtual address (VA) into a physical address (PA). When page tables are explained, it is common to omit tables not involved in the translation of the given VA, i.e., only one table per level is drawn, since otherwise there is not enough space. However, that may limit the understanding somewhat.
The goal of this tool is to help understand the tables themselves and quickly look at different architectures. The exact how is not clear at this point. Unlike a sketch on a chalkboard, a digital approach allows for having more context nevertheless, since the virtual canvas we draw on is infinite and we can hide and show parts as we please, offering toggles and many other controls.
We do not want to get down do the detail of addressing a single byte, since that is commonly a simple offset once a physical page is found and too much to show.
Page tables are tricky to organize in a way such that constructing VAs and using the phyiscal pages becomes efficient and secure. Note that the page table setup has implications on managing the page tables themselves, both in terms of bookkeeping and updating them during memory allocation and process termination. FreeBSD has an article explaining why the design is hard and how theirs evolved over time. Bear in mind that this article is from the year 2000 and some things differ today from what is described therein.
There are multiple ways to define page tables, each ISA being a bit different, possibly offering different variants (schemes), e.g. RISC-V's SV32, SV39, etc.
At the same time, there are different ways to use page tables. For example, the Hypatia hypervisor proposes recursive page tables. Linux documents its specific setups per architecture, such as on RISC-V and on x86.
Finally, there are multiple ways to look at and thus visualize page tables.
Here are some other projects looking at different aspects:
- http://publications.alex-ionescu.com/BlackHat/BlackHat%202013%20-%20Visualizing%20Page%20Tables%20for%20Hacking%20Like%20in%20the%20Movies.pdf
- Presentation: https://media.blackhat.com/us-13/US-13-Wicherski-Hacking-like-in-the-Movies-Visualizing-Page-Tables-WP.pdf
- Based on https://binvis.io/ / https://corte.si/posts/visualisation/binvis/
- Security view on how pages are marked RWX etc
This is a Next.js project bootstrapped with
create-next-app
.
To run the development server:
npm start
Here is a first example screenshot:
Refer to the Next.js documentation for more.