[Crash-utility] [PATCH] extensions/trace: Fix ftrace_get_event_type_name()
Dave Anderson
anderson at redhat.com
Mon Jul 11 15:00:03 UTC 2016
Hi Qiao,
This patch looks OK to me, but can you check it for backwards-compatibity or
whatever other purposes, and if OK, give me your ACK so I can check it in?
Thanks,
Dave
----- Original Message -----
> The recent kernel change dcb0b5575d24 ("tracing: Remove
> TRACE_EVENT_FL_USE_CALL_FILTER logic") changed the bit index so it makes
> checking TRACE_EVENT_FL_TRACEPOINT flag failed. It should be 0x20 for
> newer kernels. Without this patch, the crash tool refused to load
> trace.so extension due to invalid access to event names:
>
> crash> extend trace.so
> extend: /path/to/crash/extensions/trace.so: no commands registered: shared
> object unloaded
>
> Instead of using the hard-coded value, read the enum value from the
> kernel dynamically.
>
> Reported-by: Minchan Kim <minchan at kernel.org>
> Cc: Steven Rostedt <rostedt at goodmis.org>
> Signed-off-by: Namhyung Kim <namhyung at gmail.com>
> ---
> extensions/trace.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/extensions/trace.c b/extensions/trace.c
> index 782d62f..f8ccd91 100644
> --- a/extensions/trace.c
> +++ b/extensions/trace.c
> @@ -1015,8 +1015,6 @@ static void ftrace_destroy_event_types(void)
> free(ftrace_common_fields);
> }
>
> -#define TRACE_EVENT_FL_TRACEPOINT 0x40
> -
> static
> int ftrace_get_event_type_name(ulong call, char *name, int len)
> {
> @@ -1024,8 +1022,9 @@ int ftrace_get_event_type_name(ulong call, char *name,
> int len)
> static int name_offset;
> static int flags_offset;
> static int tp_name_offset;
> - uint flags;
> + static long tracepoint_flag;
>
> + uint flags;
> ulong name_addr;
>
> if (inited)
> @@ -1051,6 +1050,9 @@ int ftrace_get_event_type_name(ulong call, char *name,
> int len)
> if (tp_name_offset < 0)
> return -1;
>
> + if (!enumerator_value("TRACE_EVENT_FL_TRACEPOINT", &tracepoint_flag))
> + return -1;
> +
> inited = 2;
>
> work:
> @@ -1067,7 +1069,7 @@ work:
> RETURN_ON_ERROR))
> return -1;
>
> - if (flags & TRACE_EVENT_FL_TRACEPOINT) {
> + if (flags & (uint)tracepoint_flag) {
> if (!readmem(name_addr + tp_name_offset, KVADDR,
> &name_addr, sizeof(name_addr),
> "read tracepoint name", RETURN_ON_ERROR))
> --
> 2.8.0
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
>
More information about the Crash-utility
mailing list