diff options
| -rw-r--r-- | tools/perf/builtin-trace.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 12356deb6046..2b99a02355cf 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
| @@ -1697,6 +1697,8 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, | |||
| 1697 | size_t printed = 0; | 1697 | size_t printed = 0; |
| 1698 | struct thread *thread; | 1698 | struct thread *thread; |
| 1699 | int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1; | 1699 | int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1; |
| 1700 | int augmented_args_size = 0; | ||
| 1701 | void *augmented_args = NULL; | ||
| 1700 | struct syscall *sc = trace__syscall_info(trace, evsel, id); | 1702 | struct syscall *sc = trace__syscall_info(trace, evsel, id); |
| 1701 | struct thread_trace *ttrace; | 1703 | struct thread_trace *ttrace; |
| 1702 | 1704 | ||
| @@ -1720,13 +1722,24 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, | |||
| 1720 | 1722 | ||
| 1721 | if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) | 1723 | if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) |
| 1722 | trace__printf_interrupted_entry(trace); | 1724 | trace__printf_interrupted_entry(trace); |
| 1723 | 1725 | /* | |
| 1726 | * If this is raw_syscalls.sys_enter, then it always comes with the 6 possible | ||
| 1727 | * arguments, even if the syscall being handled, say "openat", uses only 4 arguments | ||
| 1728 | * this breaks syscall__augmented_args() check for augmented args, as we calculate | ||
| 1729 | * syscall->args_size using each syscalls:sys_enter_NAME tracefs format file, | ||
| 1730 | * so when handling, say the openat syscall, we end up getting 6 args for the | ||
| 1731 | * raw_syscalls:sys_enter event, when we expected just 4, we end up mistakenly | ||
| 1732 | * thinking that the extra 2 u64 args are the augmented filename, so just check | ||
| 1733 | * here and avoid using augmented syscalls when the evsel is the raw_syscalls one. | ||
| 1734 | */ | ||
| 1735 | if (evsel != trace->syscalls.events.sys_enter) | ||
| 1736 | augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size); | ||
| 1724 | ttrace->entry_time = sample->time; | 1737 | ttrace->entry_time = sample->time; |
| 1725 | msg = ttrace->entry_str; | 1738 | msg = ttrace->entry_str; |
| 1726 | printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name); | 1739 | printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name); |
| 1727 | 1740 | ||
| 1728 | printed += syscall__scnprintf_args(sc, msg + printed, trace__entry_str_size - printed, | 1741 | printed += syscall__scnprintf_args(sc, msg + printed, trace__entry_str_size - printed, |
| 1729 | args, NULL, 0, trace, thread); | 1742 | args, augmented_args, augmented_args_size, trace, thread); |
| 1730 | 1743 | ||
| 1731 | if (sc->is_exit) { | 1744 | if (sc->is_exit) { |
| 1732 | if (!(trace->duration_filter || trace->summary_only || trace->failure_only || trace->min_stack)) { | 1745 | if (!(trace->duration_filter || trace->summary_only || trace->failure_only || trace->min_stack)) { |
