[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/power: CFI hardening
commit 98f93855806d9301f08000be804bc9cbb97011c1 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Thu Oct 28 12:00:06 2021 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Wed Feb 23 15:33:43 2022 +0000 x86/power: 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. cpufreq_governor_dbs() has no external callers so make it static. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/acpi/cpufreq/cpufreq.c | 14 +++++++------- xen/arch/x86/acpi/cpufreq/powernow.c | 15 ++++++++------- xen/common/core_parking.c | 4 ++-- xen/drivers/cpufreq/cpufreq_ondemand.c | 6 ++++-- xen/include/acpi/cpufreq/cpufreq.h | 1 - 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index 8133c2dd95..c27cbb2304 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -320,7 +320,7 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag) return policy->cpuinfo.max_freq * perf_percent / 100; } -static unsigned int get_cur_freq_on_cpu(unsigned int cpu) +static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu) { struct cpufreq_policy *policy; struct acpi_cpufreq_data *data; @@ -369,8 +369,9 @@ static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq, return 0; } -static int acpi_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int cf_check acpi_cpufreq_target( + struct cpufreq_policy *policy, + unsigned int target_freq, unsigned int relation) { struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu]; struct processor_performance *perf; @@ -449,7 +450,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy, return result; } -static int acpi_cpufreq_verify(struct cpufreq_policy *policy) +static int cf_check acpi_cpufreq_verify(struct cpufreq_policy *policy) { struct acpi_cpufreq_data *data; struct processor_performance *perf; @@ -494,8 +495,7 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) } } -static int -acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) +static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) { unsigned int i; unsigned int valid_states = 0; @@ -609,7 +609,7 @@ err_unreg: return result; } -static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) +static int cf_check acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) { struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu]; diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c index ca71ecf72d..d4c7dcd5d9 100644 --- a/xen/arch/x86/acpi/cpufreq/powernow.c +++ b/xen/arch/x86/acpi/cpufreq/powernow.c @@ -67,8 +67,8 @@ static void cf_check update_cpb(void *data) } } -static int powernow_cpufreq_update (int cpuid, - struct cpufreq_policy *policy) +static int cf_check powernow_cpufreq_update( + int cpuid, struct cpufreq_policy *policy) { if (!cpumask_test_cpu(cpuid, &cpu_online_map)) return -EINVAL; @@ -78,8 +78,9 @@ static int powernow_cpufreq_update (int cpuid, return 0; } -static int powernow_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int cf_check powernow_cpufreq_target( + struct cpufreq_policy *policy, + unsigned int target_freq, unsigned int relation) { struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu]; struct processor_performance *perf; @@ -180,7 +181,7 @@ static void cf_check get_cpu_data(void *arg) amd_fixup_frequency(&perf->states[i]); } -static int powernow_cpufreq_verify(struct cpufreq_policy *policy) +static int cf_check powernow_cpufreq_verify(struct cpufreq_policy *policy) { struct acpi_cpufreq_data *data; struct processor_performance *perf; @@ -197,7 +198,7 @@ static int powernow_cpufreq_verify(struct cpufreq_policy *policy) return cpufreq_frequency_table_verify(policy, data->freq_table); } -static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy) +static int cf_check powernow_cpufreq_cpu_init(struct cpufreq_policy *policy) { unsigned int i; unsigned int valid_states = 0; @@ -303,7 +304,7 @@ err_unreg: return result; } -static int powernow_cpufreq_cpu_exit(struct cpufreq_policy *policy) +static int cf_check powernow_cpufreq_cpu_exit(struct cpufreq_policy *policy) { struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu]; diff --git a/xen/common/core_parking.c b/xen/common/core_parking.c index 4afad04f2f..c4f01291c0 100644 --- a/xen/common/core_parking.c +++ b/xen/common/core_parking.c @@ -53,7 +53,7 @@ static int __init cf_check setup_core_parking_option(const char *str) } custom_param("core_parking", setup_core_parking_option); -static unsigned int core_parking_performance(unsigned int event) +static unsigned int cf_check core_parking_performance(unsigned int event) { unsigned int cpu = -1; @@ -111,7 +111,7 @@ static unsigned int core_parking_performance(unsigned int event) return cpu; } -static unsigned int core_parking_power(unsigned int event) +static unsigned int cf_check core_parking_power(unsigned int event) { unsigned int cpu = -1; diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c index ba03eaa233..fbcd14d6c3 100644 --- a/xen/drivers/cpufreq/cpufreq_ondemand.c +++ b/xen/drivers/cpufreq/cpufreq_ondemand.c @@ -215,7 +215,8 @@ static void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) kill_timer(&per_cpu(dbs_timer, dbs_info->cpu)); } -int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event) +static int cf_check cpufreq_governor_dbs( + struct cpufreq_policy *policy, unsigned int event) { unsigned int cpu = policy->cpu; struct cpu_dbs_info_s *this_dbs_info; @@ -307,7 +308,8 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event) return 0; } -static bool_t __init cpufreq_dbs_handle_option(const char *name, const char *val) +static bool __init cf_check cpufreq_dbs_handle_option( + const char *name, const char *val) { if ( !strcmp(name, "rate") && val ) { diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h index 4958d3f7d3..e5e58c6c30 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -227,7 +227,6 @@ struct cpu_dbs_info_s { int8_t stoppable; }; -int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event); int get_cpufreq_ondemand_para(uint32_t *sampling_rate_max, uint32_t *sampling_rate_min, uint32_t *sampling_rate, -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |