#!/usr/bin/env python3 # SPDX-License-Identifier: MIT """Independent source-walk and policy fault injection for MAP_PAGE replacements.""" import contextlib import io from pathlib import Path import runpy import struct HERE = Path(__file__).resolve().parent with contextlib.redirect_stdout(io.StringIO()): fixture = runpy.run_path(str(HERE/'test-audit-unmap-disjoint.py'))['fixture'] mod = runpy.run_path(str(HERE/'audit-user-map-replace.py')) checks = 0 def case(shift=14): memory,kw,read = fixture(shift) kw['states'] = [pair[0] for pair in kw['states']] s = kw['states'][2] s['old'] |= 0x0060000000000000 s['requested'] = s['next'] = s['old'] & ~0x80 s['result'] = 1 # shipped MAP_PAGE reports a replaced valid leaf as 1 struct.pack_into('