# SPDX-License-Identifier: MIT """Bounded read-only copy of the pinned native kernel's circular message log.""" import struct WITNESSES = ( (0xfffffe000bf02f8c, 0xb0003eb9), # msgbufp page (0xfffffe000bf02f90, 0xf9408b28), # msgbufp slot (0xfffffe000bf02f94, 0xb9400518), # size (0xfffffe000bf02fe0, 0xf940092b), # character buffer (0xfffffe000bf02fe4, 0xb980092c), # write position ) SLOT = 0xfffffe000c6d7110 def collect(read, instruction): for address, word in WITNESSES: if instruction(address) != word: raise ValueError(f'kernel message witness differs at {address:#x}') obj, = struct.unpack('