|
From: Karl <kh...@tr...> - 2005-05-31 16:47:21
|
On 2005-05-25 17:44:58 -0700, Jeremy Fitzhardinge wrote:
> How about "generate self-checking code if the code is being fetched
> from a writable page"? That will never happen in normal operation,
> since all code is mapped read-only. It could be fooled by someone
> changing page permissions with mprotect (write some code into a
> page, make it RO, execute it, make it RW, change it), but you could
> fix that by clearing the translation cache for a memory range when
> either switching it from RW->RO or RO->RW (one or the other should
> do the trick).
You can't fix it by clearing translations only on rw->ro transitions.
If you do, then after an ro->rw transition, you would have
non-self-invalidating code based on writeable memory.
The other option works: then, after a rw->ro transition, you would
have self-invalidating code based on read-only memory, which is
inefficient but correct.
--
Karl Hasselström, kh...@tr...
www.treskal.com/kalle
|