[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <18a64670672d4a368e27cd81fc7b0ae9@huawei.com>
Date: Wed, 8 Jan 2025 10:19:30 +0000
From: Shiju Jose <shiju.jose@...wei.com>
To: Steven Rostedt <rostedt@...dmis.org>
CC: "mhiramat@...nel.org" <mhiramat@...nel.org>,
"mathieu.desnoyers@...icios.com" <mathieu.desnoyers@...icios.com>,
"linux-trace-kernel@...r.kernel.org" <linux-trace-kernel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Linuxarm
<linuxarm@...wei.com>, Jonathan Cameron <jonathan.cameron@...wei.com>,
tanxiaofei <tanxiaofei@...wei.com>, "Zengtao (B)" <prime.zeng@...ilicon.com>
Subject: RE: [PATCH 1/1] tracing: Support reading trace event format file
larger than PAGE_SIZE
>-----Original Message-----
>From: Steven Rostedt <rostedt@...dmis.org>
>Sent: 07 January 2025 23:02
>To: Shiju Jose <shiju.jose@...wei.com>
>Cc: mhiramat@...nel.org; mathieu.desnoyers@...icios.com; linux-trace-
>kernel@...r.kernel.org; linux-kernel@...r.kernel.org; Linuxarm
><linuxarm@...wei.com>; Jonathan Cameron
><jonathan.cameron@...wei.com>; tanxiaofei <tanxiaofei@...wei.com>;
>Zengtao (B) <prime.zeng@...ilicon.com>
>Subject: Re: [PATCH 1/1] tracing: Support reading trace event format file larger
>than PAGE_SIZE
>
>On Tue, 7 Jan 2025 11:04:57 +0000
>Shiju Jose <shiju.jose@...wei.com> wrote:
>
>> Please find attached format file, which might have failed to parse
>> because of the unsupported formats in the libtraceevent you mentioned in the
>following thread.
>>
>https://lore.kernel.org/lkml/20241127104132.6c1729e1@gandalf.local.home/#t
>>
>> Please find the improvement in the libraceevent which I mentioned for
>> not returning error when parsing failed,
>> ===========================================
>> diff --git a/src/event-parse.c b/src/event-parse.c index
>> 0427061..b9264cb 100644
>> --- a/src/event-parse.c
>> +++ b/src/event-parse.c
>> @@ -7905,9 +7905,14 @@ __parse_event(struct tep_handle *tep,
>> const char *buf, unsigned long size,
>> const char *sys)
>> {
>> - int ret = parse_format(eventp, tep, buf, size, sys);
>> - struct tep_event *event = *eventp;
>> + int ret;
>> + struct tep_event *event;
>> +
>> + ret = parse_format(eventp, tep, buf, size, sys);
>> + if (ret)
>> + return ret;
>>
>> + event = *eventp;
>> if (event == NULL)
>> return ret;
>
>Actually, this is the proper patch:
>
>diff --git a/src/event-parse.c b/src/event-parse.c index
>33ed7fb47fff..f2e50b0e8992 100644
>--- a/src/event-parse.c
>+++ b/src/event-parse.c
>@@ -7841,7 +7841,7 @@ static enum tep_errno parse_format(struct tep_event
>**eventp,
> ret = event_read_format(event);
> if (ret < 0) {
> ret = TEP_ERRNO__READ_FORMAT_FAILED;
>- goto event_parse_failed;
>+ goto event_alloc_failed;
> }
>
> /*
>
>
>As it's OK if it returns that it failed to parse the print format, as it can still read
>the event. But if it fails to read the fields, then it is basically useless.
Thanks.
Your patch worked fine for returning error to the user space tool for the incomplete format data case as
the following check become true in the __parse_event() after freeing 'event' in the goto event_alloc_failed.
if (event == NULL)
return ret;
>
>-- Steve
Thanks,
Shiju
Powered by blists - more mailing lists