Skip to content

Commit

Permalink
perf: avoid structure size confusion by using a fixed size
Browse files Browse the repository at this point in the history
for some reason, this structure gets compiled as 36 bytes in some files
(the ones that alloacte it) but 40 bytes in others (the ones that use it).
The cause is an off_t type that gets a different size in different
compilation units for some yet-to-be-explained reason.

But the effect is disasterous; the size/offset members of the struct
are at different offsets, and result in mostly complete garbage.
The parser in perf is so robust that this all gets hidden, and after
skipping an certain amount of samples, it recovers.... so this bug
is not normally noticed.

.... except when you want every sample to be exact.

Fix this by just using an explicitly sized type.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4A655917.9080504@linux.intel.com>
  • Loading branch information
Arjan van de Ven authored and Peter Zijlstra committed Jul 22, 2009
1 parent 966ee4d commit dfe5a50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/util/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct perf_header {
int frozen;
int attrs, size;
struct perf_header_attr **attr;
off_t attr_offset;
s64 attr_offset;
u64 data_offset;
u64 data_size;
};
Expand Down

0 comments on commit dfe5a50

Please sign in to comment.