trace-cmd: fix length calculation for padding events
PATCH 1/1 trace-cmd: fix length calculation for padding events
Padding events store size in bytes, not words. Usually this ends up pushing the parser off the current page, but occasionally not, and when not, it ends up desynchronizing the parser from the event stream. This would manifest as a lot of "ug!" messages from trace-cmd, and kernelshark crashing before displaying the UI.
--- trace-input.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
trace-input.c +0 -1
@@ -1458,7 +1458,6 @@ translate_data(struct pevent *pevent,switch (type_len) {case RINGBUF_TYPE_PADDING : *length =data2host4 (pevent, *ptr); - *length *=4 ; *ptr += *length;break ;
Signature · 1 line
1.7.7.3
Quoted 6 lines · David Sharp
Padding events store size in bytes, not words. Usually this ends up pushing the parser off the current page, but occasionally not, and when not, it ends up desynchronizing the parser from the event stream. This would manifest as a lot of "ug!" messages from trace-cmd, and kernelshark crashing before displaying the UI.
Nice! Funny, Gregory (Cc'd) sent me a trace.dat file that exhibited this behavior. I was going to look into it tomorrow. I tried it with this patch and it makes the bug go away.
Nice catch! I wonder how long this has been around without notice? Probably from day one.
-- Steve
Quoted 17 lines
Signed-off-by David Sharp <[email protected]>--- trace-input.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)trace-input.c +0
-1@@ -1458,7 +1458,6 @@ translate_data(struct pevent *pevent,switch (type_len) {case RINGBUF_TYPE_PADDING : *length =data2host4 (pevent, *ptr); - *length *=4 ; *ptr += *length;break ;
Quoted 8 lines · Steven Rostedt
Quoted 6 lines · David Sharp
Padding events store size in bytes, not words. Usually this ends up pushing the parser off the current page, but occasionally not, and when not, it ends up desynchronizing the parser from the event stream. This would manifest as a lot of "ug!" messages from trace-cmd, and kernelshark crashing before displaying the UI.
Quoted 6 lines
Nice! Funny, Gregory (Cc'd) sent me a trace.dat file that exhibited this behavior. I was going to look into it tomorrow. I tried it with this patch and it makes the bug go away.
Nice catch! I wonder how long this has been around without notice? Probably from day one.
Yeah, I think so. It's an easy mistake to make, because it's incongruent with the rest of the event types.
Quoted 22 lines
-- Steve
Quoted 17 lines
Signed-off-by David Sharp <[email protected]>---
trace-input.c | 1 -1 files changed, 0 insertions(+), 1 deletions(-)trace-input.c +0
-0@@ -1458,7 +1458,6 @@ translate_data(struct pevent *pevent, switch (type_len) {case
RINGBUF_TYPE_PADDING:
*length =data2host4(pevent, *ptr);
- *length *= 4;
*ptr += *length;
break;
Quoted 5 lines · David Sharp
Quoted 2 lines
Nice catch! I wonder how long this has been around without notice? Probably from day one.
Yeah, I think so. It's an easy mistake to make, because it's incongruent with the rest of the event types.
Yeah, I admit, that was a flaw in the buffer design. :-/
-- Steve