It's harder than that even, because we don't own the page flags, so then
clearing the PG_kalias bit would require that we make all page flags ops
atomic in all parts of the kernel. Obviously not going to happen.
The other thing we could do is have vmap layer keep some p->v translations
around (actually it doesn't even need to go all the way to v, just a single
bit would suffice) So I guess this would be like another page flag, but
without the atomicity problem and without me getting angry at using another
flag ;) Still, I'd rather not do this and slow everything else down.
It could be switched on at runtime if Xen is running perhaps. Or the other
thing Xen could do is keep a cache of unaliased page table pages. You
could fill it up N pages at a time, and just do a single unmap_aliases call
to sanitize them all; also, clean pages returned from pagetables could be
reused. Like the quicklists things.
Or: doesn't the host have to do its own alias check anyway? In case of an
AWOL guest? Why not just reuse that and trap back into the guest to fix it
up?