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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -661,7 +661,6 @@ struct perf_event {
/* The cumulative AND of all event_caps for events in this group. */
int group_caps;
- unsigned int group_generation;
struct perf_event *group_leader;
struct pmu *pmu;
void *pmu_private;
@@ -771,6 +770,14 @@ struct perf_event {
#endif
struct list_head sb_list;
+#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 */
};