perf symbols: symbol-minimal.c causes random fd to be closed
PATCH 1/1 perf symbols: symbol-minimal.c causes random fd to be closed
I hit a cryptic failure when testing a recent version of perf:
# perf report write failure on standard output: Bad file descriptor
The issue is in commit b68e2f91 (perf symbols: Introduce symsrc structure). symsrc__destroy() does a close(ss->fd) but ss->fd is only initialised in the symbol-elf.c case and not for symbol-minimal.c.
The issue has been around for a while however most people will build with libelf which wont use the symbol-minimal.c code.
---
tools/perf/util/symbol-minimal.c +1 -0
@@ -254,6 +254,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso __maybe_unused, goto out_close; ss->type = type; + ss->fd = fd;return 0 ; out_close:
Em Thu, Dec 12, 2013 at 01:47:25PM +1100, Anton Blanchard escreveu:
Quoted 12 lines
I hit a cryptic failure when testing a recent version of perf:
# perf report write failure on standard output: Bad file descriptorThe issue is in commit
b68e2f91(perf symbols: Introduce symsrc structure).symsrc__destroy()does aclose(ss->fd)butss->fdis only initialised in thesymbol-elf.ccase and not forsymbol-minimal.c.
Quoted 6 lines
The issue has been around for a while however most people will build with libelf which wont use the
symbol-minimal.ccode.Cc [email protected] # v3.8+Signed-off-by Anton Blanchard <[email protected]>
This was fixed recently, yeah, should go to stable as well:
commit 779e24e2c777bffa9a6e3d5e821859e67008c98b
Author: Adrian Hunter <[email protected]> Date: Wed Dec 4 16:23:01 2013 +0200
perf symbols: Fix random fd closing with no libelf
Quoted 14 lines
---
tools/perf/util/symbol-minimal.c +1
-0@@ -254,6 +254,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso __maybe_unused, goto out_close; ss->type = type; + ss->fd = fd;return 0 ; out_close: