+++ /dev/null
-From 099ebc1711fb9c4c2a9658e12af98f7eb4168d06 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Sep 2025 11:17:12 -0700
-Subject: perf bpf-utils: Constify bpil_array_desc
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 1654a0e4d576d9e43fbb10ccf6a1b307c5c18566 ]
-
-The array's contents is a compile time constant. Constify to make the
-code more intention revealing and avoid unintended errors.
-
-Reviewed-by: Namhyung Kim <namhyung@kernel.org>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Link: https://lore.kernel.org/r/20250902181713.309797-3-irogers@google.com
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Stable-dep-of: 01be43f2a0ea ("perf bpf-utils: Harden get_bpf_prog_info_linear")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/bpf-utils.c | 18 ++++++------------
- 1 file changed, 6 insertions(+), 12 deletions(-)
-
-diff --git a/tools/perf/util/bpf-utils.c b/tools/perf/util/bpf-utils.c
-index 80b1d2b3729ba..64a5583446964 100644
---- a/tools/perf/util/bpf-utils.c
-+++ b/tools/perf/util/bpf-utils.c
-@@ -20,7 +20,7 @@ struct bpil_array_desc {
- */
- };
-
--static struct bpil_array_desc bpil_array_desc[] = {
-+static const struct bpil_array_desc bpil_array_desc[] = {
- [PERF_BPIL_JITED_INSNS] = {
- offsetof(struct bpf_prog_info, jited_prog_insns),
- offsetof(struct bpf_prog_info, jited_prog_len),
-@@ -129,12 +129,10 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
-
- /* step 2: calculate total size of all arrays */
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- bool include_array = (arrays & (1UL << i)) > 0;
-- struct bpil_array_desc *desc;
- __u32 count, size;
-
-- desc = bpil_array_desc + i;
--
- /* kernel is too old to support this field */
- if (info_len < desc->array_offset + sizeof(__u32) ||
- info_len < desc->count_offset + sizeof(__u32) ||
-@@ -163,13 +161,12 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- ptr = info_linear->data;
-
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u32 count, size;
-
- if ((arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- count = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
- size = bpf_prog_info_read_offset_u32(&info, desc->size_offset);
- bpf_prog_info_set_offset_u32(&info_linear->info,
-@@ -192,13 +189,12 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
-
- /* step 6: verify the data */
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u32 v1, v2;
-
- if ((arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- v1 = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
- v2 = bpf_prog_info_read_offset_u32(&info_linear->info,
- desc->count_offset);
-@@ -224,13 +220,12 @@ void bpil_addr_to_offs(struct perf_bpil *info_linear)
- int i;
-
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u64 addr, offs;
-
- if ((info_linear->arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- addr = bpf_prog_info_read_offset_u64(&info_linear->info,
- desc->array_offset);
- offs = addr - ptr_to_u64(info_linear->data);
-@@ -244,13 +239,12 @@ void bpil_offs_to_addr(struct perf_bpil *info_linear)
- int i;
-
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u64 addr, offs;
-
- if ((info_linear->arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- offs = bpf_prog_info_read_offset_u64(&info_linear->info,
- desc->array_offset);
- addr = offs + ptr_to_u64(info_linear->data);
---
-2.51.0
-
+++ /dev/null
-From b868c41330df913dd57463a94ec2adea26b88a5d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Sep 2025 11:17:13 -0700
-Subject: perf bpf-utils: Harden get_bpf_prog_info_linear
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 01be43f2a0eaeed83e94dee054742f37625c86d9 ]
-
-In get_bpf_prog_info_linear two calls to bpf_obj_get_info_by_fd are
-made, the first to compute memory requirements for a struct perf_bpil
-and the second to fill it in. Previously the code would warn when the
-second call didn't match the first. Such races can be common place in
-things like perf test, whose perf trace tests will frequently load BPF
-programs. Rather than a debug message, return actual errors for this
-case. Out of paranoia also validate the read bpf_prog_info array
-value. Change the type of ptr to avoid mismatched pointer type
-compiler warnings. Add some additional debug print outs and sanity
-asserts.
-
-Closes: https://lore.kernel.org/lkml/CAP-5=fWJQcmUOP7MuCA2ihKnDAHUCOBLkQFEkQES-1ZZTrgf8Q@mail.gmail.com/
-Fixes: 6ac22d036f86 ("perf bpf: Pull in bpf_program__get_prog_info_linear()")
-Reviewed-by: Namhyung Kim <namhyung@kernel.org>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Link: https://lore.kernel.org/r/20250902181713.309797-4-irogers@google.com
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/bpf-utils.c | 43 ++++++++++++++++++++++++++++---------
- 1 file changed, 33 insertions(+), 10 deletions(-)
-
-diff --git a/tools/perf/util/bpf-utils.c b/tools/perf/util/bpf-utils.c
-index 64a5583446964..5a66dc8594aa8 100644
---- a/tools/perf/util/bpf-utils.c
-+++ b/tools/perf/util/bpf-utils.c
-@@ -115,7 +115,7 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- __u32 info_len = sizeof(info);
- __u32 data_len = 0;
- int i, err;
-- void *ptr;
-+ __u8 *ptr;
-
- if (arrays >> PERF_BPIL_LAST_ARRAY)
- return ERR_PTR(-EINVAL);
-@@ -126,6 +126,8 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- pr_debug("can't get prog info: %s", strerror(errno));
- return ERR_PTR(-EFAULT);
- }
-+ if (info.type >= __MAX_BPF_PROG_TYPE)
-+ pr_debug("%s:%d: unexpected program type %u\n", __func__, __LINE__, info.type);
-
- /* step 2: calculate total size of all arrays */
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-@@ -173,6 +175,8 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- desc->count_offset, count);
- bpf_prog_info_set_offset_u32(&info_linear->info,
- desc->size_offset, size);
-+ assert(ptr >= info_linear->data);
-+ assert(ptr < &info_linear->data[data_len]);
- bpf_prog_info_set_offset_u64(&info_linear->info,
- desc->array_offset,
- ptr_to_u64(ptr));
-@@ -186,26 +190,45 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- free(info_linear);
- return ERR_PTR(-EFAULT);
- }
-+ if (info_linear->info.type >= __MAX_BPF_PROG_TYPE) {
-+ pr_debug("%s:%d: unexpected program type %u\n",
-+ __func__, __LINE__, info_linear->info.type);
-+ }
-
- /* step 6: verify the data */
-+ ptr = info_linear->data;
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
- const struct bpil_array_desc *desc = &bpil_array_desc[i];
-- __u32 v1, v2;
-+ __u32 count1, count2, size1, size2;
-+ __u64 ptr2;
-
- if ((arrays & (1UL << i)) == 0)
- continue;
-
-- v1 = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
-- v2 = bpf_prog_info_read_offset_u32(&info_linear->info,
-+ count1 = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
-+ count2 = bpf_prog_info_read_offset_u32(&info_linear->info,
- desc->count_offset);
-- if (v1 != v2)
-- pr_warning("%s: mismatch in element count\n", __func__);
-+ if (count1 != count2) {
-+ pr_warning("%s: mismatch in element count %u vs %u\n", __func__, count1, count2);
-+ free(info_linear);
-+ return ERR_PTR(-ERANGE);
-+ }
-
-- v1 = bpf_prog_info_read_offset_u32(&info, desc->size_offset);
-- v2 = bpf_prog_info_read_offset_u32(&info_linear->info,
-+ size1 = bpf_prog_info_read_offset_u32(&info, desc->size_offset);
-+ size2 = bpf_prog_info_read_offset_u32(&info_linear->info,
- desc->size_offset);
-- if (v1 != v2)
-- pr_warning("%s: mismatch in rec size\n", __func__);
-+ if (size1 != size2) {
-+ pr_warning("%s: mismatch in rec size %u vs %u\n", __func__, size1, size2);
-+ free(info_linear);
-+ return ERR_PTR(-ERANGE);
-+ }
-+ ptr2 = bpf_prog_info_read_offset_u64(&info_linear->info, desc->array_offset);
-+ if (ptr_to_u64(ptr) != ptr2) {
-+ pr_warning("%s: mismatch in array %p vs %llx\n", __func__, ptr, ptr2);
-+ free(info_linear);
-+ return ERR_PTR(-ERANGE);
-+ }
-+ ptr += roundup(count1 * size1, sizeof(__u64));
- }
-
- /* step 7: update info_len and data_len */
---
-2.51.0
-
spi-spi-fsl-lpspi-set-correct-chip-select-polarity-b.patch
spi-spi-fsl-lpspi-reset-fifo-and-disable-module-on-t.patch
drm-bridge-ti-sn65dsi86-fix-refclk-setting.patch
-perf-bpf-utils-constify-bpil_array_desc.patch
-perf-bpf-utils-harden-get_bpf_prog_info_linear.patch
drm-amdgpu-optimize-ras-ta-initialization-and-ta-unl.patch
drm-amdgpu-remove-the-check-of-init-status-in-psp_ra.patch
drm-amd-amdgpu-fix-style-problems-in-amdgpu_psp.c.patch
+++ /dev/null
-From de76efe03d963e6bf4dca34c0eefc6e1d8e82e94 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Sep 2025 11:17:12 -0700
-Subject: perf bpf-utils: Constify bpil_array_desc
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 1654a0e4d576d9e43fbb10ccf6a1b307c5c18566 ]
-
-The array's contents is a compile time constant. Constify to make the
-code more intention revealing and avoid unintended errors.
-
-Reviewed-by: Namhyung Kim <namhyung@kernel.org>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Link: https://lore.kernel.org/r/20250902181713.309797-3-irogers@google.com
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Stable-dep-of: 01be43f2a0ea ("perf bpf-utils: Harden get_bpf_prog_info_linear")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/bpf-utils.c | 18 ++++++------------
- 1 file changed, 6 insertions(+), 12 deletions(-)
-
-diff --git a/tools/perf/util/bpf-utils.c b/tools/perf/util/bpf-utils.c
-index 80b1d2b3729ba..64a5583446964 100644
---- a/tools/perf/util/bpf-utils.c
-+++ b/tools/perf/util/bpf-utils.c
-@@ -20,7 +20,7 @@ struct bpil_array_desc {
- */
- };
-
--static struct bpil_array_desc bpil_array_desc[] = {
-+static const struct bpil_array_desc bpil_array_desc[] = {
- [PERF_BPIL_JITED_INSNS] = {
- offsetof(struct bpf_prog_info, jited_prog_insns),
- offsetof(struct bpf_prog_info, jited_prog_len),
-@@ -129,12 +129,10 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
-
- /* step 2: calculate total size of all arrays */
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- bool include_array = (arrays & (1UL << i)) > 0;
-- struct bpil_array_desc *desc;
- __u32 count, size;
-
-- desc = bpil_array_desc + i;
--
- /* kernel is too old to support this field */
- if (info_len < desc->array_offset + sizeof(__u32) ||
- info_len < desc->count_offset + sizeof(__u32) ||
-@@ -163,13 +161,12 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- ptr = info_linear->data;
-
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u32 count, size;
-
- if ((arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- count = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
- size = bpf_prog_info_read_offset_u32(&info, desc->size_offset);
- bpf_prog_info_set_offset_u32(&info_linear->info,
-@@ -192,13 +189,12 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
-
- /* step 6: verify the data */
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u32 v1, v2;
-
- if ((arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- v1 = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
- v2 = bpf_prog_info_read_offset_u32(&info_linear->info,
- desc->count_offset);
-@@ -224,13 +220,12 @@ void bpil_addr_to_offs(struct perf_bpil *info_linear)
- int i;
-
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u64 addr, offs;
-
- if ((info_linear->arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- addr = bpf_prog_info_read_offset_u64(&info_linear->info,
- desc->array_offset);
- offs = addr - ptr_to_u64(info_linear->data);
-@@ -244,13 +239,12 @@ void bpil_offs_to_addr(struct perf_bpil *info_linear)
- int i;
-
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-- struct bpil_array_desc *desc;
-+ const struct bpil_array_desc *desc = &bpil_array_desc[i];
- __u64 addr, offs;
-
- if ((info_linear->arrays & (1UL << i)) == 0)
- continue;
-
-- desc = bpil_array_desc + i;
- offs = bpf_prog_info_read_offset_u64(&info_linear->info,
- desc->array_offset);
- addr = offs + ptr_to_u64(info_linear->data);
---
-2.51.0
-
+++ /dev/null
-From a2b018b9d5ca7983542823bdfac4585899bfb8d8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Sep 2025 11:17:13 -0700
-Subject: perf bpf-utils: Harden get_bpf_prog_info_linear
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 01be43f2a0eaeed83e94dee054742f37625c86d9 ]
-
-In get_bpf_prog_info_linear two calls to bpf_obj_get_info_by_fd are
-made, the first to compute memory requirements for a struct perf_bpil
-and the second to fill it in. Previously the code would warn when the
-second call didn't match the first. Such races can be common place in
-things like perf test, whose perf trace tests will frequently load BPF
-programs. Rather than a debug message, return actual errors for this
-case. Out of paranoia also validate the read bpf_prog_info array
-value. Change the type of ptr to avoid mismatched pointer type
-compiler warnings. Add some additional debug print outs and sanity
-asserts.
-
-Closes: https://lore.kernel.org/lkml/CAP-5=fWJQcmUOP7MuCA2ihKnDAHUCOBLkQFEkQES-1ZZTrgf8Q@mail.gmail.com/
-Fixes: 6ac22d036f86 ("perf bpf: Pull in bpf_program__get_prog_info_linear()")
-Reviewed-by: Namhyung Kim <namhyung@kernel.org>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Link: https://lore.kernel.org/r/20250902181713.309797-4-irogers@google.com
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/bpf-utils.c | 43 ++++++++++++++++++++++++++++---------
- 1 file changed, 33 insertions(+), 10 deletions(-)
-
-diff --git a/tools/perf/util/bpf-utils.c b/tools/perf/util/bpf-utils.c
-index 64a5583446964..5a66dc8594aa8 100644
---- a/tools/perf/util/bpf-utils.c
-+++ b/tools/perf/util/bpf-utils.c
-@@ -115,7 +115,7 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- __u32 info_len = sizeof(info);
- __u32 data_len = 0;
- int i, err;
-- void *ptr;
-+ __u8 *ptr;
-
- if (arrays >> PERF_BPIL_LAST_ARRAY)
- return ERR_PTR(-EINVAL);
-@@ -126,6 +126,8 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- pr_debug("can't get prog info: %s", strerror(errno));
- return ERR_PTR(-EFAULT);
- }
-+ if (info.type >= __MAX_BPF_PROG_TYPE)
-+ pr_debug("%s:%d: unexpected program type %u\n", __func__, __LINE__, info.type);
-
- /* step 2: calculate total size of all arrays */
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
-@@ -173,6 +175,8 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- desc->count_offset, count);
- bpf_prog_info_set_offset_u32(&info_linear->info,
- desc->size_offset, size);
-+ assert(ptr >= info_linear->data);
-+ assert(ptr < &info_linear->data[data_len]);
- bpf_prog_info_set_offset_u64(&info_linear->info,
- desc->array_offset,
- ptr_to_u64(ptr));
-@@ -186,26 +190,45 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
- free(info_linear);
- return ERR_PTR(-EFAULT);
- }
-+ if (info_linear->info.type >= __MAX_BPF_PROG_TYPE) {
-+ pr_debug("%s:%d: unexpected program type %u\n",
-+ __func__, __LINE__, info_linear->info.type);
-+ }
-
- /* step 6: verify the data */
-+ ptr = info_linear->data;
- for (i = PERF_BPIL_FIRST_ARRAY; i < PERF_BPIL_LAST_ARRAY; ++i) {
- const struct bpil_array_desc *desc = &bpil_array_desc[i];
-- __u32 v1, v2;
-+ __u32 count1, count2, size1, size2;
-+ __u64 ptr2;
-
- if ((arrays & (1UL << i)) == 0)
- continue;
-
-- v1 = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
-- v2 = bpf_prog_info_read_offset_u32(&info_linear->info,
-+ count1 = bpf_prog_info_read_offset_u32(&info, desc->count_offset);
-+ count2 = bpf_prog_info_read_offset_u32(&info_linear->info,
- desc->count_offset);
-- if (v1 != v2)
-- pr_warning("%s: mismatch in element count\n", __func__);
-+ if (count1 != count2) {
-+ pr_warning("%s: mismatch in element count %u vs %u\n", __func__, count1, count2);
-+ free(info_linear);
-+ return ERR_PTR(-ERANGE);
-+ }
-
-- v1 = bpf_prog_info_read_offset_u32(&info, desc->size_offset);
-- v2 = bpf_prog_info_read_offset_u32(&info_linear->info,
-+ size1 = bpf_prog_info_read_offset_u32(&info, desc->size_offset);
-+ size2 = bpf_prog_info_read_offset_u32(&info_linear->info,
- desc->size_offset);
-- if (v1 != v2)
-- pr_warning("%s: mismatch in rec size\n", __func__);
-+ if (size1 != size2) {
-+ pr_warning("%s: mismatch in rec size %u vs %u\n", __func__, size1, size2);
-+ free(info_linear);
-+ return ERR_PTR(-ERANGE);
-+ }
-+ ptr2 = bpf_prog_info_read_offset_u64(&info_linear->info, desc->array_offset);
-+ if (ptr_to_u64(ptr) != ptr2) {
-+ pr_warning("%s: mismatch in array %p vs %llx\n", __func__, ptr, ptr2);
-+ free(info_linear);
-+ return ERR_PTR(-ERANGE);
-+ }
-+ ptr += roundup(count1 * size1, sizeof(__u64));
- }
-
- /* step 7: update info_len and data_len */
---
-2.51.0
-
spi-spi-fsl-lpspi-clear-status-register-after-disabl.patch
drm-bridge-ti-sn65dsi86-fix-refclk-setting.patch
perf-bpf-event-fix-use-after-free-in-synthesis.patch
-perf-bpf-utils-constify-bpil_array_desc.patch
-perf-bpf-utils-harden-get_bpf_prog_info_linear.patch
drm-amdgpu-replace-drm_-with-dev_-in-amdgpu_psp.c.patch
drm-amd-amdgpu-fix-missing-error-return-on-kzalloc-f.patch
tools-gpio-rm-.-.cmd-on-make-clean.patch