DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <dukaix.yuan@intel.com>, <jerinj@marvell.com>,
	<thomas@monjalon.net>, <ferruh.yigit@amd.com>,
	<andrew.rybchenko@oktetlabs.ru>, <skori@marvell.com>,
	Ankur Dwivedi <adwivedi@marvell.com>
Subject: [PATCH v1] ethdev: fix address sanitizer bug
Date: Thu, 16 Mar 2023 15:18:08 +0530	[thread overview]
Message-ID: <20230316094808.3253873-1-adwivedi@marvell.com> (raw)

With clang 10 compilation, the address sanitizer reports global buffer
overflow issue. The issue is observed during trace point registration
in rte_trace_point_emit_string, for strings in iterator structure.
As a workaround for this clang issue, this patch removes the
rte_trace_point_emit_string and instead adds rte_trace_point_emit_ptr
to capture the iterator pointer.

Bugzilla ID: 1184
Fixes: 6679cf21d608 ("ethdev: add trace points")

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 lib/ethdev/ethdev_trace.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/ethdev/ethdev_trace.h b/lib/ethdev/ethdev_trace.h
index c57ed08d36..3dc7d028b8 100644
--- a/lib/ethdev/ethdev_trace.h
+++ b/lib/ethdev/ethdev_trace.h
@@ -100,16 +100,14 @@ RTE_TRACE_POINT(
 RTE_TRACE_POINT(
 	rte_eth_trace_iterator_next,
 	RTE_TRACE_POINT_ARGS(const struct rte_dev_iterator *iter, uint16_t id),
-	rte_trace_point_emit_string(iter->bus_str);
-	rte_trace_point_emit_string(iter->cls_str);
+	rte_trace_point_emit_ptr(iter);
 	rte_trace_point_emit_u16(id);
 )
 
 RTE_TRACE_POINT(
 	rte_eth_trace_iterator_cleanup,
 	RTE_TRACE_POINT_ARGS(const struct rte_dev_iterator *iter),
-	rte_trace_point_emit_string(iter->bus_str);
-	rte_trace_point_emit_string(iter->cls_str);
+	rte_trace_point_emit_ptr(iter);
 )
 
 RTE_TRACE_POINT(
-- 
2.25.1


             reply	other threads:[~2023-03-16  9:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  9:48 Ankur Dwivedi [this message]
2023-03-16 12:06 ` Ferruh Yigit
2023-03-17  3:06 ` Yuan, DukaiX

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=20230316094808.3253873-1-adwivedi@marvell.com \
    --to=adwivedi@marvell.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=dukaix.yuan@intel.com \
    --cc=ferruh.yigit@amd.com \
    --cc=jerinj@marvell.com \
    --cc=skori@marvell.com \
    --cc=thomas@monjalon.net \
    /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).