]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen: CFI hardening for notifier callbacks
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 Oct 2021 09:11:55 +0000 (10:11 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 23 Feb 2022 15:33:43 +0000 (15:33 +0000)
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 <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
24 files changed:
xen/arch/x86/acpi/cpu_idle.c
xen/arch/x86/cpu/mcheck/mce.c
xen/arch/x86/cpu/mcheck/mce_intel.c
xen/arch/x86/cpu/mwait-idle.c
xen/arch/x86/cpu/vpmu.c
xen/arch/x86/genapic/x2apic.c
xen/arch/x86/hvm/hvm.c
xen/arch/x86/nmi.c
xen/arch/x86/percpu.c
xen/arch/x86/psr.c
xen/arch/x86/smpboot.c
xen/common/debugtrace.c
xen/common/kexec.c
xen/common/livepatch.c
xen/common/rcupdate.c
xen/common/sched/core.c
xen/common/sched/cpupool.c
xen/common/stop_machine.c
xen/common/tasklet.c
xen/common/timer.c
xen/common/trace.c
xen/drivers/cpufreq/cpufreq.c
xen/drivers/cpufreq/cpufreq_misc_governors.c
xen/drivers/passthrough/x86/hvm.c

index 7902ccce6b9880edd22a3ea86549ab88225ccd8a..fb47eb9ad68e8148195a6afcb4c9fd2fbbb8e154 100644 (file)
@@ -1622,7 +1622,7 @@ bool cpuidle_using_deep_cstate(void)
                                                                : ACPI_STATE_C1);
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index ea86d84481b2259181829150c9e9a1861774741a..a449fa0424ce35f5c95c74bbe68223956465d10c 100644 (file)
@@ -733,7 +733,7 @@ static int cpu_bank_alloc(unsigned int cpu)
     return 0;
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index d63d6083d3a79f76bb36d9d4febc299787433471..b6da8262e66220c8b39dc2ae42bd95949e5fe3ae 100644 (file)
@@ -931,7 +931,7 @@ static int cpu_mcabank_alloc(unsigned int cpu)
     return -ENOMEM;
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 24d073d315acbb6d970c5c9612dcde4d578c0112..fe1b7af25f014eab27aa9d5147950754d5ebbe19 100644 (file)
@@ -1275,8 +1275,8 @@ static int __init mwait_idle_probe(void)
        return 0;
 }
 
-static int mwait_idle_cpu_init(struct notifier_block *nfb,
-                              unsigned long action, void *hcpu)
+static int cf_check mwait_idle_cpu_init(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
        unsigned int cpu = (unsigned long)hcpu, cstate;
        struct acpi_processor_power *dev = processor_powers[cpu];
index 9fc897dc8403fe76f3c743859268a84aaada85a1..df3c9201b2c10f8ae6083c32b016fbf81c3a1e49 100644 (file)
@@ -817,7 +817,7 @@ long cf_check do_xenpmu_op(
     return ret;
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 9064a0ca46961f2073614092ae01fc00defcb785..bd44bb7539953087bb26a348f235da5907ae1782 100644 (file)
@@ -187,7 +187,7 @@ static const struct genapic __initconstrel apic_x2apic_cluster = {
     .send_IPI_self = send_IPI_self_x2apic
 };
 
-static int update_clusterinfo(
+static int cf_check update_clusterinfo(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 2ae1685d0aff24524eaa62c54b9914046d986be1..0a193530680aa396c09fa990967f099a8d7c3bf8 100644 (file)
@@ -117,7 +117,7 @@ static const char __initconst warning_hvm_fep[] =
 static bool_t __initdata opt_altp2m_enabled = 0;
 boolean_param("altp2m", opt_altp2m_enabled);
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index b112921b394e3e5c6046abd5e890f6f670978453..d6018f0c4297d03e31bae8b7474d1f894b91ea78 100644 (file)
@@ -427,7 +427,7 @@ void setup_apic_nmi_watchdog(void)
     nmi_active = 1;
 }
 
-static int cpu_nmi_callback(
+static int cf_check cpu_nmi_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 0e0b6577ca451f7aba61fb12369d5e23f3f08fcf..eb3ba7bc8874eebc1a786fab245982e73d848cb4 100644 (file)
@@ -63,7 +63,7 @@ static void free_percpu_area(unsigned int cpu)
     call_rcu(&info->rcu, _free_percpu_area);
 }
 
-static int cpu_percpu_callback(
+static int cf_check cpu_percpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 9a3670afc341d631ef07b3a58be8354bf06403a3..5b9991bd5b1278045cbc88424c21160000d0305e 100644 (file)
@@ -1642,7 +1642,7 @@ static void psr_cpu_fini(unsigned int cpu)
         free_socket_resources(socket);
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     int rc = 0;
index 335129a0104de5bd61c2f2767943b0aa260ed720..709704d71ada8e618c1ab3d7b7c8439896e1be88 100644 (file)
@@ -1112,7 +1112,7 @@ static int cpu_smpboot_alloc(unsigned int cpu)
     return rc;
 }
 
-static int cpu_smpboot_callback(
+static int cf_check cpu_smpboot_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index f3c0fd8aa17b667734c9f7e6c859408451912c98..160d00b79607691fb6a92426f908c9264e6efcda 100644 (file)
@@ -263,8 +263,8 @@ static void debugtrace_alloc_buffer(struct debugtrace_data **ptr,
     *ptr = data;
 }
 
-static int debugtrace_cpu_callback(struct notifier_block *nfb,
-                                   unsigned long action, void *hcpu)
+static int cf_check debugtrace_cpu_callback(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
 
index 36384f782db35897bbca28421168cccf925d62fe..3b223cd03d75744dd29273d48a9a4de3a8ff05fd 100644 (file)
@@ -531,7 +531,7 @@ static int kexec_init_cpu_notes(const unsigned long cpu)
     return ret;
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned long cpu = (unsigned long)hcpu;
index 33708b4e2388db598b1be43236f5bdc02e43f5e4..701efd87a17350cbcd3917d2cf9142f2b60aee50 100644 (file)
@@ -2124,7 +2124,7 @@ static void livepatch_printall(unsigned char key)
     spin_unlock(&payload_lock);
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index a5a27af3def02fd8043b4294cd665a1a0fe68187..2ec5606de5dd75d362b0482ddbdc2732121106f3 100644 (file)
@@ -641,7 +641,7 @@ static void rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp,
     init_timer(&rdp->idle_timer, rcu_idle_timer_handler, rdp, cpu);
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 6c1ee7879ab193c932c47c4cb3acad0faeb79b2f..fbd2dfb59bf2c93f36663845c07d0254f3b6dd1d 100644 (file)
@@ -2839,7 +2839,7 @@ void sched_rm_cpu(unsigned int cpu)
     cpu_schedule_down(cpu);
 }
 
-static int cpu_schedule_callback(
+static int cf_check cpu_schedule_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index f26c7f289539ceb3a8abb0c85fb2c9e3a04a7b08..e5cfb03b857eb4d10930a1019cf9367b58f66dd0 100644 (file)
@@ -985,7 +985,7 @@ void dump_runq(unsigned char key)
     spin_unlock(&cpupool_lock);
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 8979d553d677867c7a83b8d748f05118bf8d56ca..a122bd4afe09c2e006cf3831dad156e6b7a727fc 100644 (file)
@@ -182,7 +182,7 @@ static void stopmachine_action(void *data)
     local_irq_enable();
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index ac89511a0955d4a85ceecf04cd6ad77c969d947c..1b16bbcdeb0b6dfdebd3a967aa2d41b277e99677 100644 (file)
@@ -214,7 +214,7 @@ void softirq_tasklet_init(struct tasklet *t, void (*func)(void *), void *data)
     t->is_softirq = 1;
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 1bb265ceea0e247a7541c4080293cedbaa6b27f8..b788050ea1d84d55e0cb08ad9e576fd05a9a069a 100644 (file)
@@ -637,7 +637,7 @@ static void free_percpu_timers(unsigned int cpu)
         ASSERT(ts->heap == dummy_heap);
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 61fecc2b2bd29d95fff68d92882d006aacbe5ead..b5358508f80482fa0c3eb20b9d31119f570dcd6c 100644 (file)
@@ -79,7 +79,7 @@ static u32 tb_event_mask = TRC_ALL;
  * i.e., sizeof(_type) * ans >= _x. */
 #define fit_to_type(_type, _x) (((_x)+sizeof(_type)-1) / sizeof(_type))
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index e55e202d5a183bd36a24a69f4b588c753cd7c765..a94520ee57ac914be1d51a4a498c8d66cf15f3c2 100644 (file)
@@ -632,7 +632,7 @@ static int __init cpufreq_cmdline_parse(const char *s)
     return rc;
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index 8343f491da87425f2c4ad60691d44b9516b3e2c3..ad79d0f5d2461cdd63bc569a4f73ac7b2792a989 100644 (file)
@@ -91,7 +91,7 @@ cpufreq_userspace_handle_option(const char *name, const char *val)
     return 0;
 }
 
-static int cpufreq_userspace_cpu_callback(
+static int cf_check cpufreq_userspace_cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
index e5a2c5830348c28bbfff55a0c72fd3734e3705d1..527bd6a56d839e8a85a1036dda174d3bbd97b223 100644 (file)
@@ -1046,7 +1046,7 @@ static void dpci_softirq(void)
     }
 }
 
-static int cpu_callback(
+static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;