Thread (5 messages) 5 messages, 3 authors, 2021-08-02

Re: [PATCH v2 1/2] arm64: Move .hyp.rodata outside of the _sdata.._edata range

From: Quentin Perret <hidden>
Date: 2021-08-02 13:48:11
Also in: kvm, kvmarm, linux-arm-kernel

On Monday 02 Aug 2021 at 14:20:42 (+0100), Marc Zyngier wrote:
Hi Quentin,

On Mon, 02 Aug 2021 14:11:07 +0100,
Quentin Perret [off-list ref] wrote:
quoted
Hi Marc,

On Monday 02 Aug 2021 at 13:38:29 (+0100), Marc Zyngier wrote:
quoted
The HYP rodata section is currently lumped together with the BSS,
which isn't exactly what is expected (it gets registered with
kmemleak, for example).

Move it away so that it is actually marked RO. As an added
benefit, it isn't registered with kmemleak anymore.
2d7bf218ca73 ("KVM: arm64: Add .hyp.data..ro_after_init ELF section")
states explicitly that the hyp ro_after_init section should remain RW in
the host as it is expected to modify it before initializing EL2. But I
can't seem to trigger anything with this patch applied, so I'll look
into this a bit more.
The switch to RO happens quite late. And if the host was to actually
try and change things there, it would be screwed anyway (we will have
already removed the pages from its S2).
Yes, clearly mapping rodata RO in host happens much later than I
thought, so this should indeed be fine.
I wouldn't be surprised if this was a consequence of the way we now
build the HYP object, and the comment in the original commit may not
be valid anymore.
Just had a quick look and that still seems valid, at least for some
things (e.g. see how we set hyp_cpu_logical_map[] early from EL1 while
it is clearly annotated as __ro_after_init in the EL2 code).
quoted
quoted
Fixes: 380e18ade4a5 ("KVM: arm64: Introduce a BSS section for use at Hyp")
Not sure this is the patch to blame?
My bad, this is plain wrong. I'm not sure it can be applied earlier
though if my rambling above is correct.
By the look of it going all the way back to 2d7bf218ca73 (in David's
PSCI proxy series) should actually be correct. But not sure if that's
really going to make a difference before the patch you've mentioned
above as the kmemleak issue will only be visible once we have a host
stage-2, so no big deal.

Thanks,
Quentin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help