On 01/02/18 10:23, Alex Shi wrote:
On 02/01/2018 05:43 PM, Marc Zyngier wrote:
On 01/02/18 09:31, Alex Shi wrote:
I really don't understand your questions, so let me explain how things work:
Sorry for my idiot on virt machine. And many thanks for patient explanation!
From the doc Documentation/virtual/kvm/arm/hyp-abi.txt, I guess the correct concept is KVM is a hypervisor.
- The kernel embeds all of the KVM text. Some of that text is meant to
be mapped at EL2.
- All the mappings at HYP are at an offset from the linear mapping, and
you can convert a linear mapping VA to a HYP VA using kern_hyp_va().
why we need this mapping? and who/when did this mapping? Both of address are accessed from same EL level?
We need this mapping because EL2 cannot use the same VAs as EL1. Only only has a single TTBR, and thus cannot use negative addressing. The page tables are created by EL1, and only EL2 is accessing memory via this mapping.
That's how KVM/arm64 worked since the beginning of times, and not much has changed since then.
Hi Marc,
Many thanks for the info!
Would you like to tell me when the specific __bp_harden_hyp_vecs_start or bp_hardening_data got linear mapped?
The whole of the memory is in the linear map, from very early boot. Hence it contains the kernel and everything else. We don't do anything specific to map thing in the linear map. Instead, we selectively map bits of it at other virtual addresses (the kernel gets its own executable mapping, the HYP code gets mapped at EL2...).
Thanks,
M.