From nobody Tue Feb 10 05:45:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1644843924; cv=none; d=zohomail.com; s=zohoarc; b=Deq1eFd2G+K6X1I/s0L+Rup7D1oiCpBeO+kILsS5bNbrEr+v0C34p44ZofFP6i66IjOB12PzeUBX9rCotVbKehRS9KGylOPpV7Efp0wefTqQ2OUxaqQoSQjttnXFYVODQqNftqYXWw0SJYVayVJ0GXoiE5Iq2a3LG3sYIqEEKUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644843924; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9GR7wcaJa6ofPsKRKjhy3t3Sy9kFXq7S2DHrRfxTFjA=; b=dmOaTErXEAmUn2UwNqCLcX4umvK/90NnsoPUz5mhqJe4I6Nh/c3AyKgy/NyQqy4xIs3funwdHTq2jLHoad1p3JsoWay/3dXheQC4y3rmfI9lHy7YuJTzlppJ/n+bdpQiSUd+EUsLSUu982Tl3Mt60lFyhQY49bsjZazJ79ZQP+Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644843924630155.9201551427301; Mon, 14 Feb 2022 05:05:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.271645.466208 (Exim 4.92) (envelope-from ) id 1nJb2B-0000js-Pt; Mon, 14 Feb 2022 13:04:51 +0000 Received: by outflank-mailman (output) from mailman id 271645.466208; Mon, 14 Feb 2022 13:04:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJb2B-0000jP-IR; Mon, 14 Feb 2022 13:04:51 +0000 Received: by outflank-mailman (input) for mailman id 271645; Mon, 14 Feb 2022 13:04:49 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nJb29-0008IH-LL for xen-devel@lists.xenproject.org; Mon, 14 Feb 2022 13:04:49 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id af782393-8d96-11ec-8eb8-a37418f5ba1a; Mon, 14 Feb 2022 14:04:48 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: af782393-8d96-11ec-8eb8-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1644843888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=BEoNz1G1VEb1PvMVHl3dUIUZku1FDM+32RnsoUebuRQ=; b=JpfsnV0I4ACv5kyo+ixL2GWs1tBqlly6FtEObKMqncdivA8rw7A0BJ/L trlnzdHdD3UziKDVAs1TLv5iUltIfFUTFVKEg0zim8tBSXoEOQh9nJOxM fVdk471ds+H3Fx3ciFJ9CEkfuiSUye9SBNabxVQtPb1KL/iAAskQMc+rk c=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: PmpWHPe03+VbbIE8oS71P1YGSlFsPbH89gQw0QKTwC1T5H0nJ9d2eaFOerhhj1Ah1qQnKJENtV MpRBfFGnvfyed4YbBcjHH0BgfNLvImeqtPHMzvTttRCI7rCoIJkHz932whdopODlUl7pG1czdn 9+AA9t4cqorIciBtMdP9cx57Db7benA5L3uTaylXG57W2QWmOJW6Yg7seuVdSaaGJmougDINAJ rH20FV5qvSEvCsesfmGrjG/Zs6Ti0kQ0SsfODw6APf/I0laBbDntFLdv/iBgXpSwkRalj5X/E9 tgAnKaKKSCEbCQs5QgfSEbhJ X-SBRS: 5.1 X-MesageID: 64149632 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:sJNihKpkBnGbHDq2jI9fCPpKaWdeBmIGYhIvgKrLsJaIsI4StFCzt garIBmCa6uPYDbzL98kbo23pBxVsMDVzdMwGlFrris1RCxD9JuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlZT4vE2xbuKU5NTsY0idfic5Dndx4f5fs7Rh2NQw24HlW1rlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnZK+axwJGaHdorsmdUNCLjN7IY9IxLCSdBBTseTLp6HHW37lwvEoB0AqJ4wIvO1wBAmi9 9RBdmpLNErawbvrnvTrEYGAhex6RCXvFKoZtmtt0nfyCvE+TIqYa67L+cVZzHE7gcUm8fP2O ZZANWsxN06ojxtnOGcPGpwek8qRn3zeai9mklu8oYQe2j2GpOB2+Oe0a4eEEjCQfu1Fk0Ddq m/Y8mDRBhAB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LhuGO/9SjIVybygc079 YGT0EUMrzN5DZB4voSmDPIceod/A== X-IronPort-AV: E=Sophos;i="5.88,367,1635220800"; d="scan'208";a="64149632" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper Subject: [PATCH v2 36/70] x86/power: CFI hardening Date: Mon, 14 Feb 2022 12:50:53 +0000 Message-ID: <20220214125127.17985-37-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220214125127.17985-1-andrew.cooper3@citrix.com> References: <20220214125127.17985-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1644843926055100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Acked-by: Jan Beulich --- 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/cpufre= q/cpufreq.c index 8133c2dd958c..c27cbb2304f2 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, unsign= ed int flag) return policy->cpuinfo.max_freq * perf_percent / 100; } =20 -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; } =20 -static int acpi_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int rela= tion) +static int cf_check acpi_cpufreq_target( + struct cpufreq_policy *policy, + unsigned int target_freq, unsigned int relation) { struct acpi_cpufreq_data *data =3D cpufreq_drv_data[policy->cpu]; struct processor_performance *perf; @@ -449,7 +450,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *p= olicy, return result; } =20 -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) } } =20 -static int=20 -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 =3D 0; @@ -609,7 +609,7 @@ acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) return result; } =20 -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 =3D cpufreq_drv_data[policy->cpu]; =20 diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufr= eq/powernow.c index ca71ecf72d67..d4c7dcd5d99d 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) } } =20 -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; } =20 -static int powernow_cpufreq_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int rela= tion) +static int cf_check powernow_cpufreq_target( + struct cpufreq_policy *policy, + unsigned int target_freq, unsigned int relation) { struct acpi_cpufreq_data *data =3D 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]); } =20 -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_polic= y *policy) return cpufreq_frequency_table_verify(policy, data->freq_table); } =20 -static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy) +static int cf_check powernow_cpufreq_cpu_init(struct cpufreq_policy *polic= y) { unsigned int i; unsigned int valid_states =3D 0; @@ -303,7 +304,7 @@ static int powernow_cpufreq_cpu_init(struct cpufreq_pol= icy *policy) return result; } =20 -static int powernow_cpufreq_cpu_exit(struct cpufreq_policy *policy) +static int cf_check powernow_cpufreq_cpu_exit(struct cpufreq_policy *polic= y) { struct acpi_cpufreq_data *data =3D cpufreq_drv_data[policy->cpu]; =20 diff --git a/xen/common/core_parking.c b/xen/common/core_parking.c index 4afad04f2f68..c4f01291c0be 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(cons= t char *str) } custom_param("core_parking", setup_core_parking_option); =20 -static unsigned int core_parking_performance(unsigned int event) +static unsigned int cf_check core_parking_performance(unsigned int event) { unsigned int cpu =3D -1; =20 @@ -111,7 +111,7 @@ static unsigned int core_parking_performance(unsigned i= nt event) return cpu; } =20 -static unsigned int core_parking_power(unsigned int event) +static unsigned int cf_check core_parking_power(unsigned int event) { unsigned int cpu =3D -1; =20 diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/c= pufreq_ondemand.c index ba03eaa2336d..fbcd14d6c32f 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_i= nfo) kill_timer(&per_cpu(dbs_timer, dbs_info->cpu)); } =20 -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 =3D 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; } =20 -static bool_t __init cpufreq_dbs_handle_option(const char *name, const cha= r *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 4958d3f7d315..e5e58c6c30ea 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; }; =20 -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, --=20 2.11.0