[PATCH v6 08/26] perf trace: Stop at internal fields when walking syscall arguments
From: Ian Rogers
Date: Mon Sep 28 2026 - 14:35:32 EST
Since v6.19 syscall tracepoints may end with __data_loc char[] fields
holding user space strings, these aren't syscall arguments.
syscall__scnprintf_args() walks them anyway, printing the extra raw
syscall arguments at those indices under the internal field's name, and
trace__bpf_sys_enter_beauty_map() considers them when building the BPF
beauty map. The internal fields come after the arguments, so stop at the
first one.
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/builtin-trace.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 1ffe824ba670..35d39a3fe803 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2647,6 +2647,9 @@ static size_t syscall__scnprintf_args(struct syscall *sc, char *bf, size_t size,
for (field = sc->args; field;
field = field->next, ++arg.idx, bit <<= 1) {
+ if (is_internal_field(field))
+ break;
+
if (arg.mask & bit)
continue;
@@ -4134,6 +4137,9 @@ static int trace__bpf_sys_enter_beauty_map(struct trace *trace, int e_machine, i
return -1;
for (i = 0, field = sc->args; field; ++i, field = field->next) {
+ if (is_internal_field(field))
+ break;
+
// XXX We're only collecting pointer payloads _from_ user space
if (!sc->arg_fmt[i].from_user)
continue;
@@ -4188,6 +4194,8 @@ static int trace__bpf_sys_enter_beauty_map(struct trace *trace, int e_machine, i
/* find the size of the buffer that appears in pairs with buf */
for (j = 0, field_tmp = sc->args; field_tmp; ++j, field_tmp = field_tmp->next) {
+ if (is_internal_field(field_tmp))
+ break;
if (!(field_tmp->flags & TEP_FIELD_IS_POINTER) && /* only integers */
(strstr(field_tmp->name, "count") ||
strstr(field_tmp->name, "siz") || /* size, bufsiz */
--
2.56.0.rc1.315.gc6ed9934b7-goog