FAILED: patch "[PATCH] s390/perf_cpum_cf: Add missing array_index_nospec() to" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 49145bce539117db4b6e9e83c0e5ef528e361050
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072026-maturing-tapeless-9870@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 49145bce539117db4b6e9e83c0e5ef528e361050 Mon Sep 17 00:00:00 2001
From: Sumanth Korikkar <[email protected]>
Date: Mon, 6 Jul 2026 12:46:31 +0200
Subject: [PATCH] s390/perf_cpum_cf: Add missing array_index_nospec() to
__hw_perf_event_init()
ev variable is userspace controlled via event->attr.config and used as an array index after bounds checking, but without speculation barriers.
Add the missing array_index_nospec() call to prevent speculative execution.
arch/s390/kernel/perf_cpum_cf.c +3 -0
@@ -15,6 +15,7 @@#include <linux/init.h> #include <linux/miscdevice.h> #include <linux/perf_event.h> +#include <linux/nospec.h> #include <asm/cpu_mf.h> #include <asm/hwctrset.h>
@@ -768,6 +769,7 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)if (!is_userspace_event (ev)) {if (ev >=ARRAY_SIZE (cpumf_generic_events_user))return -EOPNOTSUPP ; + ev =array_index_nospec (ev,ARRAY_SIZE (cpumf_generic_events_user)); ev = cpumf_generic_events_user[ev]; } }else if (!attr->exclude_kernel && attr->exclude_user) {
@@ -778,6 +780,7 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)if (!is_userspace_event (ev)) {if (ev >=ARRAY_SIZE (cpumf_generic_events_basic))return -EOPNOTSUPP ; + ev =array_index_nospec (ev,ARRAY_SIZE (cpumf_generic_events_basic)); ev = cpumf_generic_events_basic[ev]; } }