# Explicit prefaulting: bounded Linux observation

Eight ordered cases, three repetitions, one host. New anonymous mappings compare
read-only and read/write protections. An automatically deleted one-page scratch
file filled with P supplies private one-page and shared two-page mappings.
The probe never dereferences the second page beyond EOF.

## Reproduce
Supported reproduction target: Linux 5.14 or later on x86_64. Requires Python 3,
util-linux `findmnt`, and readable `/proc/self/pagemap`. The numeric mapping flags
and ctypes mmap offset binding have not been validated on other ABIs:

    python3 -B probe.py > new-observations.json
    python3 -B -m unittest discover -s . -p test_evidence.py
    python3 -B -O -m unittest discover -s . -p test_evidence.py
    python3 -B -c 'import json; from test_evidence import validate; validate(json.load(open("new-observations.json")))'

Tests validate retained observations.json; the last command checks a fresh replay.
Different outcomes require investigation, not adjustment of expected results to
force a pass. Kernel, libc, architecture, Python, page size and source hash are
recorded. The implementation review uses v6.14; observed kernel is separate.

Only the pagemap present bit is sampled. No PFNs are used/exported, and mincore
is not used as a substitute for page-table presence. File bytes and size are
checked by positional read after sampling. No mapped application store occurs.
Unchanged bytes do not imply clean pages, unchanged allocation or no writeback.
Repeated controls are not independent population samples. No concurrent writer,
memory pressure, huge pages, latency or power loss is tested.

## Primary sources
- https://raw.githubusercontent.com/torvalds/linux/v6.14/include/uapi/asm-generic/mman-common.h
- https://man7.org/linux/man-pages/man2/madvise.2.html
- https://man7.org/linux/man-pages/man2/mmap.2.html
- https://man7.org/linux/man-pages/man2/mlock.2.html
- https://raw.githubusercontent.com/torvalds/linux/v6.14/mm/gup.c
- https://raw.githubusercontent.com/torvalds/linux/v6.14/mm/madvise.c
- https://raw.githubusercontent.com/torvalds/linux/v6.14/mm/memory.c
- https://raw.githubusercontent.com/torvalds/linux/v6.14/tools/testing/selftests/mm/madv_populate.c

Accessed 2026-12-01. Original Python probe; upstream C selftest reviewed, not copied
or executed. No hardware performance, allocation or durability claim is made.

## MIT License
Copyright (c) 2026 Hesela contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
