Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Aug 2018 17:10:49 +0100
From:      Steve O'Hara-Smith <steve@sohara.org>
To:        freebsd-questions@freebsd.org
Cc:        Polytropon <freebsd@edvax.de>
Subject:   Re: Erase memory on shutdown
Message-ID:  <20180805171049.caf517319d391b429b087852@sohara.org>
In-Reply-To: <20180805172503.e2479108.freebsd@edvax.de>
References:  <acbb3213-e79e-dfde-038f-b1476925cd4a@irk.ru> <20180805172503.e2479108.freebsd@edvax.de>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sun, 5 Aug 2018 17:25:03 +0200
Polytropon <freebsd@edvax.de> 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@sohara.org>



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20180805171049.caf517319d391b429b087852>