x86/xpti: really hide almost all of Xen image
Quoted 10 lines · Jan Beulich
Commit
422588e885("x86/xpti: Hide almost all of .text and all .data/.rodata/.bss mappings") carefully limited the Xen image cloning to just entry code, but then overwrote the just allocated and populated L3 entry with the normal one again covering both Xen image and stubs.Drop the respective code in favor of an explicit
clone_mapping()invocation. This in turn now requiressetup_cpu_root_pgt()to run after stub setup in all cases. Additionally, with (almost) no unintended mappings left, the BSP's IDT now also needs to be page aligned.
Quoted 4 lines
Note that the removed BUILD_BUG_ON()s don't get replaced by anything - there already is a suitable
ASSERT()inxen.lds.S.Signed-off-by Jan Beulich <[email protected]>
Quoted 4 lines
---
What should we do with the TSS? Currently together with it we expose almost a full page of other per-CPU data. A simple (but slightly hackish) option would be to use one of the two unused stack slots.
Either one of the unused stack pages or directly after the GDT (we could then drop NR_RESERVED_GDT_PAGES and reduce NR_RESERVED_GDT_ENTRIES to a lower value, e.g. 16 or 32).
Quoted 4 lines
Talking of the stack: While APs properly have the guard page mirrored into the cloned page tables, this is a debug-build only thing _and_ doesn't cover the BSP. Should we perhaps add code to fully mirror the guard pages, including on release builds?
+1
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 02.03.18 at 13:16, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Commit
422588e885("x86/xpti: Hide almost all of .text and all .data/.rodata/.bss mappings") carefully limited the Xen image cloning to just entry code, but then overwrote the just allocated and populated L3 entry with the normal one again covering both Xen image and stubs.Drop the respective code in favor of an explicit
clone_mapping()invocation. This in turn now requiressetup_cpu_root_pgt()to run after stub setup in all cases. Additionally, with (almost) no unintended mappings left, the BSP's IDT now also needs to be page aligned.
Quoted 7 lines
Quoted 4 lines
Note that the removed BUILD_BUG_ON()s don't get replaced by anything - there already is a suitable
ASSERT()inxen.lds.S.Signed-off-by Jan Beulich <[email protected]>Tested-by Juergen Gross <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Thanks, but I'm afraid there's a minor bug in that change: I need to free the page tables that the new clone_mapping() may have produced, but I need to do that without affecting common_pgt. It may therefore be worthwhile considering to retain the original approach instead, just doing the changes at L2 rather than L3. Andrew, do you have a preference either way?
Quoted 8 lines
Quoted 4 lines
---
What should we do with the TSS? Currently together with it we expose almost a full page of other per-CPU data. A simple (but slightly hackish) option would be to use one of the two unused stack slots.Either one of the unused stack pages or directly after the GDT (we could then drop
NR_RESERVED_GDT_PAGESand reduceNR_RESERVED_GDT_ENTRIESto a lower value, e.g. 16 or 32).
I dislike moving the TSS into per-domain space. There shouldn't be anything there that isn't per-domain.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel