From: Jerin Jacob <jerinjacobk@gmail.com>
To: Robin Jarry <rjarry@redhat.com>
Cc: dev@dpdk.org, Jerin Jacob <jerinj@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Zhirun Yan <yanzhirun_163@163.com>
Subject: Re: [PATCH] graph: avoid id collisions
Date: Tue, 26 Mar 2024 18:18:22 +0530 [thread overview]
Message-ID: <CALBAE1OzK+7Wdedqh6iDS-yKA4q0myy+38CkmMSZ-6686qSvaQ@mail.gmail.com> (raw)
In-Reply-To: <20240325155354.770676-2-rjarry@redhat.com>
On Mon, Mar 25, 2024 at 9:24 PM Robin Jarry <rjarry@redhat.com> wrote:
>
> The graph id is determined based on a global variable that is
> incremented every time a graph is created, and decremented every time
> a graph is destroyed. This only works if graphs are destroyed in the
> reverse order in which they have been created.
>
> The following code produces duplicate graph IDs which can lead to
> use-after-free bugs and other undefined behaviours:
>
> a = rte_graph_create(...); // id=0 graph_id=1
> b = rte_graph_create(...); // id=1 graph_id=2
> rte_graph_destroy(a); // graph_id=1
> c = rte_graph_create(...); // id=1 graph_id=2 (duplicate with b)
> rte_graph_destroy(c); // frees memory still used by b
>
> Remove the global counter. Make sure that the graph list is always
> ordered by increasing graph ids. When creating a new graph, pick a free
> id which is not allocated.
Please update app/test/test_graph.c to test this case.
>
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
next prev parent reply other threads:[~2024-03-26 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 15:53 Robin Jarry
2024-03-26 12:48 ` Jerin Jacob [this message]
2024-03-26 15:49 ` [PATCH v2] " Robin Jarry
2024-03-27 2:44 ` [EXTERNAL] " Kiran Kumar Kokkilagadda
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=CALBAE1OzK+7Wdedqh6iDS-yKA4q0myy+38CkmMSZ-6686qSvaQ@mail.gmail.com \
--to=jerinjacobk@gmail.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=rjarry@redhat.com \
--cc=yanzhirun_163@163.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).