Files
Akshat 4e4bd17125 Add MemProcFS with a reproducible raw-image check
Run the MemProcFS check from the issue #6 conditional backlog: a
self-built x64 page table in a raw image is opened through the Python
API with a user-supplied DTB, and physical reads, virtual reads,
virt2phys, and /memory.pmem match the planted markers. The check runs on
Linux x86-64 only, where the pinned wheels need leechcorepyc and
libusb-1.0; other hosts record it as skipped. The prerequisite tests
cover the platform-limited pins and the missing-libusb diagnostic.
2026-10-21 15:05:18 +05:30

19 lines
711 B
Python

"""Read a self-authored raw image through the MemProcFS Python API and print the observations as JSON."""
import json
import sys
import memprocfs
image, dtb, va = sys.argv[1], int(sys.argv[2], 0), int(sys.argv[3], 0)
vmm = memprocfs.Vmm(["-device", image, "-dtb", hex(dtb), "-disable-python", "-disable-symbolserver"])
process = vmm.process_list()[0]
print(json.dumps({
"physical": vmm.memory.read(0x1000, 16).hex(),
"processes": [[p.pid, p.name, p.dtb] for p in vmm.process_list()],
"virtual": process.memory.read(va, 16).hex(),
"virt2phys": process.memory.virt2phys(va),
"pmem_file": vmm.vfs.read("/memory.pmem", 16, 0x1000).hex(),
"root": sorted(vmm.vfs.list("/")),
}))
vmm.close()