KVM: arm64: Mark host bss and rodata section as shared
authorQuentin Perret <qperret@google.com>
Mon, 9 Aug 2021 15:24:44 +0000 (16:24 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 11 Aug 2021 10:39:51 +0000 (11:39 +0100)
commit2c50166c62ba7f3c23c1bbdbb9324db462ddc97b
tree51ce1752d2957fb662686973f5ce0b8c8f8b5e39
parent9024b3d0069ab4b8ef70cf55f0ee09e61f3a0747
KVM: arm64: Mark host bss and rodata section as shared

As the hypervisor maps the host's .bss and .rodata sections in its
stage-1, make sure to tag them as shared in hyp and host page-tables.

But since the hypervisor relies on the presence of these mappings, we
cannot let the host in complete control of the memory regions -- it
must not unshare or donate them to another entity for example. To
prevent this, let's transfer the ownership of those ranges to the
hypervisor itself, and share the pages back with the host.

Signed-off-by: Quentin Perret <qperret@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210809152448.1810400-18-qperret@google.com
arch/arm64/kvm/hyp/nvhe/setup.c