Hello community, here is the log from the commit of package perf for openSUSE:Factory checked in at 2020-10-02 17:37:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perf (Old) and /work/SRC/openSUSE:Factory/.perf.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perf" Fri Oct 2 17:37:26 2020 rev:55 rq:838951 version:MACRO Changes: -------- --- /work/SRC/openSUSE:Factory/perf/perf.changes 2020-09-22 21:16:13.452194133 +0200 +++ /work/SRC/openSUSE:Factory/.perf.new.4249/perf.changes 2020-10-02 17:37:40.578751965 +0200 @@ -1,0 +2,5 @@ +Thu Oct 1 10:22:13 UTC 2020 - Jiri Slaby <jsl...@suse.cz> + +- add 0001-perf-fix-off-by-ones-in-memset-after-realloc.patch (bsc#1177113) + +------------------------------------------------------------------- New: ---- 0001-perf-fix-off-by-ones-in-memset-after-realloc.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perf.spec ++++++ --- /var/tmp/diff_new_pack.nZT2rE/_old 2020-10-02 17:37:41.358752430 +0200 +++ /var/tmp/diff_new_pack.nZT2rE/_new 2020-10-02 17:37:41.362752433 +0200 @@ -36,6 +36,7 @@ License: GPL-2.0-only Group: Development/Tools/Debuggers URL: https://perf.wiki.kernel.org/ +Patch0: 0001-perf-fix-off-by-ones-in-memset-after-realloc.patch BuildRequires: OpenCSD-devel BuildRequires: audit-devel %ifnarch %{arm} ++++++ 0001-perf-fix-off-by-ones-in-memset-after-realloc.patch ++++++ From: Jiri Slaby <jsl...@suse.cz> Date: Thu, 1 Oct 2020 08:18:30 +0200 Subject: perf: fix off by ones in memset after realloc Patch-mainline: submitted 2020/10/01 References: bsc#1177113 'perf trace ls' started crashing after commit d21cb73a9025 on !HAVE_SYSCALL_TABLE_SUPPORT configs (armv7l here) like this: 0 strlen () at ../sysdeps/arm/armv6t2/strlen.S:126 1 0xb6800780 in __vfprintf_internal (s=0xbeff9908, s@entry=0xbeff9900, format=0xa27160 "]: %s()", ap=..., mode_flags=<optimized out>) at vfprintf-internal.c:1688 ... 5 0x0056ecdc in fprintf (__fmt=0xa27160 "]: %s()", __stream=<optimized out>) at /usr/include/bits/stdio2.h:100 6 trace__sys_exit (trace=trace@entry=0xbeffc710, evsel=evsel@entry=0xd968d0, event=<optimized out>, sample=sample@entry=0xbeffc3e8) at builtin-trace.c:2475 7 0x00566d40 in trace__handle_event (sample=0xbeffc3e8, event=<optimized out>, trace=0xbeffc710) at builtin-trace.c:3122 ... 15 main (argc=2, argv=0xbefff6e8) at perf.c:538 It is because memset in trace__read_syscall_info zeroes wrong memory: 1) when initializing for the first time, it does not reset the last id. 2) in other cases, it resets the last id of previous buffer. ad 1) it causes the crash above as sc->name used in the fprintf above contains garbage. ad 2) it sets nonexistent from true back to false for id 11 here. Not sure, what the consequences are. So fix it by introducing a special case for the initial initialization and do the right +1 in both cases. Signed-off-by: Jiri Slaby <jsl...@suse.cz> Fixes: d21cb73a9025 ("perf trace: Grow the syscall table as needed when using libaudit") Cc: Adrian Hunter <adrian.hun...@intel.com> Cc: Ingo Molnar <mi...@kernel.org> Cc: Jiri Olsa <jo...@kernel.org> Cc: Namhyung Kim <namhy...@kernel.org> Cc: Arnaldo Carvalho de Melo <a...@redhat.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Ingo Molnar <mi...@redhat.com> --- tools/perf/builtin-trace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index bea461b6f937..44a75f234db1 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1762,7 +1762,11 @@ static int trace__read_syscall_info(struct trace *trace, int id) if (table == NULL) return -ENOMEM; - memset(table + trace->sctbl->syscalls.max_id, 0, (id - trace->sctbl->syscalls.max_id) * sizeof(*sc)); + // Need to memset from offset 0 and +1 members if brand new + if (trace->syscalls.table == NULL) + memset(table, 0, (id + 1) * sizeof(*sc)); + else + memset(table + trace->sctbl->syscalls.max_id + 1, 0, (id - trace->sctbl->syscalls.max_id) * sizeof(*sc)); trace->syscalls.table = table; trace->sctbl->syscalls.max_id = id; -- 2.28.0