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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251218083109.GH3707891@noisy.programming.kicks-ass.net>
Date: Thu, 18 Dec 2025 09:31:09 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: linux-kernel@...r.kernel.org, seanjc@...gle.com, sfr@...b.auug.org.au
Cc: linux-tip-commits@...r.kernel.org, x86@...nel.org, pbonzini@...hat.com,
	kvm@...r.kernel.org
Subject: Re: [tip: perf/core] perf: Use EXPORT_SYMBOL_FOR_KVM() for the
 mediated APIs

On Wed, Dec 17, 2025 at 12:37:57PM -0000, tip-bot2 for Peter Zijlstra wrote:
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index e6a4b1e..376fb07 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -57,6 +57,7 @@
>  #include <linux/task_work.h>
>  #include <linux/percpu-rwsem.h>
>  #include <linux/unwind_deferred.h>
> +#include <linux/kvm_types.h>
>  
>  #include "internal.h"
>  
> @@ -6388,7 +6389,7 @@ int perf_create_mediated_pmu(void)
>  	atomic_inc(&nr_mediated_pmu_vms);
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(perf_create_mediated_pmu);
> +EXPORT_SYMBOL_FOR_KVM(perf_create_mediated_pmu);
>  
>  void perf_release_mediated_pmu(void)
>  {
> @@ -6397,7 +6398,7 @@ void perf_release_mediated_pmu(void)
>  
>  	atomic_dec(&nr_mediated_pmu_vms);
>  }
> -EXPORT_SYMBOL_GPL(perf_release_mediated_pmu);
> +EXPORT_SYMBOL_FOR_KVM(perf_release_mediated_pmu);
>  
>  /* When loading a guest's mediated PMU, schedule out all exclude_guest events. */
>  void perf_load_guest_context(void)

Bah, so the !KVM architectures hate on this.

Sean, would something like this be acceptable?

---
Subject: kvm: Fix linux/kvm_types.h for !KVM architectures

As is, <linux/kvm_types.h> hard relies on architectures having
<asm/kvm_types.h> which (obviously) breaks for architectures that don't
have KVM support.

This means generic code (kernel/events/ in this case) cannot use
EXPORT_SYMBOL_FOR_KVM().

Rearrange things just so that <linux/kvm_types.h> becomes usable and
provides the (expected) empty stub for EXPORT_SYMBOL_FOR_KVM() for !KVM.

Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index a568d8e6f4e8..a4cc13e41eec 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -6,6 +6,8 @@
 #include <linux/bits.h>
 #include <linux/export.h>
 #include <linux/types.h>
+
+#ifdef CONFIG_KVM
 #include <asm/kvm_types.h>
 
 #ifdef KVM_SUB_MODULES
@@ -20,13 +22,14 @@
  * if there are no submodules, e.g. to allow suppressing exports if KVM=m, but
  * kvm.ko won't actually be built (due to lack of at least one submodule).
  */
-#ifndef EXPORT_SYMBOL_FOR_KVM
-#if IS_MODULE(CONFIG_KVM)
+#if defined(EXPORT_SYMBOL_FOR_KVM) && IS_MODULE(CONFIG_KVM)
 #define EXPORT_SYMBOL_FOR_KVM(symbol) EXPORT_SYMBOL_FOR_MODULES(symbol, "kvm")
-#else
-#define EXPORT_SYMBOL_FOR_KVM(symbol)
 #endif /* IS_MODULE(CONFIG_KVM) */
-#endif /* EXPORT_SYMBOL_FOR_KVM */
+#endif /* KVM_SUB_MODULES */
+#endif
+
+#ifndef EXPORT_SYMBOL_FOR_KVM
+#define EXPORTEXPORT_SYMBOL_FOR_KVM(symbol)
 #endif
 
 #ifndef __ASSEMBLER__

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ