From: Tony Jones <tonyj@suse.de>
Subject: KABI perf: Disallow mis-matched inherited group reads
Patch-mainline: never, KABI workaround
References: bsc#1216584 CVE-2023-5717

All references to struct perf_event are via pointer so there should be no issue
within our code base.

For any out-of-tree module users who might be referencing the struct (not 
aware of any) move the new field to the end of the struct.

---
 include/linux/perf_event.h |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -469,7 +469,6 @@ struct perf_event {
 	struct list_head		active_entry;
 	int				nr_siblings;
 	int				group_flags;
-	unsigned int			group_generation;
 	struct perf_event		*group_leader;
 	struct pmu			*pmu;
 	void				*pmu_private;
@@ -587,7 +586,14 @@ struct perf_event {
 	struct perf_cgroup		*cgrp; /* cgroup event is attach to */
 	int				cgrp_defer_enabled;
 #endif
+#ifndef __GENKSYMS__
 
+	/* 
+	 * bsc#1216584 CVE-2023-5717 
+	 * move to end of struct for KABI safety reasons
+	 */
+	unsigned int			group_generation;
+#endif /* __GENKSYMS__ */
 #endif /* CONFIG_PERF_EVENTS */
 };
 
