Erase memory on shutdown

Steve O'Hara-Smith steve at
Sun Aug 5 16:10:58 UTC 2018

On Sun, 5 Aug 2018 17:25:03 +0200
Polytropon <freebsd at> wrote:

> This would imply that the kernel would finally have to
> overwrite itself. How can control over zeroing memory
> be maintained when the control program itself has been
> overwritten?

	That was a classic exercise from 8080/Z80 days, it may be possible
to adapt the technique to more modern processors provided there is still a
mode in which 00 is a NOP.

	The essence of the technique involved setting the stack pointer to
top of memory, zeroing a register and then jumping to a loop at the bottom
of memory that pushed the register and jumped to zero. The ante-penulitmate
step overwrites the jump destination with zero, which it was anyway. The
penultimate push overwrites the jump instruction which causes the processor
to execute NOPs all the way to top of memory and cycle round to the bottom
of memory for the final push which overwrites the push instruction leaving
the processor cycling through NOPs forever.

Steve O'Hara-Smith <steve at>

More information about the freebsd-questions mailing list