DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Jerin Jacob <jerinjacobk@gmail.com>
Cc: Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>, dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 0/3] Rework CTF event description storage
Date: Wed, 28 Oct 2020 16:17:43 +0100	[thread overview]
Message-ID: <CAJFAV8xMa8DhzGYtU_aATO0E7SQ=CJ1QdQv3MS+ms2r7=SEu9w@mail.gmail.com> (raw)
In-Reply-To: <CAJFAV8xqnDoxGHg5WN_EFt1WRo601pMzBQnydkeQF5kGdFAvDQ@mail.gmail.com>

On Wed, Oct 28, 2020 at 2:09 PM David Marchand
<david.marchand@redhat.com> wrote:
> > echo "trace_autotest" |  ./build/app/test/dpdk-test  -c 0x3 --trace=.*
> > --no-huge --trace=.*
>
> Err, indeed, thanks for catching.
> I did some diff on metadata files, but did not notice this trailing character.
>
> This is an issue with the metadata string manipulations, that appears
> with the last patch...
> I ended up rewriting most of _ctf.c (removing intermediate buffers
> allocations) and it works but I'll see if I can pinpoint the issue.

The problem is in the current HEAD, but it is revealed by my series,
maybe because the dynamicity around allocations changed.
I see no check on the length of trace->ctf_meta when writing to the
metadata file.
Did I miss something?


int
rte_trace_metadata_dump(FILE *f)
{
...
        rc = fprintf(f, "%s", ctf_meta);
...
}


Breakpoint 1, trace_mkdir () at
../lib/librte_eal/common/eal_common_trace_utils.c:317
317    {
(gdb) p strlen(trace_obj_get()->ctf_meta)
$2 = 21865
(gdb) p trace_obj_get()->ctf_meta[21865]
$3 = 0 '\000'
(gdb) set trace_obj_get()->ctf_meta[21865] = 'A'
...

$ babeltrace $(ls -1rtd $HOME/dpdk-traces/* |tail -1)
[error] at line 1008: token "A": syntax error, unexpected IDENTIFIER
[error] Error creating AST
...


This fixes it:
@@ -37,11 +37,12 @@ meta_copy(char **meta, int *offset, char *str, int rc)
        if (rc < 0)
                return rc;

-       ptr = realloc(ptr, count + rc);
+       ptr = realloc(ptr, count + rc + 1);
        if (ptr == NULL)
                goto free_str;

        memcpy(RTE_PTR_ADD(ptr, count), str, rc);
+       ptr[count + rc] = '\0';
        count += rc;
        free(str);


-- 
David Marchand


  reply	other threads:[~2020-10-28 15:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23  8:00 David Marchand
2020-10-23  8:00 ` [dpdk-dev] [PATCH 1/3] trace: fixup CTF event description at registration David Marchand
2020-10-23  8:00 ` [dpdk-dev] [PATCH 2/3] trace: remove size limit on CTF event description David Marchand
2020-10-28  9:06   ` Jerin Jacob
2020-10-23  8:00 ` [dpdk-dev] [PATCH 3/3] trace: make CTF metadata prettier David Marchand
2020-10-27 19:43 ` [dpdk-dev] [PATCH 0/3] Rework CTF event description storage David Marchand
2020-10-28  8:52   ` Jerin Jacob
2020-10-28 13:09     ` David Marchand
2020-10-28 15:17       ` David Marchand [this message]
2020-10-28 15:59         ` David Marchand
2020-10-28 21:02 ` [dpdk-dev] [PATCH v2 0/4] " David Marchand
2020-10-28 21:02   ` [dpdk-dev] [PATCH v2 1/4] trace: fixup CTF event description at registration David Marchand
2020-10-29  8:35     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-10-28 21:02   ` [dpdk-dev] [PATCH v2 2/4] trace: remove size limit on CTF event description David Marchand
2020-10-29  8:41     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-10-29  8:51       ` David Marchand
2020-10-29  9:36         ` Sunil Kumar Kori
2020-10-29 10:02           ` David Marchand
2020-10-29 10:31             ` Sunil Kumar Kori
2020-10-28 21:02   ` [dpdk-dev] [PATCH v2 3/4] trace: fix metadata dump David Marchand
2020-10-29  8:36     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-10-28 21:02   ` [dpdk-dev] [PATCH v2 4/4] trace: make CTF metadata prettier David Marchand
2020-10-29  8:37     ` [dpdk-dev] [EXT] " Sunil Kumar Kori
2020-10-29 21:50   ` [dpdk-dev] [PATCH v2 0/4] Rework CTF event description storage David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJFAV8xMa8DhzGYtU_aATO0E7SQ=CJ1QdQv3MS+ms2r7=SEu9w@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=jerinjacobk@gmail.com \
    --cc=skori@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).