+static void __copy_hyp_vect_bpi(int slot, const char *hyp_vecs_start,
const char *hyp_vecs_end)
+{
- void *dst = lm_alias(__bp_harden_hyp_vecs_start + slot * SZ_2K)
Hi Will,
Here lm_alias get the virtual address of __bp_harden_hyp_vecs_start from 0xffff000008098800(for example) to 0xffff800008098800 Code basing on v4.15-rc3 works well for this new address 0xffff80000.... but code basing on v4.9 will report null page:
Unable to handle kernel paging request at virtual address ffff8000000....
And without the lm_alias, the kernel booted well. Another place used lm_alias is in kvm_get_hyp_vector(),
Is this safe to drop lm_alias? Or is there some place to request pages for aliaed adderss?
The question you have to ask yourself is whether or not the address you're getting for __bp_harden_hyp_vecs_start is from the linear mapping or from another range. If the former, lm_alias is not necessary (but you may want to find out why it gives you something that is unexpected). If the latter, then you really need to translate it to the linear map, as you're not going to be able to write to kernel text via its execution mapping.
Hi Marc,
Thanks a lot for help! :)
Seems I still stuck and confused in this address alia issue. Is there some shared vector need accessed from both host(hyp) and kvm(normal kernel)? or hyp need copy some vectors to (raw address - kimg) for itself? And if not in hyp, kernel only use raw address?
I still confused on lm_alias using, because, the v4.15 kernel run on EL1 which works with lm_alias address 0xffff80... but v4.9 kernel only works with raw 'dst' address 0xffff00... on EL1. And the same time, juno r2 run on EL2 which report null address on raw address 0xffff00...
As for kvm_get_hyp_vector, same thing. We only map the linear map at EL2, so you really need to pick the right set of VAs, or kern_hyp_va is going to point you to lalaland (and that will be pretty final).
the hyp runs in el2 and use lm_aliaed address?
I cannot page 4.9 in at the moment, but some limited investigation should help you finding out how we used to map the kernel last year.
Thanks,
M.