mbox series

[0/2] KVM: arm64: Stub exports in nvhe code

Message ID 20210203141931.615898-1-qperret@google.com (mailing list archive)
Headers show
Series KVM: arm64: Stub exports in nvhe code | expand

Message

Quentin Perret Feb. 3, 2021, 2:19 p.m. UTC
Hi all,

In the context of the currently ongoing work to remove the host kernel
from the TCB under KVM/arm64, I have been trying to wrap the host kernel
with a stage 2 page-table -- see [1].

Using this infrastructure, I attempted to unmap the .hyp. sections from
the host stage 2 as it really shouldn't need to access them. But by
doing so, I realized quickly the module loader was getting very confused
by the usage of EXPORT_SYMBOL() macros in library functions that have
been pulled into the EL2 object, and that we end up linking modules
against the EL2 copy of e.g. memset. And so, this series essentially
tries to fix this.

 - Patch 01 changes asm-generic/export.h to ensure we respect
   __DISABLE_EXPORTS even for asm exports;

 - and patch 02 makes use of it for all of the nVHE EL2 code.

This was tested on aml-s905x-cc, which now successfully loads kernel
modules with .hyp.text unmapped from the host.

Thanks,
Quentin

[1] https://lore.kernel.org/kvmarm/20210108121524.656872-1-qperret@google.com/

Quentin Perret (2):
  asm-generic: export: Stub EXPORT_SYMBOL with __DISABLE_EXPORTS
  KVM: arm64: Stub EXPORT_SYMBOL for nVHE EL2 code

 arch/arm64/kvm/hyp/nvhe/Makefile | 4 ++--
 include/asm-generic/export.h     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Marc Zyngier Feb. 3, 2021, 4:43 p.m. UTC | #1
On Wed, 3 Feb 2021 14:19:29 +0000, Quentin Perret wrote:
> In the context of the currently ongoing work to remove the host kernel
> from the TCB under KVM/arm64, I have been trying to wrap the host kernel
> with a stage 2 page-table -- see [1].
> 
> Using this infrastructure, I attempted to unmap the .hyp. sections from
> the host stage 2 as it really shouldn't need to access them. But by
> doing so, I realized quickly the module loader was getting very confused
> by the usage of EXPORT_SYMBOL() macros in library functions that have
> been pulled into the EL2 object, and that we end up linking modules
> against the EL2 copy of e.g. memset. And so, this series essentially
> tries to fix this.
> 
> [...]

Applied to kvm-arm64/misc-5.12, thanks!

[1/2] asm-generic: export: Stub EXPORT_SYMBOL with __DISABLE_EXPORTS
      commit: 54effa653246c35997f5e990e0134be5be09f9d1
[2/2] KVM: arm64: Stub EXPORT_SYMBOL for nVHE EL2 code
      commit: bbc075e01ceac50e0a8353b520544f3089e94e44

Cheers,

	M.