lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220218232521.961040-1-swine@google.com>
Date:   Fri, 18 Feb 2022 15:25:21 -0800
From:   Pete Swain <swine@...gle.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org
Cc:     "H. Peter Anvin" <hpa@...or.com>,
        Eric Dumazet <edumazet@...gle.com>,
        linux-kernel@...r.kernel.org, Pete Swain <swine@...gle.com>
Subject: [PATCH] x86/apic: retpoline mitigation for send_IPI

adds INDIRECT_CALL wrappers to hot paths

Signed-off-by: Pete Swain <swine@...gle.com>
---
 arch/x86/include/asm/smp.h            | 8 ++++++--
 arch/x86/kernel/apic/ipi.c            | 5 ++++-
 arch/x86/kernel/apic/x2apic_cluster.c | 2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 81a0211a372d..1e239583b5a8 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -3,6 +3,7 @@
 #define _ASM_X86_SMP_H
 #ifndef __ASSEMBLY__
 #include <linux/cpumask.h>
+#include <linux/indirect_call_wrapper.h>
 #include <asm/percpu.h>
 
 #include <asm/thread_info.h>
@@ -114,9 +115,13 @@ static inline void smp_send_reschedule(int cpu)
 	smp_ops.smp_send_reschedule(cpu);
 }
 
+void native_send_call_func_single_ipi(int cpu);
+
 static inline void arch_send_call_function_single_ipi(int cpu)
 {
-	smp_ops.send_call_func_single_ipi(cpu);
+
+	INDIRECT_CALL_1(smp_ops.send_call_func_single_ipi,
+			native_send_call_func_single_ipi, cpu);
 }
 
 static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask)
@@ -144,7 +149,6 @@ void cond_wakeup_cpu0(void);
 
 void native_smp_send_reschedule(int cpu);
 void native_send_call_func_ipi(const struct cpumask *mask);
-void native_send_call_func_single_ipi(int cpu);
 void x86_idle_thread_init(unsigned int cpu, struct task_struct *idle);
 
 void smp_store_boot_cpu_info(void);
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index d1fb874fbe64..e376c6e433a6 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -71,9 +71,12 @@ void native_smp_send_reschedule(int cpu)
 	apic->send_IPI(cpu, RESCHEDULE_VECTOR);
 }
 
+INDIRECT_CALLABLE_DECLARE(void __weak x2apic_send_IPI(int cpu, int vector));
+
 void native_send_call_func_single_ipi(int cpu)
 {
-	apic->send_IPI(cpu, CALL_FUNCTION_SINGLE_VECTOR);
+	INDIRECT_CALL_1(apic->send_IPI, x2apic_send_IPI,
+			cpu, CALL_FUNCTION_SINGLE_VECTOR);
 }
 
 void native_send_call_func_ipi(const struct cpumask *mask)
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index e696e22d0531..53ea00793ee0 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -31,7 +31,7 @@ static int x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 	return x2apic_enabled();
 }
 
-static void x2apic_send_IPI(int cpu, int vector)
+INDIRECT_CALLABLE_SCOPE void x2apic_send_IPI(int cpu, int vector)
 {
 	u32 dest = x86_cpu_to_logical_apicid[cpu];
 
-- 
2.35.1.473.g83b2b277ed-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ