* [PATCH 1/1] riscv: Fix perf record without libelf support
@ 2019-07-11 2:38 Mao Han
2019-07-25 21:11 ` Paul Walmsley
0 siblings, 1 reply; 2+ messages in thread
From: Mao Han @ 2019-07-11 2:38 UTC (permalink / raw)
To: linux-kernel
Cc: linux-riscv, linux-csky, Mao Han, Paul Walmsley, Palmer Dabbelt,
Albert Ou
This patch fix following perf record error by linking vdso.so with
build id.
perf.data perf.data.old
[ perf record: Woken up 1 times to write data ]
free(): double free detected in tcache 2
Aborted
perf record use filename__read_build_id(util/symbol-minimal.c) to get
build id when libelf is not supported. When vdso.so is linked without
build id, the section size of PT_NOTE will be zero, buf size will
realloc to zero and cause memory corruption.
Signed-off-by: Mao Han <han_mao@c-sky.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
---
arch/riscv/kernel/vdso/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index f1d6ffe..49a5852 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -37,7 +37,7 @@ $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
# these symbols in the kernel code rather than hand-coded addresses.
SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
- -Wl,--hash-style=both
+ -Wl,--build-id -Wl,--hash-style=both
$(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE
$(call if_changed,vdsold)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] riscv: Fix perf record without libelf support
2019-07-11 2:38 [PATCH 1/1] riscv: Fix perf record without libelf support Mao Han
@ 2019-07-25 21:11 ` Paul Walmsley
0 siblings, 0 replies; 2+ messages in thread
From: Paul Walmsley @ 2019-07-25 21:11 UTC (permalink / raw)
To: Mao Han; +Cc: linux-kernel, linux-riscv, linux-csky, Palmer Dabbelt, Albert Ou
On Thu, 11 Jul 2019, Mao Han wrote:
> This patch fix following perf record error by linking vdso.so with
> build id.
>
> perf.data perf.data.old
> [ perf record: Woken up 1 times to write data ]
> free(): double free detected in tcache 2
> Aborted
>
> perf record use filename__read_build_id(util/symbol-minimal.c) to get
> build id when libelf is not supported. When vdso.so is linked without
> build id, the section size of PT_NOTE will be zero, buf size will
> realloc to zero and cause memory corruption.
>
> Signed-off-by: Mao Han <han_mao@c-sky.com>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@sifive.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
Thanks, queued for v5.3-rc.
Also: thanks for your patience on the perf callchain patches.
- Paul
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-25 21:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 2:38 [PATCH 1/1] riscv: Fix perf record without libelf support Mao Han
2019-07-25 21:11 ` Paul Walmsley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).