* [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample()
@ 2026-09-15 9:11 Dapeng Mi
2026-09-15 9:11 ` [PATCH 2/2] perf util: Explicitly include required headers Dapeng Mi
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Dapeng Mi @ 2026-09-15 9:11 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin
Cc: linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas,
Dapeng Mi, Xudong Hao, Dapeng Mi
Currently the SIMD register sampling is supported, but the corresponding
handling is missed in aslr_tool__process_sample(). This can break parsing
of the sample record.
Add the missing SIMD register handling in aslr_tool__process_sample().
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
---
These two patches fix Sashiko reported defects for the patchset:
"Perf tools: Support eGPRs/SSP/SIMD registers sampling"
https://lore.kernel.org/all/20260914014049.2061519-1-dapeng1.mi@linux.intel.com/
tools/perf/util/aslr.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c
index 027695d96779..a097084201a0 100644
--- a/tools/perf/util/aslr.c
+++ b/tools/perf/util/aslr.c
@@ -19,6 +19,7 @@
#include <internal/lib.h> /* page_size */
#include <linux/compiler.h>
#include <linux/zalloc.h>
+#include <linux/overflow.h>
#include <errno.h>
#include <inttypes.h>
#include <unistd.h>
@@ -992,6 +993,34 @@ static int aslr_tool__process_sample(const struct perf_tool *tool,
COPY_U64();
}
}
+
+#define CHECK_SIMD() \
+ do { \
+ if (abi & PERF_SAMPLE_REGS_ABI_SIMD) { \
+ u64 nr_vector, vec_qwords; \
+ u64 nr_pred, pred_qwords; \
+ u64 header_len, vec_len, pred_len, simd_len; \
+ if (CHECK_BOUNDS(nr + 4, nr + 4)) { \
+ ret = -EFAULT; \
+ goto out_put; \
+ } \
+ header_len = 4; \
+ nr_vector = in_array[i + nr]; \
+ vec_qwords = in_array[i + nr + 1]; \
+ nr_pred = in_array[i + nr + 2]; \
+ pred_qwords = in_array[i + nr + 3]; \
+ if (check_mul_overflow(nr_vector, vec_qwords, &vec_len) || \
+ check_mul_overflow(nr_pred, pred_qwords, &pred_len) || \
+ check_add_overflow(vec_len, pred_len, &simd_len) || \
+ check_add_overflow(header_len, simd_len, &simd_len) || \
+ check_add_overflow(nr, simd_len, &nr) || \
+ nr > max_i - i) { \
+ ret = -EFAULT; \
+ goto out_put; \
+ } \
+ } \
+ } while (0)
+
if (orig_sample_type & PERF_SAMPLE_REGS_USER) {
u64 abi;
@@ -1007,6 +1036,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool,
ret = -EFAULT;
goto out_put;
}
+ CHECK_SIMD();
i += nr;
}
}
@@ -1061,6 +1091,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool,
ret = -EFAULT;
goto out_put;
}
+ CHECK_SIMD();
i += nr;
}
}
base-commit: 91b0782fc9e9d2f0a40b5256146e014802fdbb36
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 2/2] perf util: Explicitly include required headers 2026-09-15 9:11 [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() Dapeng Mi @ 2026-09-15 9:11 ` Dapeng Mi 2026-09-15 9:23 ` sashiko-bot 2026-09-21 16:23 ` Ian Rogers 2026-09-15 9:24 ` [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() sashiko-bot 2026-09-21 6:42 ` Mi, Dapeng 2 siblings, 2 replies; 11+ messages in thread From: Dapeng Mi @ 2026-09-15 9:11 UTC (permalink / raw) To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin Cc: linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao, Dapeng Mi Sashiko complains "the perf tool can be compiled with musl libc, which enforces strict POSIX namespace separation and does not implicitly include headers. Relying on implicit header inclusion can cause build failures under musl." Include the required headers explicitly to avoid such failures. Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> --- tools/perf/util/parse-regs-options.c | 1 + tools/perf/util/perf-regs-arch/perf_regs_x86.c | 2 ++ tools/perf/util/session.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c index 709fcfb077a2..e70393388fae 100644 --- a/tools/perf/util/parse-regs-options.c +++ b/tools/perf/util/parse-regs-options.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <stdint.h> #include <string.h> +#include <strings.h> #include <stdio.h> #include "util/debug.h" #include <dwarf-regs.h> diff --git a/tools/perf/util/perf-regs-arch/perf_regs_x86.c b/tools/perf/util/perf-regs-arch/perf_regs_x86.c index fb6cf34f42f2..ea1d402b0893 100644 --- a/tools/perf/util/perf-regs-arch/perf_regs_x86.c +++ b/tools/perf/util/perf-regs-arch/perf_regs_x86.c @@ -3,6 +3,8 @@ #include <errno.h> #include <string.h> #include <regex.h> +#include <unistd.h> +#include <stdbool.h> #include <linux/kernel.h> #include <linux/zalloc.h> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index a5b596cd14be..04fba6fb02e8 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1,4 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include <assert.h> #include <errno.h> #include <signal.h> #include <inttypes.h> -- 2.34.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] perf util: Explicitly include required headers 2026-09-15 9:11 ` [PATCH 2/2] perf util: Explicitly include required headers Dapeng Mi @ 2026-09-15 9:23 ` sashiko-bot 2026-09-21 16:23 ` Ian Rogers 1 sibling, 0 replies; 11+ messages in thread From: sashiko-bot @ 2026-09-15 9:23 UTC (permalink / raw) To: Dapeng Mi; +Cc: linux-perf-users > Sashiko complains "the perf tool can be compiled with musl libc, which > enforces strict POSIX namespace separation and does not implicitly > include headers. Relying on implicit header inclusion can cause build > failures under musl." > > Include the required headers explicitly to avoid such failures. > > Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/20260915091112.333308-1-dapeng1.mi@linux.intel.com?part=2 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] perf util: Explicitly include required headers 2026-09-15 9:11 ` [PATCH 2/2] perf util: Explicitly include required headers Dapeng Mi 2026-09-15 9:23 ` sashiko-bot @ 2026-09-21 16:23 ` Ian Rogers 1 sibling, 0 replies; 11+ messages in thread From: Ian Rogers @ 2026-09-21 16:23 UTC (permalink / raw) To: Dapeng Mi Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter, Alexander Shishkin, linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao On Tue, Sep 15, 2026 at 2:18 AM Dapeng Mi <dapeng1.mi@linux.intel.com> wrote: > > Sashiko complains "the perf tool can be compiled with musl libc, which > enforces strict POSIX namespace separation and does not implicitly > include headers. Relying on implicit header inclusion can cause build > failures under musl." > > Include the required headers explicitly to avoid such failures. > > Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Reviewed-by: Ian Rogers <irogers@google.com> Thanks, Ian > --- > tools/perf/util/parse-regs-options.c | 1 + > tools/perf/util/perf-regs-arch/perf_regs_x86.c | 2 ++ > tools/perf/util/session.c | 5 +++++ > 3 files changed, 8 insertions(+) > > diff --git a/tools/perf/util/parse-regs-options.c b/tools/perf/util/parse-regs-options.c > index 709fcfb077a2..e70393388fae 100644 > --- a/tools/perf/util/parse-regs-options.c > +++ b/tools/perf/util/parse-regs-options.c > @@ -3,6 +3,7 @@ > #include <stdlib.h> > #include <stdint.h> > #include <string.h> > +#include <strings.h> > #include <stdio.h> > #include "util/debug.h" > #include <dwarf-regs.h> > diff --git a/tools/perf/util/perf-regs-arch/perf_regs_x86.c b/tools/perf/util/perf-regs-arch/perf_regs_x86.c > index fb6cf34f42f2..ea1d402b0893 100644 > --- a/tools/perf/util/perf-regs-arch/perf_regs_x86.c > +++ b/tools/perf/util/perf-regs-arch/perf_regs_x86.c > @@ -3,6 +3,8 @@ > #include <errno.h> > #include <string.h> > #include <regex.h> > +#include <unistd.h> > +#include <stdbool.h> > #include <linux/kernel.h> > #include <linux/zalloc.h> > > diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c > index a5b596cd14be..04fba6fb02e8 100644 > --- a/tools/perf/util/session.c > +++ b/tools/perf/util/session.c > @@ -1,4 +1,9 @@ > // SPDX-License-Identifier: GPL-2.0 > +#include <stdio.h> > +#include <stdlib.h> > +#include <stdbool.h> > +#include <string.h> > +#include <assert.h> > #include <errno.h> > #include <signal.h> > #include <inttypes.h> > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() 2026-09-15 9:11 [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() Dapeng Mi 2026-09-15 9:11 ` [PATCH 2/2] perf util: Explicitly include required headers Dapeng Mi @ 2026-09-15 9:24 ` sashiko-bot 2026-09-21 6:42 ` Mi, Dapeng 2 siblings, 0 replies; 11+ messages in thread From: sashiko-bot @ 2026-09-15 9:24 UTC (permalink / raw) To: Dapeng Mi; +Cc: linux-perf-users > Currently the SIMD register sampling is supported, but the corresponding > handling is missed in aslr_tool__process_sample(). This can break parsing > of the sample record. > > Add the missing SIMD register handling in aslr_tool__process_sample(). > > Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/20260915091112.333308-1-dapeng1.mi@linux.intel.com?part=1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() 2026-09-15 9:11 [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() Dapeng Mi 2026-09-15 9:11 ` [PATCH 2/2] perf util: Explicitly include required headers Dapeng Mi 2026-09-15 9:24 ` [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() sashiko-bot @ 2026-09-21 6:42 ` Mi, Dapeng 2026-09-21 16:21 ` Ian Rogers 2 siblings, 1 reply; 11+ messages in thread From: Mi, Dapeng @ 2026-09-21 6:42 UTC (permalink / raw) To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin Cc: linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao Kindly ping ... @Arnaldo, @Namhyung, @Ian, not sure if you have bandwidth to review this small patchset which fixes the Sashiko found minor issues for the "Perf tools: Support eGPRs/SSP/SIMD registers sampling" patchset? If possible, it's better to be queued in this cycle, then we don't need extra backporting. Thanks. On 9/15/2026 5:11 PM, Dapeng Mi wrote: > Currently the SIMD register sampling is supported, but the corresponding > handling is missed in aslr_tool__process_sample(). This can break parsing > of the sample record. > > Add the missing SIMD register handling in aslr_tool__process_sample(). > > Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> > --- > > These two patches fix Sashiko reported defects for the patchset: > "Perf tools: Support eGPRs/SSP/SIMD registers sampling" > https://lore.kernel.org/all/20260914014049.2061519-1-dapeng1.mi@linux.intel.com/ > > tools/perf/util/aslr.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c > index 027695d96779..a097084201a0 100644 > --- a/tools/perf/util/aslr.c > +++ b/tools/perf/util/aslr.c > @@ -19,6 +19,7 @@ > #include <internal/lib.h> /* page_size */ > #include <linux/compiler.h> > #include <linux/zalloc.h> > +#include <linux/overflow.h> > #include <errno.h> > #include <inttypes.h> > #include <unistd.h> > @@ -992,6 +993,34 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > COPY_U64(); > } > } > + > +#define CHECK_SIMD() \ > + do { \ > + if (abi & PERF_SAMPLE_REGS_ABI_SIMD) { \ > + u64 nr_vector, vec_qwords; \ > + u64 nr_pred, pred_qwords; \ > + u64 header_len, vec_len, pred_len, simd_len; \ > + if (CHECK_BOUNDS(nr + 4, nr + 4)) { \ > + ret = -EFAULT; \ > + goto out_put; \ > + } \ > + header_len = 4; \ > + nr_vector = in_array[i + nr]; \ > + vec_qwords = in_array[i + nr + 1]; \ > + nr_pred = in_array[i + nr + 2]; \ > + pred_qwords = in_array[i + nr + 3]; \ > + if (check_mul_overflow(nr_vector, vec_qwords, &vec_len) || \ > + check_mul_overflow(nr_pred, pred_qwords, &pred_len) || \ > + check_add_overflow(vec_len, pred_len, &simd_len) || \ > + check_add_overflow(header_len, simd_len, &simd_len) || \ > + check_add_overflow(nr, simd_len, &nr) || \ > + nr > max_i - i) { \ > + ret = -EFAULT; \ > + goto out_put; \ > + } \ > + } \ > + } while (0) > + > if (orig_sample_type & PERF_SAMPLE_REGS_USER) { > u64 abi; > > @@ -1007,6 +1036,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > ret = -EFAULT; > goto out_put; > } > + CHECK_SIMD(); > i += nr; > } > } > @@ -1061,6 +1091,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > ret = -EFAULT; > goto out_put; > } > + CHECK_SIMD(); > i += nr; > } > } > > base-commit: 91b0782fc9e9d2f0a40b5256146e014802fdbb36 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() 2026-09-21 6:42 ` Mi, Dapeng @ 2026-09-21 16:21 ` Ian Rogers 2026-09-21 16:22 ` Ian Rogers 2026-09-22 0:30 ` Mi, Dapeng 0 siblings, 2 replies; 11+ messages in thread From: Ian Rogers @ 2026-09-21 16:21 UTC (permalink / raw) To: Mi, Dapeng Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter, Alexander Shishkin, linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao On Sun, Sep 20, 2026 at 11:42 PM Mi, Dapeng <dapeng1.mi@linux.intel.com> wrote: > > Kindly ping ... > > @Arnaldo, @Namhyung, @Ian, not sure if you have bandwidth to review this > small patchset which fixes the Sashiko found minor issues for the "Perf > tools: Support eGPRs/SSP/SIMD registers sampling" patchset? > > If possible, it's better to be queued in this cycle, then we don't need > extra backporting. Thanks. Reviewed-by: Ian Rogers <irogers@google.com> > On 9/15/2026 5:11 PM, Dapeng Mi wrote: > > Currently the SIMD register sampling is supported, but the corresponding > > handling is missed in aslr_tool__process_sample(). This can break parsing > > of the sample record. > > > > Add the missing SIMD register handling in aslr_tool__process_sample(). > > > > Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> > > --- > > > > These two patches fix Sashiko reported defects for the patchset: > > "Perf tools: Support eGPRs/SSP/SIMD registers sampling" > > https://lore.kernel.org/all/20260914014049.2061519-1-dapeng1.mi@linux.intel.com/ > > > > tools/perf/util/aslr.c | 31 +++++++++++++++++++++++++++++++ > > 1 file changed, 31 insertions(+) > > > > diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c > > index 027695d96779..a097084201a0 100644 > > --- a/tools/perf/util/aslr.c > > +++ b/tools/perf/util/aslr.c > > @@ -19,6 +19,7 @@ > > #include <internal/lib.h> /* page_size */ > > #include <linux/compiler.h> > > #include <linux/zalloc.h> > > +#include <linux/overflow.h> > > #include <errno.h> > > #include <inttypes.h> > > #include <unistd.h> > > @@ -992,6 +993,34 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > > COPY_U64(); > > } > > } > > + > > +#define CHECK_SIMD() \ > > + do { \ > > + if (abi & PERF_SAMPLE_REGS_ABI_SIMD) { \ > > + u64 nr_vector, vec_qwords; \ > > + u64 nr_pred, pred_qwords; \ > > + u64 header_len, vec_len, pred_len, simd_len; \ > > + if (CHECK_BOUNDS(nr + 4, nr + 4)) { \ > > + ret = -EFAULT; \ > > + goto out_put; \ > > + } \ > > + header_len = 4; \ > > + nr_vector = in_array[i + nr]; \ > > + vec_qwords = in_array[i + nr + 1]; \ > > + nr_pred = in_array[i + nr + 2]; \ > > + pred_qwords = in_array[i + nr + 3]; \ > > + if (check_mul_overflow(nr_vector, vec_qwords, &vec_len) || \ > > + check_mul_overflow(nr_pred, pred_qwords, &pred_len) || \ > > + check_add_overflow(vec_len, pred_len, &simd_len) || \ > > + check_add_overflow(header_len, simd_len, &simd_len) || \ > > + check_add_overflow(nr, simd_len, &nr) || \ > > + nr > max_i - i) { \ > > + ret = -EFAULT; \ > > + goto out_put; \ > > + } \ > > + } \ > > + } while (0) > > + > > if (orig_sample_type & PERF_SAMPLE_REGS_USER) { > > u64 abi; > > > > @@ -1007,6 +1036,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > > ret = -EFAULT; > > goto out_put; > > } > > + CHECK_SIMD(); > > i += nr; > > } > > } > > @@ -1061,6 +1091,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > > ret = -EFAULT; > > goto out_put; > > } > > + CHECK_SIMD(); nit: at the end of the function you could #undef CHECK_SIMD to make it more explicit that the macro only makes sense within the function. Thanks, Ian > > i += nr; > > } > > } > > > > base-commit: 91b0782fc9e9d2f0a40b5256146e014802fdbb36 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() 2026-09-21 16:21 ` Ian Rogers @ 2026-09-21 16:22 ` Ian Rogers 2026-09-22 0:31 ` Mi, Dapeng 2026-09-22 12:50 ` Arnaldo Carvalho de Melo 2026-09-22 0:30 ` Mi, Dapeng 1 sibling, 2 replies; 11+ messages in thread From: Ian Rogers @ 2026-09-21 16:22 UTC (permalink / raw) To: Mi, Dapeng Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter, Alexander Shishkin, linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao On Mon, Sep 21, 2026 at 9:21 AM Ian Rogers <irogers@google.com> wrote: > > On Sun, Sep 20, 2026 at 11:42 PM Mi, Dapeng <dapeng1.mi@linux.intel.com> wrote: > > > > Kindly ping ... > > > > @Arnaldo, @Namhyung, @Ian, not sure if you have bandwidth to review this > > small patchset which fixes the Sashiko found minor issues for the "Perf > > tools: Support eGPRs/SSP/SIMD registers sampling" patchset? > > > > If possible, it's better to be queued in this cycle, then we don't need > > extra backporting. Thanks. > > Reviewed-by: Ian Rogers <irogers@google.com> Oh, another nit: there's a typo in the commit message subject: s/alsr/aslr/g. Thanks, Ian > > On 9/15/2026 5:11 PM, Dapeng Mi wrote: > > > Currently the SIMD register sampling is supported, but the corresponding > > > handling is missed in aslr_tool__process_sample(). This can break parsing > > > of the sample record. > > > > > > Add the missing SIMD register handling in aslr_tool__process_sample(). > > > > > > Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> > > > --- > > > > > > These two patches fix Sashiko reported defects for the patchset: > > > "Perf tools: Support eGPRs/SSP/SIMD registers sampling" > > > https://lore.kernel.org/all/20260914014049.2061519-1-dapeng1.mi@linux.intel.com/ > > > > > > tools/perf/util/aslr.c | 31 +++++++++++++++++++++++++++++++ > > > 1 file changed, 31 insertions(+) > > > > > > diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c > > > index 027695d96779..a097084201a0 100644 > > > --- a/tools/perf/util/aslr.c > > > +++ b/tools/perf/util/aslr.c > > > @@ -19,6 +19,7 @@ > > > #include <internal/lib.h> /* page_size */ > > > #include <linux/compiler.h> > > > #include <linux/zalloc.h> > > > +#include <linux/overflow.h> > > > #include <errno.h> > > > #include <inttypes.h> > > > #include <unistd.h> > > > @@ -992,6 +993,34 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > > > COPY_U64(); > > > } > > > } > > > + > > > +#define CHECK_SIMD() \ > > > + do { \ > > > + if (abi & PERF_SAMPLE_REGS_ABI_SIMD) { \ > > > + u64 nr_vector, vec_qwords; \ > > > + u64 nr_pred, pred_qwords; \ > > > + u64 header_len, vec_len, pred_len, simd_len; \ > > > + if (CHECK_BOUNDS(nr + 4, nr + 4)) { \ > > > + ret = -EFAULT; \ > > > + goto out_put; \ > > > + } \ > > > + header_len = 4; \ > > > + nr_vector = in_array[i + nr]; \ > > > + vec_qwords = in_array[i + nr + 1]; \ > > > + nr_pred = in_array[i + nr + 2]; \ > > > + pred_qwords = in_array[i + nr + 3]; \ > > > + if (check_mul_overflow(nr_vector, vec_qwords, &vec_len) || \ > > > + check_mul_overflow(nr_pred, pred_qwords, &pred_len) || \ > > > + check_add_overflow(vec_len, pred_len, &simd_len) || \ > > > + check_add_overflow(header_len, simd_len, &simd_len) || \ > > > + check_add_overflow(nr, simd_len, &nr) || \ > > > + nr > max_i - i) { \ > > > + ret = -EFAULT; \ > > > + goto out_put; \ > > > + } \ > > > + } \ > > > + } while (0) > > > + > > > if (orig_sample_type & PERF_SAMPLE_REGS_USER) { > > > u64 abi; > > > > > > @@ -1007,6 +1036,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > > > ret = -EFAULT; > > > goto out_put; > > > } > > > + CHECK_SIMD(); > > > i += nr; > > > } > > > } > > > @@ -1061,6 +1091,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, > > > ret = -EFAULT; > > > goto out_put; > > > } > > > + CHECK_SIMD(); > > nit: at the end of the function you could #undef CHECK_SIMD to make it > more explicit that the macro only makes sense within the function. > > Thanks, > Ian > > > > i += nr; > > > } > > > } > > > > > > base-commit: 91b0782fc9e9d2f0a40b5256146e014802fdbb36 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() 2026-09-21 16:22 ` Ian Rogers @ 2026-09-22 0:31 ` Mi, Dapeng 2026-09-22 12:50 ` Arnaldo Carvalho de Melo 1 sibling, 0 replies; 11+ messages in thread From: Mi, Dapeng @ 2026-09-22 0:31 UTC (permalink / raw) To: Ian Rogers Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter, Alexander Shishkin, linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao On 9/22/2026 12:22 AM, Ian Rogers wrote: > On Mon, Sep 21, 2026 at 9:21 AM Ian Rogers <irogers@google.com> wrote: >> On Sun, Sep 20, 2026 at 11:42 PM Mi, Dapeng <dapeng1.mi@linux.intel.com> wrote: >>> Kindly ping ... >>> >>> @Arnaldo, @Namhyung, @Ian, not sure if you have bandwidth to review this >>> small patchset which fixes the Sashiko found minor issues for the "Perf >>> tools: Support eGPRs/SSP/SIMD registers sampling" patchset? >>> >>> If possible, it's better to be queued in this cycle, then we don't need >>> extra backporting. Thanks. >> Reviewed-by: Ian Rogers <irogers@google.com> > Oh, another nit: there's a typo in the commit message subject: s/alsr/aslr/g. Sure. :) > > Thanks, > Ian > >>> On 9/15/2026 5:11 PM, Dapeng Mi wrote: >>>> Currently the SIMD register sampling is supported, but the corresponding >>>> handling is missed in aslr_tool__process_sample(). This can break parsing >>>> of the sample record. >>>> >>>> Add the missing SIMD register handling in aslr_tool__process_sample(). >>>> >>>> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> >>>> --- >>>> >>>> These two patches fix Sashiko reported defects for the patchset: >>>> "Perf tools: Support eGPRs/SSP/SIMD registers sampling" >>>> https://lore.kernel.org/all/20260914014049.2061519-1-dapeng1.mi@linux.intel.com/ >>>> >>>> tools/perf/util/aslr.c | 31 +++++++++++++++++++++++++++++++ >>>> 1 file changed, 31 insertions(+) >>>> >>>> diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c >>>> index 027695d96779..a097084201a0 100644 >>>> --- a/tools/perf/util/aslr.c >>>> +++ b/tools/perf/util/aslr.c >>>> @@ -19,6 +19,7 @@ >>>> #include <internal/lib.h> /* page_size */ >>>> #include <linux/compiler.h> >>>> #include <linux/zalloc.h> >>>> +#include <linux/overflow.h> >>>> #include <errno.h> >>>> #include <inttypes.h> >>>> #include <unistd.h> >>>> @@ -992,6 +993,34 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, >>>> COPY_U64(); >>>> } >>>> } >>>> + >>>> +#define CHECK_SIMD() \ >>>> + do { \ >>>> + if (abi & PERF_SAMPLE_REGS_ABI_SIMD) { \ >>>> + u64 nr_vector, vec_qwords; \ >>>> + u64 nr_pred, pred_qwords; \ >>>> + u64 header_len, vec_len, pred_len, simd_len; \ >>>> + if (CHECK_BOUNDS(nr + 4, nr + 4)) { \ >>>> + ret = -EFAULT; \ >>>> + goto out_put; \ >>>> + } \ >>>> + header_len = 4; \ >>>> + nr_vector = in_array[i + nr]; \ >>>> + vec_qwords = in_array[i + nr + 1]; \ >>>> + nr_pred = in_array[i + nr + 2]; \ >>>> + pred_qwords = in_array[i + nr + 3]; \ >>>> + if (check_mul_overflow(nr_vector, vec_qwords, &vec_len) || \ >>>> + check_mul_overflow(nr_pred, pred_qwords, &pred_len) || \ >>>> + check_add_overflow(vec_len, pred_len, &simd_len) || \ >>>> + check_add_overflow(header_len, simd_len, &simd_len) || \ >>>> + check_add_overflow(nr, simd_len, &nr) || \ >>>> + nr > max_i - i) { \ >>>> + ret = -EFAULT; \ >>>> + goto out_put; \ >>>> + } \ >>>> + } \ >>>> + } while (0) >>>> + >>>> if (orig_sample_type & PERF_SAMPLE_REGS_USER) { >>>> u64 abi; >>>> >>>> @@ -1007,6 +1036,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, >>>> ret = -EFAULT; >>>> goto out_put; >>>> } >>>> + CHECK_SIMD(); >>>> i += nr; >>>> } >>>> } >>>> @@ -1061,6 +1091,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, >>>> ret = -EFAULT; >>>> goto out_put; >>>> } >>>> + CHECK_SIMD(); >> nit: at the end of the function you could #undef CHECK_SIMD to make it >> more explicit that the macro only makes sense within the function. >> >> Thanks, >> Ian >> >>>> i += nr; >>>> } >>>> } >>>> >>>> base-commit: 91b0782fc9e9d2f0a40b5256146e014802fdbb36 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() 2026-09-21 16:22 ` Ian Rogers 2026-09-22 0:31 ` Mi, Dapeng @ 2026-09-22 12:50 ` Arnaldo Carvalho de Melo 1 sibling, 0 replies; 11+ messages in thread From: Arnaldo Carvalho de Melo @ 2026-09-22 12:50 UTC (permalink / raw) To: Ian Rogers Cc: Mi, Dapeng, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Adrian Hunter, Alexander Shishkin, linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao On Mon, Sep 21, 2026 at 09:22:11AM -0700, Ian Rogers wrote: > On Mon, Sep 21, 2026 at 9:21 AM Ian Rogers <irogers@google.com> wrote: > > > > On Sun, Sep 20, 2026 at 11:42 PM Mi, Dapeng <dapeng1.mi@linux.intel.com> wrote: > > > > > > Kindly ping ... > > > > > > @Arnaldo, @Namhyung, @Ian, not sure if you have bandwidth to review this > > > small patchset which fixes the Sashiko found minor issues for the "Perf > > > tools: Support eGPRs/SSP/SIMD registers sampling" patchset? > > > > > > If possible, it's better to be queued in this cycle, then we don't need > > > extra backporting. Thanks. > > > > Reviewed-by: Ian Rogers <irogers@google.com> > > Oh, another nit: there's a typo in the commit message subject: s/alsr/aslr/g. Fixed. Thanks, applied to perf-tools-next, for v7.4. - Arnaldo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() 2026-09-21 16:21 ` Ian Rogers 2026-09-21 16:22 ` Ian Rogers @ 2026-09-22 0:30 ` Mi, Dapeng 1 sibling, 0 replies; 11+ messages in thread From: Mi, Dapeng @ 2026-09-22 0:30 UTC (permalink / raw) To: Ian Rogers Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Adrian Hunter, Alexander Shishkin, linux-perf-users, linux-kernel, Zide Chen, Falcon Thomas, Dapeng Mi, Xudong Hao On 9/22/2026 12:21 AM, Ian Rogers wrote: > On Sun, Sep 20, 2026 at 11:42 PM Mi, Dapeng <dapeng1.mi@linux.intel.com> wrote: >> Kindly ping ... >> >> @Arnaldo, @Namhyung, @Ian, not sure if you have bandwidth to review this >> small patchset which fixes the Sashiko found minor issues for the "Perf >> tools: Support eGPRs/SSP/SIMD registers sampling" patchset? >> >> If possible, it's better to be queued in this cycle, then we don't need >> extra backporting. Thanks. > Reviewed-by: Ian Rogers <irogers@google.com> > >> On 9/15/2026 5:11 PM, Dapeng Mi wrote: >>> Currently the SIMD register sampling is supported, but the corresponding >>> handling is missed in aslr_tool__process_sample(). This can break parsing >>> of the sample record. >>> >>> Add the missing SIMD register handling in aslr_tool__process_sample(). >>> >>> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> >>> --- >>> >>> These two patches fix Sashiko reported defects for the patchset: >>> "Perf tools: Support eGPRs/SSP/SIMD registers sampling" >>> https://lore.kernel.org/all/20260914014049.2061519-1-dapeng1.mi@linux.intel.com/ >>> >>> tools/perf/util/aslr.c | 31 +++++++++++++++++++++++++++++++ >>> 1 file changed, 31 insertions(+) >>> >>> diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c >>> index 027695d96779..a097084201a0 100644 >>> --- a/tools/perf/util/aslr.c >>> +++ b/tools/perf/util/aslr.c >>> @@ -19,6 +19,7 @@ >>> #include <internal/lib.h> /* page_size */ >>> #include <linux/compiler.h> >>> #include <linux/zalloc.h> >>> +#include <linux/overflow.h> >>> #include <errno.h> >>> #include <inttypes.h> >>> #include <unistd.h> >>> @@ -992,6 +993,34 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, >>> COPY_U64(); >>> } >>> } >>> + >>> +#define CHECK_SIMD() \ >>> + do { \ >>> + if (abi & PERF_SAMPLE_REGS_ABI_SIMD) { \ >>> + u64 nr_vector, vec_qwords; \ >>> + u64 nr_pred, pred_qwords; \ >>> + u64 header_len, vec_len, pred_len, simd_len; \ >>> + if (CHECK_BOUNDS(nr + 4, nr + 4)) { \ >>> + ret = -EFAULT; \ >>> + goto out_put; \ >>> + } \ >>> + header_len = 4; \ >>> + nr_vector = in_array[i + nr]; \ >>> + vec_qwords = in_array[i + nr + 1]; \ >>> + nr_pred = in_array[i + nr + 2]; \ >>> + pred_qwords = in_array[i + nr + 3]; \ >>> + if (check_mul_overflow(nr_vector, vec_qwords, &vec_len) || \ >>> + check_mul_overflow(nr_pred, pred_qwords, &pred_len) || \ >>> + check_add_overflow(vec_len, pred_len, &simd_len) || \ >>> + check_add_overflow(header_len, simd_len, &simd_len) || \ >>> + check_add_overflow(nr, simd_len, &nr) || \ >>> + nr > max_i - i) { \ >>> + ret = -EFAULT; \ >>> + goto out_put; \ >>> + } \ >>> + } \ >>> + } while (0) >>> + >>> if (orig_sample_type & PERF_SAMPLE_REGS_USER) { >>> u64 abi; >>> >>> @@ -1007,6 +1036,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, >>> ret = -EFAULT; >>> goto out_put; >>> } >>> + CHECK_SIMD(); >>> i += nr; >>> } >>> } >>> @@ -1061,6 +1091,7 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, >>> ret = -EFAULT; >>> goto out_put; >>> } >>> + CHECK_SIMD(); > nit: at the end of the function you could #undef CHECK_SIMD to make it > more explicit that the macro only makes sense within the function. Sure. Thanks. > > Thanks, > Ian > >>> i += nr; >>> } >>> } >>> >>> base-commit: 91b0782fc9e9d2f0a40b5256146e014802fdbb36 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-09-22 12:50 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-09-15 9:11 [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() Dapeng Mi 2026-09-15 9:11 ` [PATCH 2/2] perf util: Explicitly include required headers Dapeng Mi 2026-09-15 9:23 ` sashiko-bot 2026-09-21 16:23 ` Ian Rogers 2026-09-15 9:24 ` [PATCH 1/2] perf alsr: Add missing SIMD handling in aslr_tool__process_sample() sashiko-bot 2026-09-21 6:42 ` Mi, Dapeng 2026-09-21 16:21 ` Ian Rogers 2026-09-21 16:22 ` Ian Rogers 2026-09-22 0:31 ` Mi, Dapeng 2026-09-22 12:50 ` Arnaldo Carvalho de Melo 2026-09-22 0:30 ` Mi, Dapeng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox