(The MemGuard prototype works on the Linux 2.0.27 kernel only.)
The architecture-dependent part of MemGuard is put under:
/usr/src/linux-2.0.27/include/asm-i386/memguard
/usr/src/linux-2.0.27/arch/i386/memguard
These source files provide the abstraction machine for the higher level of MemGuard.
The architecture-independent part of MemGuard is put under:
/usr/src/linux-2.0.27/include/memguard
/usr/src/linux-2.0.27/memguard
These source files implement MemGuard on top of the abstraction machine.
The MemGuard initialization is done by patching:
/usr/src/linux-2.0.27/init/main.c
Since a quasi-invariant term may happen to be in the same physical page with a task structure, task-switches may result in page protection faults. However, the Pentium processor requires a task gate to call the page-fault handler during task-switches, but the page-fault handler in Linux is not designed this way. Page protection faults are totally avoided during context-switches by patching:
/usr/src/linux-2.0.27/kernel/sched.c
Pentium's 4MB page facility greatly increases false sharing (a normal data structure happens to be in the same page with a quasi-invariant) ratio and hurts MemGuard performance. This facility is disabled by patching:
/usr/src/linux-2.0.27/arch/i386/kernel/setup.c
The Linux page fault handler is modified to identify MemGuard page protection faults and call the MemGuard page protection fault handler. The modification is done by patching:
/usr/src/linux-2.0.27/arch/i386/mm/fault.c
The Linux debug trap handler is modified for restoring the system state after the single-stepped faulting instruction. The modification is done by patching:
/usr/src/linux-2.0.27/arch/i386/kernel/traps.c