]> xenbits.xensource.com Git - xen.git/commit
xen/cet: Fix __initconst_cf_clobber
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 2 Mar 2022 20:27:46 +0000 (20:27 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 3 Mar 2022 11:21:35 +0000 (11:21 +0000)
commit3e56754b08871ccceff856ff634731b9b9bccbbe
tree0e7df56dcefa9b90acaddd7eece0bb3cae95de73
parent4b7fd8153ddfe95d6d427ff241abb6fdf37e027b
xen/cet: Fix __initconst_cf_clobber

The linker script collecting .init.rodata.* ahead of .init.rodata.cf_clobber
accidentally causes __initconst_cf_clobber to be a no-op.

Rearrange the linker script to unbreak this.

The IOMMU adjust_irq_affinities() hooks currently violate the safety
requirement for being cf_clobber, by also being plain __initcall()'s.

Consolidate to a single initcall using the iommu_adjust_irq_affinities()
wrapper (satisfying the cf_clobber safety requirement by using iommu_call()
under the hood), and also removes the dubious property that we'd call into
both vendors IOMMU drivers on boot, relying on the for_each_*() loops to be
empty for safety.

With this fixed, an all-enabled build of Xen has 1681 endbr64's in .text with
382 (23%) being clobbered during boot.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/xen.lds.S
xen/drivers/passthrough/amd/iommu_init.c
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/x86/iommu.c