Skip to content

Commit 500cda7

Browse files
committed
Merge: CVE-2025-21785: arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6493 JIRA: https://issues.redhat.com/browse/RHEL-81666 CVE: CVE-2025-21785 ``` commit 875d742 Author: Radu Rendec <[email protected]> Date: Thu Feb 6 12:44:20 2025 -0500 arm64: cacheinfo: Avoid out-of-bounds write to cacheinfo array The loop that detects/populates cache information already has a bounds check on the array size but does not account for cache levels with separate data/instructions cache. Fix this by incrementing the index for any populated leaf (instead of any populated level). Fixes: 5d425c1 ("arm64: kernel: add support for cpu cache information") Signed-off-by: Radu Rendec <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>``` Signed-off-by: CKI Backport Bot <[email protected]> --- <small>Created 2025-02-28 03:41 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://gitlab.com/cki-project/kernel-workflow/-/issues/new?issue%5Btitle%5D=backporter%20webhook%20issue)</small> Approved-by: Radu Rendec <[email protected]> Approved-by: Eric Chanudet <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Approved-by: Mark Langsdorf <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents 8fdca6c + d9e80f3 commit 500cda7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

arch/arm64/kernel/cacheinfo.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,18 @@ int populate_cache_leaves(unsigned int cpu)
101101
unsigned int level, idx;
102102
enum cache_type type;
103103
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
104-
struct cacheinfo *this_leaf = this_cpu_ci->info_list;
104+
struct cacheinfo *infos = this_cpu_ci->info_list;
105105

106106
for (idx = 0, level = 1; level <= this_cpu_ci->num_levels &&
107-
idx < this_cpu_ci->num_leaves; idx++, level++) {
107+
idx < this_cpu_ci->num_leaves; level++) {
108108
type = get_cache_type(level);
109109
if (type == CACHE_TYPE_SEPARATE) {
110-
ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level);
111-
ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level);
110+
if (idx + 1 >= this_cpu_ci->num_leaves)
111+
break;
112+
ci_leaf_init(&infos[idx++], CACHE_TYPE_DATA, level);
113+
ci_leaf_init(&infos[idx++], CACHE_TYPE_INST, level);
112114
} else {
113-
ci_leaf_init(this_leaf++, type, level);
115+
ci_leaf_init(&infos[idx++], type, level);
114116
}
115117
}
116118
return 0;

0 commit comments

Comments
 (0)