From: Andrew Cooper Date: Fri, 29 Oct 2021 18:47:47 +0000 (+0100) Subject: x86/pt: CFI hardening X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e236fb0798f46d1c15bacdc1d52dc906c74e0ff8;p=people%2Froyger%2Fxen.git x86/pt: 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/emul-i8254.c b/xen/arch/x86/emul-i8254.c index d170f464d9..18894b6348 100644 --- a/xen/arch/x86/emul-i8254.c +++ b/xen/arch/x86/emul-i8254.c @@ -156,7 +156,7 @@ static int pit_get_gate(PITState *pit, int channel) return pit->hw.channels[channel].gate; } -static void pit_time_fired(struct vcpu *v, void *priv) +static void cf_check pit_time_fired(struct vcpu *v, void *priv) { uint64_t *count_load_time = priv; TRACE_0D(TRC_HVM_EMUL_PIT_TIMER_CB); diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c index ed512fa65b..45c7b9b406 100644 --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -219,7 +219,7 @@ static void hpet_stop_timer(HPETState *h, unsigned int tn, hpet_get_comparator(h, tn, guest_time); } -static void hpet_timer_fired(struct vcpu *v, void *data) +static void cf_check hpet_timer_fired(struct vcpu *v, void *data) { unsigned int tn = (unsigned long)data; HPETState *h = vcpu_vhpet(v); diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c index ed397276fa..d21925db08 100644 --- a/xen/arch/x86/hvm/rtc.c +++ b/xen/arch/x86/hvm/rtc.c @@ -81,7 +81,7 @@ static void rtc_update_irq(RTCState *s) /* Called by the VPT code after it's injected a PF interrupt for us. * Fix up the register state to reflect what happened. */ -static void rtc_pf_callback(struct vcpu *v, void *opaque) +static void cf_check rtc_pf_callback(struct vcpu *v, void *opaque) { RTCState *s = opaque; diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index d4e29ef1ff..49be9c8ea4 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -691,13 +691,13 @@ int guest_rdmsr_x2apic(const struct vcpu *v, uint32_t msr, uint64_t *val) return X86EMUL_OKAY; } -static void vlapic_pt_cb(struct vcpu *v, void *data) +static void cf_check vlapic_pt_cb(struct vcpu *v, void *data) { TRACE_0D(TRC_HVM_EMUL_LAPIC_TIMER_CB); *(s_time_t *)data = hvm_get_guest_time(v); } -static void vlapic_tdt_pt_cb(struct vcpu *v, void *data) +static void cf_check vlapic_tdt_pt_cb(struct vcpu *v, void *data) { *(s_time_t *)data = hvm_get_guest_time(v); vcpu_vlapic(v)->hw.tdt_msr = 0;