From: Andrew Cooper Date: Fri, 29 Oct 2021 14:47:20 +0000 (+0100) Subject: x86/dpci: CFI hardening X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=47fa059e4e661c541fc407169411f214c9ab9d6f;p=people%2Froyger%2Fxen.git x86/dpci: CFI hardening Control Flow Integrity schemes use toolchain and optionally hardware support to help protect against call/jump/return oriented programming attacks. Use cf_check to annotate function pointer targets for the toolchain. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 4cf313a0ad..cdd1529014 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -474,8 +474,8 @@ void hvm_migrate_pirq(struct hvm_pirq_dpci *pirq_dpci, const struct vcpu *v) } } -static int migrate_pirq(struct domain *d, struct hvm_pirq_dpci *pirq_dpci, - void *arg) +static int cf_check migrate_pirq( + struct domain *d, struct hvm_pirq_dpci *pirq_dpci, void *arg) { hvm_migrate_pirq(pirq_dpci, arg); diff --git a/xen/drivers/passthrough/vtd/x86/hvm.c b/xen/drivers/passthrough/vtd/x86/hvm.c index b531fe907a..132d252d1c 100644 --- a/xen/drivers/passthrough/vtd/x86/hvm.c +++ b/xen/drivers/passthrough/vtd/x86/hvm.c @@ -21,8 +21,8 @@ #include #include -static int _hvm_dpci_isairq_eoi(struct domain *d, - struct hvm_pirq_dpci *pirq_dpci, void *arg) +static int cf_check _hvm_dpci_isairq_eoi( + struct domain *d, struct hvm_pirq_dpci *pirq_dpci, void *arg) { struct hvm_irq *hvm_irq = hvm_domain_irq(d); unsigned int isairq = (long)arg; diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c index 0e3c0f6aee..0f94203af8 100644 --- a/xen/drivers/passthrough/x86/hvm.c +++ b/xen/drivers/passthrough/x86/hvm.c @@ -777,8 +777,8 @@ static void __msi_pirq_eoi(struct hvm_pirq_dpci *pirq_dpci) } } -static int _hvm_dpci_msi_eoi(struct domain *d, - struct hvm_pirq_dpci *pirq_dpci, void *arg) +static int cf_check _hvm_dpci_msi_eoi( + struct domain *d, struct hvm_pirq_dpci *pirq_dpci, void *arg) { int vector = (long)arg; @@ -947,8 +947,8 @@ unlock: spin_unlock(&d->event_lock); } -static int pci_clean_dpci_irq(struct domain *d, - struct hvm_pirq_dpci *pirq_dpci, void *arg) +static int cf_check pci_clean_dpci_irq( + struct domain *d, struct hvm_pirq_dpci *pirq_dpci, void *arg) { struct dev_intx_gsi_link *digl, *tmp;