DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 00/43] replace strerror
@ 2023-11-14  8:24 Dengdui Huang
  2023-11-14  8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang
                   ` (43 more replies)
  0 siblings, 44 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This series of patches fix it. In this patchset, only the libs and
drivers are modified.

Dengdui Huang (43):
  devtools: forbid use of strerror
  eal: use rte strerror
  eventdev: use rte strerror
  latency: use rte strerror
  node: use rte strerror
  pdump: use rte strerror
  power: use rte strerror
  telemetry: replace strerror
  vhost: use rte strerror
  bpf: use rte strerror
  bus/cdx: use rte strerror
  bus/dpaa: use rte strerror
  bus/fslmc: use rte strerror
  bus/pci: use rte strerror
  bus/vdev: use rte strerror
  bus/vmbus: use rte strerror
  common/cnxk: use rte strerror
  common/mlx5: use rte strerror
  crypto/caam_jr: use rte strerror
  dma/idxd: use rte strerror
  net/af_packet: use rte strerror
  net/bnxt: use rte strerror
  net/af_xdp: use rte strerror
  net/bonding: use rte strerror
  net/dpaa: use rte strerror
  net/dpaa2: use rte strerror
  net/enetfec: use rte strerror
  net/failsafe: use rte strerror
  net/i40e: use rte strerror
  net/ice: use rte strerror
  net/ixgbe: use rte strerror
  net/memif: use rte strerror
  net/mlx4: use rte strerror
  net/mlx5: use rte strerror
  net/qede: use rte strerror
  net/sfc: use rte strerror
  net/tap: use rte strerror
  net/vhost: use rte strerror
  net/virtio: use rte strerror
  raw/ifpga: use rte strerror
  vdpa/ifc: use rte strerror
  vdpa/mlx5: use rte strerror
  vdpa/sfc: use rte strerror

 devtools/checkpatches.sh                      |   8 +
 drivers/bus/cdx/cdx.c                         |   2 +-
 drivers/bus/cdx/cdx_vfio.c                    |  13 +-
 drivers/bus/dpaa/base/fman/fman.c             |   2 +-
 drivers/bus/dpaa/dpaa_bus.c                   |   2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  12 +-
 drivers/bus/pci/bsd/pci.c                     |   8 +-
 drivers/bus/pci/linux/pci.c                   |   7 +-
 drivers/bus/pci/linux/pci_uio.c               |  23 +-
 drivers/bus/pci/linux/pci_vfio.c              |  23 +-
 drivers/bus/pci/pci_common_uio.c              |   3 +-
 drivers/bus/vdev/vdev.c                       |   2 +-
 drivers/bus/vmbus/linux/vmbus_bus.c           |   7 +-
 drivers/bus/vmbus/linux/vmbus_uio.c           |  21 +-
 drivers/bus/vmbus/vmbus_common.c              |   4 +-
 drivers/bus/vmbus/vmbus_common_uio.c          |   3 +-
 drivers/common/cnxk/roc_dev.c                 |   4 +-
 drivers/common/cnxk/roc_model.c               |   4 +-
 drivers/common/cnxk/roc_utils.c               |   4 +-
 drivers/common/mlx5/linux/mlx5_nl.c           |  12 +-
 drivers/common/mlx5/mlx5_common.c             |   6 +-
 drivers/common/mlx5/mlx5_devx_cmds.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr_uio.c          |   5 +-
 drivers/dma/idxd/idxd_bus.c                   |  14 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  12 +-
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 drivers/net/bonding/bonding_testpmd.c         |   4 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_flow.c       |   4 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   6 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   4 +-
 drivers/net/dpaa/fmlib/fm_lib.c               |   6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/enetfec/enet_uio.c                |   2 +-
 drivers/net/failsafe/failsafe.c               |   8 +-
 drivers/net/failsafe/failsafe_args.c          |   4 +-
 drivers/net/failsafe/failsafe_eal.c           |   4 +-
 drivers/net/failsafe/failsafe_flow.c          |   4 +-
 drivers/net/failsafe/failsafe_ops.c           |   2 +-
 drivers/net/failsafe/failsafe_private.h       |   6 +-
 drivers/net/i40e/i40e_testpmd.c               |  42 +--
 drivers/net/ice/ice_testpmd.c                 |   4 +-
 drivers/net/ixgbe/ixgbe_testpmd.c             |  12 +-
 drivers/net/memif/memif_socket.c              |   4 +-
 drivers/net/memif/rte_eth_memif.c             |  20 +-
 drivers/net/mlx4/mlx4.c                       |  14 +-
 drivers/net/mlx4/mlx4_ethdev.c                |  18 +-
 drivers/net/mlx4/mlx4_rxq.c                   |  10 +-
 drivers/net/mlx4/mlx4_txq.c                   |  10 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c         |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |  20 +-
 drivers/net/mlx5/linux/mlx5_os.c              |  18 +-
 drivers/net/mlx5/linux/mlx5_socket.c          |  16 +-
 drivers/net/mlx5/linux/mlx5_verbs.c           |   8 +-
 drivers/net/mlx5/mlx5.c                       |   8 +-
 drivers/net/mlx5/mlx5_devx.c                  |   4 +-
 drivers/net/mlx5/mlx5_mac.c                   |   2 +-
 drivers/net/mlx5/mlx5_rxmode.c                |   8 +-
 drivers/net/mlx5/mlx5_rxq.c                   |   4 +-
 drivers/net/mlx5/mlx5_rxtx.c                  |   2 +-
 drivers/net/mlx5/mlx5_stats.c                 |   4 +-
 drivers/net/mlx5/mlx5_testpmd.c               |  14 +-
 drivers/net/mlx5/mlx5_trigger.c               |  12 +-
 drivers/net/mlx5/mlx5_vlan.c                  |   2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c     |   2 +-
 drivers/net/mlx5/windows/mlx5_os.c            |  12 +-
 drivers/net/qede/qede_regs.c                  |   4 +-
 drivers/net/sfc/sfc_flow.c                    |   2 +-
 drivers/net/sfc/sfc_flow_tunnel.c             |   2 +-
 drivers/net/sfc/sfc_mae.c                     |  58 ++---
 drivers/net/tap/rte_eth_tap.c                 |  26 +-
 drivers/net/tap/tap_flow.c                    |  18 +-
 drivers/net/tap/tap_netlink.c                 |   5 +-
 drivers/net/tap/tap_tcmsgs.c                  |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   6 +-
 drivers/net/virtio/virtio_user/vhost_kernel.c |   8 +-
 .../net/virtio/virtio_user/vhost_kernel_tap.c |  25 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |  20 +-
 drivers/net/virtio/virtio_user/vhost_vdpa.c   |  12 +-
 .../net/virtio/virtio_user/virtio_user_dev.c  |   8 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   6 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   5 +-
 drivers/raw/ifpga/base/ifpga_fme_rsu.c        |  12 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |  23 +-
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c           |   2 +-
 drivers/vdpa/sfc/sfc_vdpa_ops.c               |   6 +-
 lib/bpf/bpf_load_elf.c                        |   2 +-
 lib/eal/common/eal_common_fbarray.c           |   2 +-
 lib/eal/common/eal_common_options.c           |   7 +-
 lib/eal/common/eal_common_proc.c              |  12 +-
 lib/eal/common/eal_common_trace_utils.c       |   6 +-
 lib/eal/freebsd/eal.c                         |   4 +-
 lib/eal/freebsd/eal_interrupts.c              |   8 +-
 lib/eal/freebsd/eal_memory.c                  |   2 +-
 lib/eal/freebsd/eal_timer.c                   |   6 +-
 lib/eal/linux/eal.c                           |  10 +-
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/linux/eal_hugepage_info.c             |   5 +-
 lib/eal/linux/eal_interrupts.c                |  18 +-
 lib/eal/linux/eal_memalloc.c                  |  47 ++--
 lib/eal/linux/eal_memory.c                    |  43 ++--
 lib/eal/linux/eal_timer.c                     |   2 +-
 lib/eal/linux/eal_vfio.c                      |  40 +--
 lib/eal/unix/eal_filesystem.c                 |   5 +-
 lib/eal/unix/eal_unix_memory.c                |   6 +-
 lib/eal/unix/rte_thread.c                     |   6 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |   2 +-
 lib/latencystats/rte_latencystats.c           |   4 +-
 lib/node/kernel_tx.c                          |   2 +-
 lib/pdump/rte_pdump.c                         |   6 +-
 lib/power/guest_channel.c                     |   7 +-
 lib/power/power_kvm_vm.c                      |   3 +-
 lib/power/power_pstate_cpufreq.c              |   7 +-
 lib/power/rte_power_pmd_mgmt.c                |   2 +-
 lib/telemetry/telemetry.c                     |  28 +-
 lib/telemetry/telemetry_legacy.c              |   5 +-
 lib/vhost/socket.c                            |  13 +-
 lib/vhost/vduse.c                             |  30 +--
 lib/vhost/vhost_user.c                        |  11 +-
 137 files changed, 963 insertions(+), 903 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 01/43] devtools: forbid use of strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
@ 2023-11-14  8:24 ` Dengdui Huang
  2023-11-14  8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang
                   ` (42 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
rte_strerror() has been provided in DPDK to replace it.

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 066449d147..7fbd0df3b3 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -159,6 +159,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from using strerror() for drivers and libs
+	awk -v FOLDERS="lib drivers" \
+		-v EXPRESSIONS="\\\sstrerror\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using strerror, prefer rte_strerror' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# refrain from using RTE_LOG_REGISTER for drivers and libs
 	awk -v FOLDERS='lib drivers' \
 		-v EXPRESSIONS='\\<RTE_LOG_REGISTER\\>' \
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 02/43] eal: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
  2023-11-14  8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang
@ 2023-11-14  8:24 ` Dengdui Huang
  2023-11-15  0:18   ` Stephen Hemminger
  2023-11-15  0:22   ` Stephen Hemminger
  2023-11-14  8:24 ` [PATCH 03/43] eventdev: " Dengdui Huang
                   ` (41 subsequent siblings)
  43 siblings, 2 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_fbarray.c     |  2 +-
 lib/eal/common/eal_common_options.c     |  7 ++--
 lib/eal/common/eal_common_proc.c        | 12 +++----
 lib/eal/common/eal_common_trace_utils.c |  6 ++--
 lib/eal/freebsd/eal.c                   |  4 +--
 lib/eal/freebsd/eal_interrupts.c        |  8 ++---
 lib/eal/freebsd/eal_memory.c            |  2 +-
 lib/eal/freebsd/eal_timer.c             |  6 ++--
 lib/eal/linux/eal.c                     | 10 +++---
 lib/eal/linux/eal_dev.c                 |  2 +-
 lib/eal/linux/eal_hugepage_info.c       |  5 +--
 lib/eal/linux/eal_interrupts.c          | 18 +++++-----
 lib/eal/linux/eal_memalloc.c            | 47 +++++++++++++------------
 lib/eal/linux/eal_memory.c              | 43 +++++++++++-----------
 lib/eal/linux/eal_timer.c               |  2 +-
 lib/eal/linux/eal_vfio.c                | 40 ++++++++++-----------
 lib/eal/unix/eal_filesystem.c           |  5 +--
 lib/eal/unix/eal_unix_memory.c          |  6 ++--
 lib/eal/unix/rte_thread.c               |  6 ++--
 19 files changed, 118 insertions(+), 113 deletions(-)

diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c
index 2055bfa57d..a2936bbd91 100644
--- a/lib/eal/common/eal_common_fbarray.c
+++ b/lib/eal/common/eal_common_fbarray.c
@@ -1027,7 +1027,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		eal_get_fbarray_path(path, sizeof(path), arr->name);
 		if (unlink(path)) {
 			RTE_LOG(DEBUG, EAL, "Cannot unlink fbarray: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			/*
 			 * we're still holding an exclusive lock, so drop it to
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index a6d21f1cba..8a09fe2719 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -44,6 +44,7 @@
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include "eal_trace.h"
 #endif
+#include <rte_errno.h>
 
 #define BITS_PER_HEX 4
 #define LCORE_OPT_LST 1
@@ -391,7 +392,7 @@ eal_plugindir_init(const char *path)
 	d = opendir(path);
 	if (d == NULL) {
 		RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n",
-			path, strerror(errno));
+			path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -443,7 +444,7 @@ verify_perms(const char *dirpath)
 	/* call stat to check for permissions and ensure not world writable */
 	if (stat(dirpath, &st) != 0) {
 		RTE_LOG(ERR, EAL, "Error with stat on %s, %s\n",
-				dirpath, strerror(errno));
+				dirpath, rte_strerror(errno));
 		return -1;
 	}
 	if (st.st_mode & S_IWOTH) {
@@ -471,7 +472,7 @@ eal_dlopen(const char *pathname)
 	}
 	if (realp == NULL) {
 		RTE_LOG(ERR, EAL, "Error with realpath for %s, %s\n",
-				pathname, strerror(errno));
+				pathname, rte_strerror(errno));
 		goto out;
 	}
 	if (strnlen(realp, PATH_MAX) == PATH_MAX) {
diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index 728815c4a9..2e39180d40 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -291,7 +291,7 @@ read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s)
 		if (errno == EINTR)
 			goto retry;
 
-		RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", strerror(errno));
+		RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -583,7 +583,7 @@ open_socket_fd(void)
 
 	if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		RTE_LOG(ERR, EAL, "failed to bind %s: %s\n",
-			un.sun_path, strerror(errno));
+			un.sun_path, rte_strerror(errno));
 		close(mp_fd);
 		return -1;
 	}
@@ -631,13 +631,13 @@ rte_mp_channel_init(void)
 	dir_fd = open(mp_dir_path, O_RDONLY);
 	if (dir_fd < 0) {
 		RTE_LOG(ERR, EAL, "failed to open %s: %s\n",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		return -1;
 	}
 
 	if (flock(dir_fd, LOCK_EX)) {
 		RTE_LOG(ERR, EAL, "failed to lock %s: %s\n",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
@@ -650,7 +650,7 @@ rte_mp_channel_init(void)
 	if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg",
 			mp_handle, NULL) < 0) {
 		RTE_LOG(ERR, EAL, "failed to create mp thread: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dir_fd);
 		close(rte_atomic_exchange_explicit(&mp_fd, -1, rte_memory_order_relaxed));
 		return -1;
@@ -733,7 +733,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type)
 			return 0;
 		}
 		RTE_LOG(ERR, EAL, "failed to send to (%s) due to %s\n",
-			dst_path, strerror(errno));
+			dst_path, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c
index 8561a0e198..b74adf6589 100644
--- a/lib/eal/common/eal_common_trace_utils.c
+++ b/lib/eal/common/eal_common_trace_utils.c
@@ -244,7 +244,7 @@ eal_trace_dir_args_save(char const *val)
 	int rc;
 
 	if (asprintf(&dir_path, "%s/", val) == -1) {
-		trace_err("failed to copy directory: %s", strerror(errno));
+		trace_err("failed to copy directory: %s", rte_strerror(errno));
 		return -ENOMEM;
 	}
 
@@ -328,7 +328,7 @@ trace_mkdir(void)
 	/* Create the path if it t exist, no "mkdir -p" available here */
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0 && errno != EEXIST) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
@@ -343,7 +343,7 @@ trace_mkdir(void)
 
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 568e06e9ed..a82f3ab8d0 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -203,7 +203,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -250,7 +250,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 2b31dfb099..0672e88e4e 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -186,7 +186,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
 			else
 				RTE_LOG(ERR, EAL, "Error adding fd %d kevent, %s\n",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			ret = -errno;
 			goto fail;
 		}
@@ -323,7 +323,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,
 		if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 			RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n",
 				rte_intr_fd_get(src->intr_handle),
-				strerror(errno));
+				rte_strerror(errno));
 			/* removing non-existent even is an expected condition
 			 * in some circumstances (e.g. oneshot events).
 			 */
@@ -516,7 +516,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				RTE_LOG(ERR, EAL, "Error reading from file "
 					"descriptor %d: %s\n",
 					event_fd,
-					strerror(errno));
+					rte_strerror(errno));
 			} else if (bytes_read == 0)
 				RTE_LOG(ERR, EAL, "Read nothing from file "
 					"descriptor %d\n", event_fd);
@@ -567,7 +567,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 					RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n",
 						rte_intr_fd_get(src->intr_handle),
-						strerror(errno));
+						rte_strerror(errno));
 					/* removing non-existent even is an expected
 					 * condition in some circumstances
 					 * (e.g. oneshot events).
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index 5c6165c580..35e11970c6 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -85,7 +85,7 @@ rte_eal_hugepage_init(void)
 				MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 		if (addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			return -1;
 		}
 
diff --git a/lib/eal/freebsd/eal_timer.c b/lib/eal/freebsd/eal_timer.c
index beff755a47..7125e4e0e8 100644
--- a/lib/eal/freebsd/eal_timer.c
+++ b/lib/eal/freebsd/eal_timer.c
@@ -36,20 +36,20 @@ get_tsc_freq(void)
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0))
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 	else if (tmp != 1)
 		RTE_LOG(WARNING, EAL, "TSC is not safe to use in SMP mode\n");
 
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0))
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 	else if (tmp != 1)
 		RTE_LOG(WARNING, EAL, "TSC is not invariant\n");
 
 	sz = sizeof(tsc_hz);
 	if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) {
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 57da058cec..0da0a000ac 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -160,7 +160,7 @@ eal_clean_runtime_dir(void)
 		closedir(dir);
 
 	RTE_LOG(ERR, EAL, "Error while clearing runtime dir: %s\n",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -288,7 +288,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -335,7 +335,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1421,7 +1421,7 @@ rte_eal_check_module(const char *module_name)
 	/* Check if there is sysfs mounted */
 	if (stat("/sys/module", &st) != 0) {
 		RTE_LOG(DEBUG, EAL, "sysfs is not mounted! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1434,7 +1434,7 @@ rte_eal_check_module(const char *module_name)
 
 	if (stat(sysfs_mod_name, &st) != 0) {
 		RTE_LOG(DEBUG, EAL, "Module %s not found! error %i (%s)\n",
-		        sysfs_mod_name, errno, strerror(errno));
+			sysfs_mod_name, errno, rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ac76f6174d..ede68f32cf 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -73,7 +73,7 @@ static void sigbus_handler(int signum, siginfo_t *info,
 	if (ret == -1) {
 		rte_exit(EXIT_FAILURE,
 			 "Failed to handle SIGBUS for hot-unplug, "
-			 "(rte_errno: %s)!", strerror(rte_errno));
+			 "(rte_errno: %s)!", rte_strerror(rte_errno));
 	} else if (ret == 1) {
 		if (sigbus_action_old.sa_flags == SA_SIGINFO
 		    && sigbus_action_old.sa_sigaction) {
diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c
index 581d9dfc91..6286ab3efb 100644
--- a/lib/eal/linux/eal_hugepage_info.c
+++ b/lib/eal/linux/eal_hugepage_info.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_common.h>
 #include "rte_string_fns.h"
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
@@ -378,7 +379,7 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void *user_data)
 		closedir(dir);
 
 	RTE_LOG(ERR, EAL, "Error while walking hugepage dir: %s\n",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -404,7 +405,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd)
 
 	if (fstat(whd->file_fd, &st) < 0)
 		RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s",
-				__func__, whd->file_name, strerror(errno));
+				__func__, whd->file_name, rte_strerror(errno));
 	else
 		(*total_size) += st.st_size;
 }
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index d4919dff45..660e64dd41 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -460,7 +460,7 @@ uio_intr_disable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		RTE_LOG(ERR, EAL, "Error disabling interrupts for fd %d (%s)\n",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -474,7 +474,7 @@ uio_intr_enable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		RTE_LOG(ERR, EAL, "Error enabling interrupts for fd %d (%s)\n",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -975,7 +975,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 				RTE_LOG(ERR, EAL, "Error reading from file "
 					"descriptor %d: %s\n",
 					events[n].data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				/*
 				 * The device is unplugged or buggy, remove
 				 * it as an interrupt source and return to
@@ -1130,7 +1130,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 		if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
 						&pipe_event) < 0) {
 			rte_panic("Error adding fd to %d epoll_ctl, %s\n",
-					intr_pipe.readfd, strerror(errno));
+					intr_pipe.readfd, rte_strerror(errno));
 		}
 		numfds++;
 
@@ -1153,7 +1153,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 					rte_intr_fd_get(src->intr_handle), &ev) < 0) {
 				rte_panic("Error adding fd %d epoll_ctl, %s\n",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			}
 			else
 				numfds++;
@@ -1244,7 +1244,7 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
 				continue;
 			RTE_LOG(ERR, EAL,
 				"Error reading from fd %d: %s\n",
-				fd, strerror(errno));
+				fd, rte_strerror(errno));
 		} else if (nbytes == 0)
 			RTE_LOG(ERR, EAL, "Read nothing from fd %d\n", fd);
 		return;
@@ -1343,7 +1343,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events,
 			}
 			/* epoll_wait fail */
 			RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			rc = -1;
 			break;
 		} else {
@@ -1412,7 +1412,7 @@ rte_epoll_ctl(int epfd, int op, int fd,
 	ev.events = event->epdata.event;
 	if (epoll_ctl(epfd, op, fd, &ev) < 0) {
 		RTE_LOG(ERR, EAL, "Error op %d fd %d epoll_ctl, %s\n",
-			op, fd, strerror(errno));
+			op, fd, rte_strerror(errno));
 		if (op == EPOLL_CTL_ADD)
 			/* rollback status when CTL_ADD fail */
 			rte_atomic_store_explicit(&event->status, RTE_EPOLL_INVALID,
@@ -1525,7 +1525,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
 			if (fd < 0) {
 				RTE_LOG(ERR, EAL,
 					"can't setup eventfd, error %i (%s)\n",
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 				return -errno;
 			}
 
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index 9853ec78a2..53a7e5dd3b 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -31,6 +31,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "eal_internal_cfg.h"
@@ -161,7 +162,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id)
 			  oldmask->size + 1, 0, 0) < 0) {
 		RTE_LOG(ERR, EAL,
 			"Failed to get current mempolicy: %s. "
-			"Assuming MPOL_DEFAULT.\n", strerror(errno));
+			"Assuming MPOL_DEFAULT.\n", rte_strerror(errno));
 		*oldpolicy = MPOL_DEFAULT;
 	}
 	RTE_LOG(DEBUG, EAL,
@@ -180,7 +181,7 @@ restore_numa(int *oldpolicy, struct bitmask *oldmask)
 	} else if (set_mempolicy(*oldpolicy, oldmask->maskp,
 				 oldmask->size + 1) < 0) {
 		RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		numa_set_localalloc();
 	}
 	numa_free_cpumask(oldmask);
@@ -224,7 +225,7 @@ static int lock(int fd, int type)
 		return 0;
 	} else if (ret) {
 		RTE_LOG(ERR, EAL, "%s(): error calling flock(): %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 	/* lock was successful */
@@ -252,7 +253,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].memseg_list_fd = fd;
@@ -266,7 +267,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].fds[seg_idx] = fd;
@@ -317,7 +318,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	ret = stat(path, &st);
 	if (ret < 0 && errno != ENOENT) {
 		RTE_LOG(DEBUG, EAL, "%s(): stat() for '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	if (!internal_conf->hugepage_file.unlink_existing && ret == 0 &&
@@ -343,7 +344,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 		/* coverity[toctou] */
 		if (unlink(path) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): could not remove '%s': %s\n",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -352,13 +353,13 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	fd = open(path, O_CREAT | O_RDWR, 0600);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "%s(): open '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	/* take out a read lock */
 	if (lock(fd, LOCK_SH) < 0) {
 		RTE_LOG(ERR, EAL, "%s(): lock '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -380,7 +381,7 @@ resize_hugefile_in_memory(int fd, uint64_t fa_offset,
 	if (ret < 0) {
 		RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n",
 				__func__,
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -415,7 +416,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 			if (new_size > cur_size &&
 					ftruncate(fd, new_size) < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 		} else {
@@ -451,7 +452,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 				} else {
 					RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n",
 						__func__,
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			} else {
@@ -484,7 +485,7 @@ close_hugefile(int fd, char *path, int list_idx)
 			rte_eal_process_type() == RTE_PROC_PRIMARY &&
 			unlink(path))
 		RTE_LOG(ERR, EAL, "%s(): unlinking '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 
 	close(fd);
 	fd_list[list_idx].memseg_list_fd = -1;
@@ -585,14 +586,14 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 			map_offset = 0;
 			if (ftruncate(fd, alloc_sz) < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				goto resized;
 			}
 			if (internal_conf->hugepage_file.unlink_before_mapping &&
 					!internal_conf->in_memory) {
 				if (unlink(path)) {
 					RTE_LOG(DEBUG, EAL, "%s(): unlink() failed: %s\n",
-						__func__, strerror(errno));
+						__func__, rte_strerror(errno));
 					goto resized;
 				}
 			}
@@ -611,7 +612,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 
 	if (va == MAP_FAILED) {
 		RTE_LOG(DEBUG, EAL, "%s(): mmap() failed: %s\n", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		/* mmap failed, but the previous region might have been
 		 * unmapped anyway. try to remap it
 		 */
@@ -662,7 +663,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 					MPOL_F_NODE | MPOL_F_ADDR);
 		if (ret < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mapped;
 		} else if (cur_socket_id != socket_id) {
 			RTE_LOG(DEBUG, EAL,
@@ -874,13 +875,13 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -981,13 +982,13 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -1345,13 +1346,13 @@ sync_existing(struct rte_memseg_list *primary_msl,
 	dir_fd = open(hi->hugedir, O_RDONLY);
 	if (dir_fd < 0) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		return -1;
 	}
 	/* blocking writelock */
 	if (flock(dir_fd, LOCK_EX)) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 9b6f08fba8..db92d1a602 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -105,7 +105,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	fd = open("/proc/self/pagemap", O_RDONLY);
 	if (fd < 0) {
 		RTE_LOG(INFO, EAL, "%s(): cannot open /proc/self/pagemap: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	}
 
@@ -113,7 +113,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	offset = sizeof(uint64_t) * virt_pfn;
 	if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
 		RTE_LOG(INFO, EAL, "%s(): seek error in /proc/self/pagemap: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		close(fd);
 		return RTE_BAD_IOVA;
 	}
@@ -122,7 +122,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	close(fd);
 	if (retval < 0) {
 		RTE_LOG(INFO, EAL, "%s(): cannot read /proc/self/pagemap: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	} else if (retval != PFN_MASK_SIZE) {
 		RTE_LOG(INFO, EAL, "%s(): read %d bytes from /proc/self/pagemap "
@@ -237,7 +237,7 @@ static int huge_wrap_sigsetjmp(void)
 /* Callback for numa library. */
 void numa_error(char *where)
 {
-	RTE_LOG(ERR, EAL, "%s failed: %s\n", where, strerror(errno));
+	RTE_LOG(ERR, EAL, "%s failed: %s\n", where, rte_strerror(errno));
 }
 #endif
 
@@ -278,7 +278,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				  oldmask->size + 1, 0, 0) < 0) {
 			RTE_LOG(ERR, EAL,
 				"Failed to get current mempolicy: %s. "
-				"Assuming MPOL_DEFAULT.\n", strerror(errno));
+				"Assuming MPOL_DEFAULT.\n", rte_strerror(errno));
 			oldpolicy = MPOL_DEFAULT;
 		}
 		for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
@@ -333,7 +333,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		fd = open(hf->filepath, O_CREAT | O_RDWR, 0600);
 		if (fd < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): open failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			goto out;
 		}
 
@@ -346,7 +346,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				MAP_SHARED | MAP_POPULATE, fd, 0);
 		if (virtaddr == MAP_FAILED) {
 			RTE_LOG(DEBUG, EAL, "%s(): mmap failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -379,7 +379,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): Locking file failed:%s \n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -397,7 +397,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		} else if (set_mempolicy(oldpolicy, oldmask->maskp,
 					 oldmask->size + 1) < 0) {
 			RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			numa_set_localalloc();
 		}
 	}
@@ -590,7 +590,7 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl,
 
 		if (hp->orig_va != NULL && unlink(hp->filepath)) {
 			RTE_LOG(WARNING, EAL, "%s(): Removing %s failed: %s\n",
-				__func__, hp->filepath, strerror(errno));
+				__func__, hp->filepath, rte_strerror(errno));
 		}
 	}
 	return 0;
@@ -640,7 +640,8 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl,
 						hp->orig_va = NULL;
 						if (unlink(hp->filepath) == -1) {
 							RTE_LOG(ERR, EAL, "%s(): Removing %s failed: %s\n",
-									__func__, hp->filepath, strerror(errno));
+								__func__, hp->filepath,
+								rte_strerror(errno));
 							return -1;
 						}
 					} else {
@@ -736,13 +737,13 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 		fd = open(hfile->filepath, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Could not open '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			return -1;
 		}
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "Could not lock '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -756,7 +757,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 				MAP_SHARED | MAP_POPULATE | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "Couldn't remap '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -1178,13 +1179,13 @@ eal_legacy_hugepage_init(void)
 		memfd = memfd_create("nohuge", 0);
 		if (memfd < 0) {
 			RTE_LOG(DEBUG, EAL, "Cannot create memfd: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 			RTE_LOG(DEBUG, EAL, "Falling back to anonymous map\n");
 		} else {
 			/* we got an fd - now resize it */
 			if (ftruncate(memfd, internal_conf->memory) < 0) {
 				RTE_LOG(ERR, EAL, "Cannot resize memfd: %s\n",
-						strerror(errno));
+						rte_strerror(errno));
 				RTE_LOG(ERR, EAL, "Falling back to anonymous map\n");
 				close(memfd);
 			} else {
@@ -1212,7 +1213,7 @@ eal_legacy_hugepage_init(void)
 				flags | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED || addr != prealloc_addr) {
 			RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			munmap(prealloc_addr, mem_sz);
 			return -1;
 		}
@@ -1571,7 +1572,7 @@ eal_legacy_hugepage_attach(void)
 		fd = open(hf->filepath, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Could not open %s: %s\n",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto error;
 		}
 
@@ -1579,14 +1580,14 @@ eal_legacy_hugepage_attach(void)
 				MAP_SHARED | MAP_FIXED, fd, 0);
 		if (map_addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "Could not map %s: %s\n",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto fd_error;
 		}
 
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): Locking file failed: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mmap_error;
 		}
 
@@ -1931,7 +1932,7 @@ rte_eal_memseg_init(void)
 
 		if (setrlimit(RLIMIT_NOFILE, &lim) < 0) {
 			RTE_LOG(DEBUG, EAL, "Setting maximum number of open files failed: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 		} else {
 			RTE_LOG(DEBUG, EAL, "Setting maximum number of open files to %"
 					PRIu64 "\n",
diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c
index 3a30284e3a..c80e87309c 100644
--- a/lib/eal/linux/eal_timer.c
+++ b/lib/eal/linux/eal_timer.c
@@ -146,7 +146,7 @@ rte_eal_hpet_init(int make_default)
 	fd = open(DEV_HPET, O_RDONLY);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "ERROR: Cannot open "DEV_HPET": %s!\n",
-			strerror(errno));
+			rte_strerror(errno));
 		internal_conf->no_hpet = 1;
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index ad3c1654b2..c18d4ee8ab 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -368,7 +368,7 @@ vfio_open_group_fd(int iommu_group_num)
 			/* if file not found, it's not an error */
 			if (errno != ENOENT) {
 				RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 				return -1;
 			}
 
@@ -381,7 +381,7 @@ vfio_open_group_fd(int iommu_group_num)
 				if (errno != ENOENT) {
 					RTE_LOG(ERR, EAL,
 						"Cannot open %s: %s\n",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 					return -1;
 				}
 				return -ENOENT;
@@ -791,7 +791,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status);
 	if (ret) {
 		RTE_LOG(ERR, EAL, "%s cannot get VFIO group status, "
-			"error %i (%s)\n", dev_addr, errno, strerror(errno));
+			"error %i (%s)\n", dev_addr, errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -819,7 +819,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"%s cannot add VFIO group to container, error "
-				"%i (%s)\n", dev_addr, errno, strerror(errno));
+				"%i (%s)\n", dev_addr, errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			rte_vfio_clear_group(vfio_group_fd);
 			return -1;
@@ -860,7 +860,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 				RTE_LOG(ERR, EAL,
 					"%s DMA remapping failed, error "
 					"%i (%s)\n",
-					dev_addr, errno, strerror(errno));
+					dev_addr, errno, rte_strerror(errno));
 				close(vfio_group_fd);
 				rte_vfio_clear_group(vfio_group_fd);
 				rte_mcfg_mem_read_unlock();
@@ -978,7 +978,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		RTE_LOG(ERR, EAL, "%s cannot get device info, "
 				"error %i (%s)\n", dev_addr, errno,
-				strerror(errno));
+				rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
@@ -1216,7 +1216,7 @@ vfio_set_iommu_type(int vfio_container_fd)
 		/* not an error, there may be more supported IOMMU types */
 		RTE_LOG(DEBUG, EAL, "Set IOMMU type %d (%s) failed, error "
 				"%i (%s)\n", t->type_id, t->name, errno,
-				strerror(errno));
+				rte_strerror(errno));
 	}
 	/* if we didn't find a suitable IOMMU type, fail */
 	return NULL;
@@ -1234,7 +1234,7 @@ vfio_has_supported_extensions(int vfio_container_fd)
 				t->type_id);
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL, "Could not get IOMMU type, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			close(vfio_container_fd);
 			return -1;
 		} else if (ret == 1) {
@@ -1274,7 +1274,7 @@ rte_vfio_get_container_fd(void)
 			RTE_LOG(ERR, EAL,
 					"Cannot open VFIO container %s, error "
 					"%i (%s)\n", VFIO_CONTAINER_PATH,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1284,7 +1284,7 @@ rte_vfio_get_container_fd(void)
 			if (ret < 0)
 				RTE_LOG(ERR, EAL,
 					"Could not get VFIO API version, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			else
 				RTE_LOG(ERR, EAL, "Unsupported VFIO API version!\n");
 			close(vfio_container_fd);
@@ -1416,7 +1416,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 			} else {
 				RTE_LOG(ERR, EAL,
 					"Cannot set up DMA remapping, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 				return -1;
 			}
 		}
@@ -1430,7 +1430,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot clear DMA remapping, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		} else if (dma_unmap.size != len) {
 			RTE_LOG(ERR, EAL, "Unexpected size %"PRIu64
@@ -1479,7 +1479,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"Cannot register vaddr for IOMMU, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1494,7 +1494,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot map vaddr for IOMMU, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1510,7 +1510,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot unmap vaddr for IOMMU, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1519,7 +1519,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"Cannot unregister vaddr for IOMMU, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -1704,7 +1704,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 	ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
 	if (ret) {
 		RTE_LOG(ERR, EAL, "Cannot get IOMMU info, error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1745,7 +1745,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */
 	if (ret) {
 		RTE_LOG(ERR, EAL, "Cannot create new DMA window, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 		RTE_LOG(ERR, EAL,
 			"Consider using a larger hugepage size if supported by the system\n");
 		return -1;
@@ -2006,7 +2006,7 @@ rte_vfio_noiommu_is_enabled(void)
 	if (fd < 0) {
 		if (errno != ENOENT) {
 			RTE_LOG(ERR, EAL, "Cannot open VFIO noiommu file "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 		/*
@@ -2020,7 +2020,7 @@ rte_vfio_noiommu_is_enabled(void)
 	close(fd);
 	if (cnt != 1) {
 		RTE_LOG(ERR, EAL, "Unable to read from VFIO noiommu file "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c
index afbab9368a..51b4d513f2 100644
--- a/lib/eal/unix/eal_filesystem.c
+++ b/lib/eal/unix/eal_filesystem.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_filesystem.h"
@@ -59,14 +60,14 @@ int eal_create_runtime_dir(void)
 	ret = mkdir(tmp, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
-			tmp, strerror(errno));
+			tmp, rte_strerror(errno));
 		return -1;
 	}
 
 	ret = mkdir(run_dir, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
-			run_dir, strerror(errno));
+			run_dir, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index 68ae93bd6e..d9652496df 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -32,7 +32,7 @@ mem_map(void *requested_addr, size_t size, int prot, int flags,
 		RTE_LOG(DEBUG, EAL,
 		    "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s\n",
 		    requested_addr, size, prot, flags, fd, offset,
-		    strerror(errno));
+		    rte_strerror(errno));
 		rte_errno = errno;
 		return NULL;
 	}
@@ -45,7 +45,7 @@ mem_unmap(void *virt, size_t size)
 	int ret = munmap(virt, size);
 	if (ret < 0) {
 		RTE_LOG(DEBUG, EAL, "Cannot munmap(%p, 0x%zx): %s\n",
-			virt, size, strerror(errno));
+			virt, size, rte_strerror(errno));
 		rte_errno = errno;
 	}
 	return ret;
@@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump)
 	int ret = madvise(virt, size, flags);
 	if (ret) {
 		RTE_LOG(DEBUG, EAL, "madvise(%p, %#zx, %d) failed: %s\n",
-				virt, size, flags, strerror(rte_errno));
+				virt, size, flags, rte_strerror(rte_errno));
 		rte_errno = errno;
 	}
 	return ret;
diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c
index 36a21ab2f9..486fd72277 100644
--- a/lib/eal/unix/rte_thread.c
+++ b/lib/eal/unix/rte_thread.c
@@ -302,7 +302,7 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *))
 	err = pthread_key_create(&((*key)->thread_index), destructor);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_key_create failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		free(*key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -323,7 +323,7 @@ rte_thread_key_delete(rte_thread_key key)
 	err = pthread_key_delete(key->thread_index);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_key_delete failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		free(key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -345,7 +345,7 @@ rte_thread_value_set(rte_thread_key key, const void *value)
 	err = pthread_setspecific(key->thread_index, value);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_setspecific failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		rte_errno = ENOEXEC;
 		return -1;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 03/43] eventdev: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
  2023-11-14  8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang
  2023-11-14  8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang
@ 2023-11-14  8:24 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 04/43] latency: " Dengdui Huang
                   ` (40 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 6db03adf04..d45c2c899e 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1106,7 +1106,7 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data)
 		 */
 		if (err)
 			RTE_EDEV_LOG_ERR("Failed to enqueue interrupt"
-				" to ring: %s", strerror(-err));
+				" to ring: %s", rte_strerror(-err));
 		else
 			rte_eth_dev_rx_intr_disable(port_id, queue);
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 04/43] latency: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (2 preceding siblings ...)
  2023-11-14  8:24 ` [PATCH 03/43] eventdev: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 05/43] node: " Dengdui Huang
                   ` (39 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/latencystats/rte_latencystats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db..a395f9b3bc 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -265,7 +265,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
 		if (ret != 0) {
 			RTE_LOG(INFO, LATENCY_STATS,
 				"Error during getting device (port %u) info: %s\n",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
@@ -309,7 +309,7 @@ rte_latencystats_uninit(void)
 		if (ret != 0) {
 			RTE_LOG(INFO, LATENCY_STATS,
 				"Error during getting device (port %u) info: %s\n",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 05/43] node: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (3 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 04/43] latency: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 06/43] pdump: " Dengdui Huang
                   ` (38 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/node/kernel_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/node/kernel_tx.c b/lib/node/kernel_tx.c
index 27d1808c71..ab92f22cb9 100644
--- a/lib/node/kernel_tx.c
+++ b/lib/node/kernel_tx.c
@@ -36,7 +36,7 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t
 		sin.sin_addr.s_addr = ip4->dst_addr;
 
 		if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0)
-			node_err("kernel_tx", "Unable to send packets: %s\n", strerror(errno));
+			node_err("kernel_tx", "Unable to send packets: %s\n", rte_strerror(errno));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 06/43] pdump: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (4 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 05/43] node: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 07/43] power: " Dengdui Huang
                   ` (37 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/pdump/rte_pdump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 80b90c6f7d..7b7b87bbd1 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -340,7 +340,7 @@ set_pdump_rxtx_cbs(const struct pdump_request *p)
 		if (ret != 0) {
 			PDUMP_LOG(ERR,
 				"Error during getting device (port %u) info: %s\n",
-				port, strerror(-ret));
+				port, rte_strerror(-ret));
 			return ret;
 		}
 
@@ -410,7 +410,7 @@ pdump_server(const struct rte_mp_msg *mp_msg, const void *peer)
 	mp_resp.num_fds = 0;
 	if (rte_mp_reply(&mp_resp, peer) < 0) {
 		PDUMP_LOG(ERR, "failed to send to client:%s\n",
-			  strerror(rte_errno));
+			  rte_strerror(rte_errno));
 		return -1;
 	}
 
@@ -741,7 +741,7 @@ rte_pdump_stats(uint16_t port, struct rte_pdump_stats *stats)
 	if (ret != 0) {
 		PDUMP_LOG(ERR,
 			  "Error during getting device (port %u) info: %s\n",
-			  port, strerror(-ret));
+			  port, rte_strerror(-ret));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 07/43] power: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (5 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 06/43] pdump: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 08/43] telemetry: replace strerror Dengdui Huang
                   ` (36 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/power/guest_channel.c        | 7 ++++---
 lib/power/power_kvm_vm.c         | 3 ++-
 lib/power/power_pstate_cpufreq.c | 7 ++++---
 lib/power/rte_power_pmd_mgmt.c   | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index 7b2ae0b650..1484b384df 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -14,6 +14,7 @@
 
 #include <rte_log.h>
 #include <rte_power.h>
+#include <rte_errno.h>
 
 #include "guest_channel.h"
 
@@ -75,7 +76,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	fd = open(fd_path, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Unable to connect to '%s' with error "
-				"%s\n", fd_path, strerror(errno));
+				"%s\n", fd_path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -104,7 +105,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	if (ret != 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL,
 				"Error on channel '%s' communications test: %s\n",
-				fd_path, ret > 0 ? strerror(ret) :
+				fd_path, ret > 0 ? rte_strerror(ret) :
 				"channel not connected");
 		goto error;
 	}
@@ -184,7 +185,7 @@ int power_guest_channel_read_msg(void *pkt,
 		return -1;
 	} else if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Error occurred during poll function: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index 6a8109d449..bb9c9b95fe 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -5,6 +5,7 @@
 #include <string.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
@@ -82,7 +83,7 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 	if (ret == 0)
 		return 1;
 	RTE_LOG(DEBUG, POWER, "Error sending message: %s\n",
-			ret > 0 ? strerror(ret) : "channel not connected");
+			ret > 0 ? rte_strerror(ret) : "channel not connected");
 	return -1;
 }
 
diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 5ca5f60bcd..eeb0f3831b 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -13,6 +13,7 @@
 
 #include <rte_memcpy.h>
 #include <rte_stdatomic.h>
+#include <rte_errno.h>
 
 #include "rte_power_pmd_mgmt.h"
 #include "power_pstate_cpufreq.h"
@@ -83,7 +84,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (fd < 0) {
 		RTE_LOG(ERR, POWER, "Error opening '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		return fd;
 	}
 
@@ -91,7 +92,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (ret < 0) {
 		RTE_LOG(ERR, POWER, "Error reading '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		goto out;
 	}
 
@@ -99,7 +100,7 @@ power_read_turbo_pct(uint64_t *outVal)
 	*outVal = (uint64_t) strtol(val, &endptr, 10);
 	if (errno != 0 || (*endptr != 0 && *endptr != '\n')) {
 		RTE_LOG(ERR, POWER, "Error converting str to digits, read from %s: %s\n",
-				 POWER_SYSFILE_TURBO_PCT, strerror(errno));
+				 POWER_SYSFILE_TURBO_PCT, rte_strerror(errno));
 		ret = -1;
 		goto out;
 	}
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index 38f8384085..a61a5c8f98 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -574,7 +574,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
 	ret = queue_list_add(lcore_cfg, &qdata);
 	if (ret < 0) {
 		RTE_LOG(DEBUG, POWER, "Failed to add queue to list: %s\n",
-				strerror(-ret));
+				rte_strerror(-ret));
 		goto end;
 	}
 	/* new queue is always added last */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 08/43] telemetry: replace strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (6 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 07/43] power: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 09/43] vhost: use rte strerror Dengdui Huang
                   ` (35 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses strerror_r() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/telemetry/telemetry.c        | 28 ++++++++++++++++++++++------
 lib/telemetry/telemetry_legacy.c |  5 ++++-
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 92982842a8..03be0d342a 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -411,6 +411,9 @@ client_handler(void *sock_id)
 static void *
 socket_listener(void *socket)
 {
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
+
 	while (1) {
 		pthread_t th;
 		int rc;
@@ -433,8 +436,9 @@ socket_listener(void *socket)
 		rc = pthread_create(&th, NULL, s->fn,
 				    (void *)(uintptr_t)s_accepted);
 		if (rc != 0) {
+			strerror_r(rc, err_buf, sizeof(err_buf));
 			TMTY_LOG(ERR, "Error with create client thread: %s\n",
-				 strerror(rc));
+				 err_buf);
 			close(s_accepted);
 			if (s->num_clients != NULL)
 				rte_atomic_fetch_sub_explicit(s->num_clients, 1,
@@ -467,9 +471,13 @@ unlink_sockets(void)
 static int
 create_socket(char *path)
 {
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
+
 	int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0);
 	if (sock < 0) {
-		TMTY_LOG(ERR, "Error with socket creation, %s\n", strerror(errno));
+		strerror_r(errno, err_buf, sizeof(err_buf));
+		TMTY_LOG(ERR, "Error with socket creation, %s\n", err_buf);
 		return -1;
 	}
 
@@ -499,14 +507,16 @@ create_socket(char *path)
 		TMTY_LOG(DEBUG, "Attempting unlink and retrying bind\n");
 		unlink(sun.sun_path);
 		if (bind(sock, (void *) &sun, sizeof(sun)) < 0) {
-			TMTY_LOG(ERR, "Error binding socket: %s\n", strerror(errno));
+			strerror_r(errno, err_buf, sizeof(err_buf));
+			TMTY_LOG(ERR, "Error binding socket: %s\n", err_buf);
 			close(sock);
 			return -errno; /* if unlink failed, this will be -EADDRINUSE as above */
 		}
 	}
 
 	if (listen(sock, 1) < 0) {
-		TMTY_LOG(ERR, "Error calling listen for socket: %s\n", strerror(errno));
+		strerror_r(errno, err_buf, sizeof(err_buf));
+		TMTY_LOG(ERR, "Error calling listen for socket: %s\n", err_buf);
 		unlink(sun.sun_path);
 		close(sock);
 		return -errno;
@@ -531,6 +541,8 @@ set_thread_name(pthread_t id __rte_unused, const char *name __rte_unused)
 static int
 telemetry_legacy_init(void)
 {
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
 	pthread_t t_old;
 	int rc;
 
@@ -552,8 +564,9 @@ telemetry_legacy_init(void)
 	}
 	rc = pthread_create(&t_old, NULL, socket_listener, &v1_socket);
 	if (rc != 0) {
+		strerror_r(rc, err_buf, sizeof(err_buf));
 		TMTY_LOG(ERR, "Error with create legacy socket thread: %s\n",
-			 strerror(rc));
+			 err_buf);
 		close(v1_socket.sock);
 		v1_socket.sock = -1;
 		unlink(v1_socket.path);
@@ -570,7 +583,9 @@ telemetry_legacy_init(void)
 static int
 telemetry_v2_init(void)
 {
+#define ERR_BUFF_SZ 256
 	char spath[sizeof(v2_socket.path)];
+	char err_buf[ERR_BUFF_SZ] = {0};
 	pthread_t t_new;
 	short suffix = 0;
 	int rc;
@@ -606,8 +621,9 @@ telemetry_v2_init(void)
 	}
 	rc = pthread_create(&t_new, NULL, socket_listener, &v2_socket);
 	if (rc != 0) {
+		strerror_r(rc, err_buf, sizeof(err_buf));
 		TMTY_LOG(ERR, "Error with create socket thread: %s\n",
-			 strerror(rc));
+			 err_buf);
 		close(v2_socket.sock);
 		v2_socket.sock = -1;
 		unlink(v2_socket.path);
diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c
index 4c1d1c353a..3253dd9c1f 100644
--- a/lib/telemetry/telemetry_legacy.c
+++ b/lib/telemetry/telemetry_legacy.c
@@ -81,6 +81,8 @@ register_client(const char *cmd __rte_unused, const char *params,
 		char *buffer __rte_unused, int buf_len __rte_unused)
 {
 #ifndef RTE_EXEC_ENV_WINDOWS
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
 	pthread_t th;
 	char data[BUF_SIZE];
 	int fd;
@@ -117,8 +119,9 @@ register_client(const char *cmd __rte_unused, const char *params,
 	rc = pthread_create(&th, NULL, &legacy_client_handler,
 				(void *)(uintptr_t)fd);
 	if (rc != 0) {
+		strerror_r(rc, err_buf, sizeof(err_buf));
 		fprintf(stderr, "Failed to create legacy client thread: %s\n",
-			strerror(rc));
+			err_buf);
 		close(fd);
 		return -1;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 09/43] vhost: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (7 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 08/43] telemetry: replace strerror Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 10/43] bpf: " Dengdui Huang
                   ` (34 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/vhost/socket.c     | 13 +++++++------
 lib/vhost/vduse.c      | 30 +++++++++++++++---------------
 lib/vhost/vhost_user.c | 11 ++++++-----
 3 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 5882e44176..0b030222d6 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -16,6 +16,7 @@
 
 #include <rte_thread.h>
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 #include "vduse.h"
@@ -129,7 +130,7 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m
 	if (ret <= 0) {
 		if (ret)
 			VHOST_LOG_CONFIG(ifname, ERR, "recvmsg failed on fd %d (%s)\n",
-				sockfd, strerror(errno));
+				sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -200,7 +201,7 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f
 
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(ifname, ERR, "sendmsg error on fd %d (%s)\n",
-			sockfd, strerror(errno));
+			sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -358,7 +359,7 @@ create_unix_socket(struct vhost_user_socket *vsocket)
 	if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) {
 		VHOST_LOG_CONFIG(vsocket->path, ERR,
 			"vhost-user: can't set nonblocking mode for socket, fd: %d (%s)\n",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -392,7 +393,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket)
 	ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(path, ERR, "failed to bind: %s; remove it and try again\n",
-			strerror(errno));
+			rte_strerror(errno));
 		goto err;
 	}
 	VHOST_LOG_CONFIG(path, INFO, "binding succeeded\n");
@@ -445,7 +446,7 @@ vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz)
 	flags = fcntl(fd, F_GETFL, 0);
 	if (flags < 0) {
 		VHOST_LOG_CONFIG(path, ERR, "can't get flags for connfd %d (%s)\n",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		return -2;
 	}
 	if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) {
@@ -539,7 +540,7 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
 		return 0;
 	}
 
-	VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", strerror(errno));
+	VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", rte_strerror(errno));
 
 	if (ret == -2 || !vsocket->reconnect) {
 		close(fd);
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index 080b58f7de..12e4b9c891 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -135,7 +135,7 @@ vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &buf, sizeof(buf));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read control queue event: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -157,7 +157,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_GET_INFO, &vq_info);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get VQ %u info: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		return;
 	}
 
@@ -183,7 +183,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	vq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (vq->kickfd < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to init kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		vq->kickfd = VIRTIO_INVALID_EVENTFD;
 		return;
 	}
@@ -213,7 +213,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to setup kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		close(vq->kickfd);
 		vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
 		return;
@@ -224,7 +224,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 		if (ret) {
 			VHOST_LOG_CONFIG(dev->ifname, ERR,
 					"Failed to setup kickfd handler for VQ %u: %s\n",
-					index, strerror(errno));
+					index, rte_strerror(errno));
 			vq_efd.fd = VDUSE_EVENTFD_DEASSIGN;
 			ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 			close(vq->kickfd);
@@ -254,7 +254,7 @@ vduse_vring_cleanup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret)
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 
 	close(vq->kickfd);
 	vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
@@ -291,7 +291,7 @@ vduse_device_start(struct virtio_net *dev)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_DEV_GET_FEATURES, &dev->features);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get features: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -358,7 +358,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &req, sizeof(req));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read request: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	} else if (ret < (int)sizeof(req)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Incomplete to read request %d\n", ret);
@@ -400,7 +400,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = write(dev->vduse_dev_fd, &resp, sizeof(resp));
 	if (ret != sizeof(resp)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to write response %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -453,13 +453,13 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	control_fd = open(VDUSE_CTRL_PATH, O_RDWR);
 	if (control_fd < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to open %s: %s\n",
-				VDUSE_CTRL_PATH, strerror(errno));
+				VDUSE_CTRL_PATH, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(control_fd, VDUSE_SET_API_VERSION, &ver)) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to set API version: %" PRIu64 ": %s\n",
-				ver, strerror(errno));
+				ver, rte_strerror(errno));
 		ret = -1;
 		goto out_ctrl_close;
 	}
@@ -507,14 +507,14 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	ret = ioctl(control_fd, VDUSE_CREATE_DEV, dev_config);
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to create VDUSE device: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		goto out_free;
 	}
 
 	dev_fd = open(path, O_RDWR);
 	if (dev_fd < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to open device %s: %s\n",
-				path, strerror(errno));
+				path, rte_strerror(errno));
 		ret = -1;
 		goto out_dev_close;
 	}
@@ -522,7 +522,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	ret = fcntl(dev_fd, F_SETFL, O_NONBLOCK);
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to set chardev as non-blocking: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		goto out_dev_close;
 	}
 
@@ -625,7 +625,7 @@ vduse_device_destroy(const char *path)
 		ret = ioctl(dev->vduse_ctrl_fd, VDUSE_DESTROY_DEV, name);
 		if (ret)
 			VHOST_LOG_CONFIG(name, ERR, "Failed to destroy VDUSE device: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 		close(dev->vduse_ctrl_fd);
 		dev->vduse_ctrl_fd = -1;
 	}
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index e36312181a..ebf5afe45d 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -772,7 +772,8 @@ mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz)
 
 	if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) {
 		rte_log(RTE_LOG_INFO, vhost_config_log_level,
-			"VHOST_CONFIG: could not set coredump preference (%s).\n", strerror(errno));
+			"VHOST_CONFIG: could not set coredump preference (%s).\n",
+			rte_strerror(errno));
 	}
 #endif
 }
@@ -1138,7 +1139,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev,
 			(uint64_t)reg_struct.range.start +
 			(uint64_t)reg_struct.range.len - 1,
 			dev->postcopy_ufd,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -1267,7 +1268,7 @@ vhost_user_mmap_region(struct virtio_net *dev,
 			MAP_SHARED | populate, region->fd, 0);
 
 	if (mmap_addr == MAP_FAILED) {
-		VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", strerror(errno));
+		VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -2698,7 +2699,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (dev->postcopy_ufd == -1) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR,
 			"userfaultfd not available: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		return RTE_VHOST_MSG_RESULT_ERR;
 	}
 	api_struct.api = UFFD_API;
@@ -2706,7 +2707,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR,
 			"UFFDIO_API ioctl failure: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dev->postcopy_ufd);
 		dev->postcopy_ufd = -1;
 		return RTE_VHOST_MSG_RESULT_ERR;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 10/43] bpf: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (8 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 09/43] vhost: use rte strerror Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 11/43] bus/cdx: " Dengdui Huang
                   ` (33 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/bpf/bpf_load_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bpf/bpf_load_elf.c b/lib/bpf/bpf_load_elf.c
index 02a5d8ba0d..6fc7018ddf 100644
--- a/lib/bpf/bpf_load_elf.c
+++ b/lib/bpf/bpf_load_elf.c
@@ -310,7 +310,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	if (fd < 0) {
 		rc = errno;
 		RTE_BPF_LOG(ERR, "%s(%s) error code: %d(%s)\n",
-			__func__, fname, rc, strerror(rc));
+			__func__, fname, rc, rte_strerror(rc));
 		rte_errno = EINVAL;
 		return NULL;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 11/43] bus/cdx: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (9 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 10/43] bpf: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 12/43] bus/dpaa: " Dengdui Huang
                   ` (32 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/cdx/cdx.c      |  2 +-
 drivers/bus/cdx/cdx_vfio.c | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 541aae76c3..a3161f8ee4 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -271,7 +271,7 @@ cdx_scan(void)
 	dir = opendir(RTE_CDX_BUS_DEVICES_PATH);
 	if (dir == NULL) {
 		CDX_BUS_INFO("%s(): opendir failed: %s", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 8a3ac0b995..6fb38abfac 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -20,6 +20,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "bus_cdx_driver.h"
 #include "cdx_logs.h"
@@ -198,7 +199,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			CDX_BUS_ERR("Cannot get VFIO IRQ info, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -216,7 +217,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			CDX_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -252,7 +253,7 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd,
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		CDX_BUS_ERR("Unable to reset device! Error: %d (%s)", errno,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -410,7 +411,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s cannot get device region info error %i (%s)",
-				dev_name, errno, strerror(errno));
+				dev_name, errno, rte_strerror(errno));
 			goto err_vfio_res;
 		}
 
@@ -438,7 +439,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, 0);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping region %i failed: %s",
-				cdx_addr, i, strerror(errno));
+				cdx_addr, i, rte_strerror(errno));
 			free(reg);
 			goto err_vfio_res;
 		}
@@ -506,7 +507,7 @@ cdx_vfio_map_resource_secondary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping MMIO region %i failed: %s",
-				dev_name, i, strerror(errno));
+				dev_name, i, rte_strerror(errno));
 			goto err_vfio_dev_fd;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 12/43] bus/dpaa: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (10 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 11/43] bus/cdx: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 13/43] bus/fslmc: " Dengdui Huang
                   ` (31 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 2 +-
 drivers/bus/dpaa/dpaa_bus.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 1814372a40..fe694e447c 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -725,7 +725,7 @@ fman_finish(void)
 		if (unlikely(_errno < 0))
 			fprintf(stderr, "%s:%d:%s(): munmap() = %d (%s)\n",
 				__FILE__, __LINE__, __func__,
-				-errno, strerror(errno));
+				-errno, rte_strerror(errno));
 		printf("Tearing down %s\n", __if->node_path);
 		list_del(&__if->__if.node);
 		rte_free(__if);
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e57159f5d8..ea80168b7c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -605,7 +605,7 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		DPAA_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return errno;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 13/43] bus/fslmc: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (11 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 12/43] bus/dpaa: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 14/43] bus/pci: " Dengdui Huang
                   ` (30 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 5966776a85..1cbbcf9019 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -481,7 +481,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get group status, "
 				"error %i (%s)\n", dev_addr,
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -504,7 +504,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			DPAA2_BUS_ERR("  %s cannot add VFIO group to container, "
 					"error %i (%s)\n", dev_addr,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			close(vfio_container_fd);
 			rte_vfio_clear_group(vfio_group_fd);
@@ -551,7 +551,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info);
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get device info, error %i (%s)",
-				dev_addr, errno, strerror(errno));
+				dev_addr, errno, rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		close(vfio_container_fd);
@@ -617,7 +617,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index)
 	if (ret) {
 		DPAA2_BUS_ERR("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)",
 			      rte_intr_fd_get(intr_handle), errno,
-			      strerror(errno));
+			      rte_strerror(errno));
 		return ret;
 	}
 
@@ -667,7 +667,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info);
 		if (ret < 0) {
 			DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)",
-				      i, errno, strerror(errno));
+				      i, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -682,7 +682,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				      errno, strerror(errno));
+				      errno, rte_strerror(errno));
 			return -1;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 14/43] bus/pci: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (12 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 13/43] bus/fslmc: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 15/43] bus/vdev: " Dengdui Huang
                   ` (29 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/pci/bsd/pci.c        |  8 ++++----
 drivers/bus/pci/linux/pci.c      |  7 ++++---
 drivers/bus/pci/linux/pci_uio.c  | 23 ++++++++++++-----------
 drivers/bus/pci/linux/pci_vfio.c | 23 ++++++++++++-----------
 drivers/bus/pci/pci_common_uio.c |  3 ++-
 5 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 27f12590d4..ce08372931 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -125,7 +125,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
 	if (rte_intr_fd_get(dev->intr_handle) < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -169,7 +169,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
 	if (maps[map_idx].path == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -179,7 +179,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+				devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -353,7 +353,7 @@ rte_pci_scan(void)
 		unsigned i;
 		if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
 			RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 			goto error;
 		}
 
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 3d237398d9..7d870b43d2 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -12,6 +12,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -455,7 +456,7 @@ rte_pci_scan(void)
 	dir = opendir(rte_pci_get_sysfs_path());
 	if (dir == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -506,7 +507,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev)
 			return true;
 
 		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return false;
 	}
 
@@ -557,7 +558,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
 
 	if (fp == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return ret;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 97d740dfe5..2ee0179ea2 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -21,6 +21,7 @@
 #include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
@@ -111,7 +112,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
 	ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);
 	if (ret != 0) {
 		RTE_LOG(ERR, EAL, "%s(): mknod() failed %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -241,7 +242,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -254,7 +255,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	uio_cfg_fd = open(cfgname, O_RDWR);
 	if (uio_cfg_fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			cfgname, strerror(errno));
+			cfgname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -314,7 +315,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0);
 	if (maps[map_idx].path == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -348,7 +349,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 		fd = open(devname, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+				devname, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -404,7 +405,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot open sysfs resource: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -446,7 +447,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
 		if (uio_num < 0) {
 			RTE_LOG(ERR, EAL, "cannot open %s: %s\n",
-				dirname, strerror(errno));
+				dirname, rte_strerror(errno));
 			goto error;
 		}
 
@@ -454,7 +455,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		fd = open(filename, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				filename, strerror(errno));
+				filename, rte_strerror(errno));
 			goto error;
 		}
 		if (rte_intr_fd_set(dev->intr_handle, fd))
@@ -494,7 +495,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot open sysfs resource: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 	for (i = 0; i < bar + 1; i++) {
@@ -518,7 +519,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	fd = open(filename, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", filename,
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE,
@@ -526,7 +527,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	close(fd);
 	if (addr == MAP_FAILED) {
 		RTE_LOG(ERR, EAL, "Cannot mmap IO port resource: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 3f3201daf2..671b0f36bc 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -21,6 +21,7 @@
 #include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -225,7 +226,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL, "Cannot get VFIO IRQ info, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -252,7 +253,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot set up eventfd, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -336,7 +337,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot set up eventfd, error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -460,7 +461,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -742,7 +743,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd,
 		ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			RTE_LOG(DEBUG, EAL, "%s cannot get device region info error %i (%s)\n",
-				dev->name, errno, strerror(errno));
+				dev->name, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -811,7 +812,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		VFIO_PCI_CONFIG_REGION_INDEX);
 	if (ret < 0) {
 		RTE_LOG(ERR, EAL, "%s cannot get device region info error %i (%s)\n",
-			dev->name, errno, strerror(errno));
+			dev->name, errno, rte_strerror(errno));
 		goto err_vfio_res;
 	}
 	pdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size;
@@ -851,7 +852,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL,
 				"%s cannot get device region info error "
-				"%i (%s)\n", pci_addr, errno, strerror(errno));
+				"%i (%s)\n", pci_addr, errno, rte_strerror(errno));
 			goto err_map;
 		}
 
@@ -914,7 +915,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -922,7 +923,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -1019,14 +1020,14 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		} else {
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		}
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index 76c661f054..5d59a90b33 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -15,6 +15,7 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -44,7 +45,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 			fd = open(uio_res->maps[i].path, O_RDWR);
 			if (fd < 0) {
 				RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-					uio_res->maps[i].path, strerror(errno));
+					uio_res->maps[i].path, rte_strerror(errno));
 				return -1;
 			}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 15/43] bus/vdev: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (13 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 14/43] bus/pci: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 16/43] bus/vmbus: " Dengdui Huang
                   ` (28 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/vdev/vdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7974b27295..bdb5fa8fce 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -432,7 +432,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 			strlcpy(ou->name, devname, RTE_DEV_NAME_MAX_LEN);
 			if (rte_mp_sendmsg(&mp_resp) < 0)
 				VDEV_LOG(ERR, "send vdev, %s, failed, %s",
-					 devname, strerror(rte_errno));
+					 devname, rte_strerror(rte_errno));
 			num++;
 		}
 		rte_spinlock_recursive_unlock(&vdev_device_list_lock);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 16/43] bus/vmbus: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (14 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 15/43] bus/vdev: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 17/43] common/cnxk: " Dengdui Huang
                   ` (27 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/vmbus/linux/vmbus_bus.c  |  7 ++++---
 drivers/bus/vmbus/linux/vmbus_uio.c  | 21 +++++++++++----------
 drivers/bus/vmbus/vmbus_common.c     |  4 ++--
 drivers/bus/vmbus/vmbus_common_uio.c |  3 ++-
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 01d8111b85..0c92c1d4dd 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -18,6 +18,7 @@
 #include <rte_memory.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "private.h"
@@ -50,7 +51,7 @@ parse_sysfs_uuid(const char *filename, rte_uuid_t uu)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s: %s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -92,7 +93,7 @@ get_sysfs_string(const char *filename, char *buf, size_t buflen)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s:%s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -350,7 +351,7 @@ rte_vmbus_scan(void)
 			return 0;
 
 		VMBUS_LOG(ERR, "opendir %s failed: %s",
-			  SYSFS_VMBUS_DEVICES, strerror(errno));
+			  SYSFS_VMBUS_DEVICES, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 26edef342d..5fce68d880 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -18,6 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
 #include <rte_string_fns.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -34,7 +35,7 @@ void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff)
 		  sizeof(onoff)) < 0) {
 		VMBUS_LOG(ERR, "cannot write to %d:%s",
 			  rte_intr_fd_get(dev->intr_handle),
-			  strerror(errno));
+			  rte_strerror(errno));
 	}
 }
 
@@ -51,7 +52,7 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev)
 	if (cc < (int)sizeof(count)) {
 		if (cc < 0) {
 			VMBUS_LOG(ERR, "IRQ read failed %s",
-				  strerror(errno));
+				  rte_strerror(errno));
 			return -errno;
 		}
 		VMBUS_LOG(ERR, "can't read IRQ count");
@@ -91,7 +92,7 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -158,7 +159,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -256,13 +257,13 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
 	fd = open(ring_path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		return -errno;
 	}
 
 	if (fstat(fd, &sb) < 0) {
 		VMBUS_LOG(ERR, "Cannot state %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		close(fd);
 		return -errno;
 	}
@@ -342,7 +343,7 @@ static int vmbus_uio_sysfs_read(const char *dir, const char *name,
 	f = fopen(path, "r");
 	if (!f) {
 		VMBUS_LOG(ERR, "can't open %s:%s",
-			  path, strerror(errno));
+			  path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -404,7 +405,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 	chan_dir = opendir(chan_path);
 	if (!chan_dir) {
 		VMBUS_LOG(ERR, "cannot open %s: %s",
-			  chan_path, strerror(errno));
+			  chan_path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -441,7 +442,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &subid, UINT16_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no subchannel_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
@@ -452,7 +453,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &monid, UINT8_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no monitor_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index b9139c6e6c..e1a80c9587 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -38,7 +38,7 @@ vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 		VMBUS_LOG(ERR,
 			  "mmap(%d, %p, %zu, %ld) failed: %s",
 			  fd, requested_addr, size, (long)offset,
-			  strerror(errno));
+			  rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory mapped at %p",
 			  mapaddr);
@@ -57,7 +57,7 @@ vmbus_unmap_resource(void *requested_addr, size_t size)
 	if (munmap(requested_addr, size)) {
 		VMBUS_LOG(ERR, "munmap(%p, 0x%lx) failed: %s",
 			requested_addr, (unsigned long)size,
-			strerror(errno));
+			rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory unmapped at %p",
 			  requested_addr);
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 4d4613513c..54c1187026 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -14,6 +14,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -56,7 +57,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 17/43] common/cnxk: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (15 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 16/43] bus/vmbus: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 18/43] common/mlx5: " Dengdui Huang
                   ` (26 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/common/cnxk/roc_dev.c   | 4 +++-
 drivers/common/cnxk/roc_model.c | 4 +++-
 drivers/common/cnxk/roc_utils.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index e7e89bf3d6..812e6890f0 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -8,6 +8,8 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -1313,7 +1315,7 @@ dev_lmt_setup(struct dev *dev)
 	mz = plt_lmt_region_reserve_aligned(name, LMT_REGION_SIZE,
 					    LMT_REGION_SIZE);
 	if (!mz) {
-		plt_err("Memory alloc failed: %s", strerror(errno));
+		plt_err("Memory alloc failed: %s", rte_strerror(errno));
 		goto fail;
 	}
 
diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index 6dc2afe7f0..647af4b7ab 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -6,6 +6,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -154,7 +156,7 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass)
 	dir = opendir(SYSFS_PCI_DEVICES);
 	if (dir == NULL) {
 		plt_err("%s(): opendir failed: %s\n", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return -errno;
 	}
 
diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c
index 9af2ae9b69..418cd6b477 100644
--- a/drivers/common/cnxk/roc_utils.c
+++ b/drivers/common/cnxk/roc_utils.c
@@ -2,6 +2,8 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -245,7 +247,7 @@ roc_error_msg_get(int errorcode)
 		 * Handle general error (as defined in linux errno.h)
 		 */
 		if (abs(errorcode) < 300)
-			err_msg = strerror(abs(errorcode));
+			err_msg = rte_strerror(abs(errorcode));
 		else
 			err_msg = "Unknown error code";
 		break;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 18/43] common/mlx5: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (16 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 17/43] common/cnxk: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 19/43] crypto/caam_jr: " Dengdui Huang
                   ` (25 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/common/mlx5/linux/mlx5_nl.c  | 12 ++++++------
 drivers/common/mlx5/mlx5_common.c    |  6 +++---
 drivers/common/mlx5/mlx5_devx_cmds.c |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index 28a1f56dba..1de867089f 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -547,7 +547,7 @@ mlx5_nl_mac_addr_list(int nlsk_fd, unsigned int iface_idx,
 	return 0;
 error:
 	DRV_LOG(DEBUG, "Interface %u cannot retrieve MAC address list %s",
-		iface_idx, strerror(rte_errno));
+		iface_idx, rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -617,7 +617,7 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s MAC address %s %s",
 			iface_idx,
-			add ? "add" : "remove", m, strerror(rte_errno));
+			add ? "add" : "remove", m, rte_strerror(rte_errno));
 	}
 #endif
 	return -rte_errno;
@@ -704,7 +704,7 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		RTE_ETHER_ADDR_PRT_FMT " : %s",
 		vf_index,
 		RTE_ETHER_ADDR_BYTES(mac),
-		strerror(rte_errno));
+		rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -929,7 +929,7 @@ mlx5_nl_promisc(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s promisc mode: Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -956,7 +956,7 @@ mlx5_nl_allmulti(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s allmulti : Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -1934,7 +1934,7 @@ mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg)
 			if (errno == EINTR)
 				continue;
 			DRV_LOG(DEBUG, "Failed to receive netlink message: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return -rte_errno;
 		}
diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index ca8543e36e..7aafd0083d 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -762,7 +762,7 @@ mlx5_common_dev_create(struct rte_device *eal_dev, uint32_t classes,
 	ret = mlx5_common_config_get(mkvlist, &cdev->config);
 	if (ret < 0) {
 		DRV_LOG(ERR, "Failed to process device arguments: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		rte_free(cdev);
 		return NULL;
 	}
@@ -837,7 +837,7 @@ mlx5_common_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_common_config_get(mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
@@ -1011,7 +1011,7 @@ mlx5_common_dev_probe(struct rte_device *eal_dev)
 		if (ret) {
 			DRV_LOG(ERR,
 				"Probe again parameters aren't compatible : %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto class_err;
 		}
 	}
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 4d8818924a..b33b5d3044 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -640,7 +640,7 @@ mlx5_devx_cmd_match_sample_info_query(void *ctx, uint32_t sample_field_id,
 	rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 	if (rc) {
 		DRV_LOG(ERR, "Failed to query match sample info using DevX: %s",
-			strerror(rc));
+			rte_strerror(rc));
 		rte_errno = rc;
 		return -rc;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 19/43] crypto/caam_jr: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (17 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 18/43] common/mlx5: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 20/43] dma/idxd: " Dengdui Huang
                   ` (24 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 583ba3b523..b612407c41 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -17,6 +17,7 @@
 #include <rte_malloc.h>
 #include <rte_crypto.h>
 #include <rte_security.h>
+#include <rte_errno.h>
 
 #include <caam_jr_config.h>
 #include <caam_jr_hw_specific.h>
@@ -355,7 +356,7 @@ free_job_ring(int uio_fd)
 	if (munmap(job_ring->register_base_addr, job_ring->map_size)) {
 		CAAM_JR_INFO("cannot munmap(%p, 0x%lx): %s",
 			job_ring->register_base_addr,
-			(unsigned long)job_ring->map_size, strerror(errno));
+			(unsigned long)job_ring->map_size, rte_strerror(errno));
 	} else
 		CAAM_JR_DEBUG("JR UIO memory is unmapped");
 
@@ -419,7 +420,7 @@ sec_configure(void)
 	d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		printf("\nError opening directory '%s': %s\n",
-			SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 20/43] dma/idxd: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (18 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 19/43] crypto/caam_jr: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 21/43] net/af_packet: " Dengdui Huang
                   ` (23 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/dma/idxd/idxd_bus.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 3b2d4c2b65..a230976c98 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -145,7 +145,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	fd = open(sysfs_node, O_RDONLY);
 	if (fd < 0) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
@@ -153,7 +153,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	close(fd);
 	if (len < 0) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 	value[len] = '\0';
@@ -173,13 +173,13 @@ read_wq_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -200,13 +200,13 @@ read_device_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -317,7 +317,7 @@ dsa_scan(void)
 		if (errno == ENOENT)
 			return 0; /* no bus, return without error */
 		IDXD_PMD_ERR("%s(): opendir '%s' failed: %s",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 21/43] net/af_packet: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (19 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 20/43] dma/idxd: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 22/43] net/bnxt: " Dengdui Huang
                   ` (22 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 397a32db58..2f884d4b7f 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -108,7 +108,7 @@ RTE_LOG_REGISTER_DEFAULT(af_packet_logtype, NOTICE);
 
 #define PMD_LOG_ERRNO(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
-		"%s(): " fmt ":%s\n", __func__, ##args, strerror(errno))
+		"%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno))
 
 static uint16_t
 eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 22/43] net/bnxt: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (20 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 21/43] net/af_packet: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 23/43] net/af_xdp: " Dengdui Huang
                   ` (21 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 17 files changed, 360 insertions(+), 360 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 0e25207fc3..4212065b32 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -942,7 +942,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 	ret = bnxt_hwrm_port_clr_stats(bp);
 	if (ret != 0)
 		PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n",
-			    strerror(-ret));
+			    rte_strerror(-ret));
 
 	bnxt_clear_prev_stat(bp);
 
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 964a5aeb05..558085ec0c 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -149,7 +149,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -191,7 +191,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -249,7 +249,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -308,7 +308,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -365,7 +365,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -409,7 +409,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -600,7 +600,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -636,7 +636,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -670,7 +670,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -705,7 +705,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -744,7 +744,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -827,7 +827,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -871,7 +871,7 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 3a812bee3a..2c7ee09888 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -205,7 +205,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -215,7 +215,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -232,7 +232,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM insert failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -261,7 +261,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -271,7 +271,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -285,7 +285,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM delete failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -313,7 +313,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -323,7 +323,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -338,7 +338,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -347,7 +347,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -375,7 +375,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -385,7 +385,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -400,7 +400,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -409,7 +409,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -437,7 +437,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -456,7 +456,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -468,7 +468,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -497,7 +497,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -507,7 +507,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -516,7 +516,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -529,7 +529,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -566,7 +566,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -575,7 +575,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -589,7 +589,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier search failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -615,7 +615,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -625,7 +625,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -634,7 +634,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -656,7 +656,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -688,7 +688,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -707,7 +707,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -720,7 +720,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -748,7 +748,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -758,7 +758,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -768,7 +768,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -786,7 +786,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	TFP_DRV_LOG(DEBUG,
@@ -816,7 +816,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -826,7 +826,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -835,7 +835,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -853,7 +853,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_sz_in_bits = gparms.key_size * 8;
@@ -881,7 +881,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -891,7 +891,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -900,7 +900,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -935,7 +935,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -945,7 +945,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -954,7 +954,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -963,7 +963,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries move failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -986,7 +986,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -996,7 +996,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1005,7 +1005,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1014,7 +1014,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries clear failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1042,7 +1042,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1052,7 +1052,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1067,7 +1067,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1076,7 +1076,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: External table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1085,7 +1085,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1094,7 +1094,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1124,7 +1124,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1134,7 +1134,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1149,7 +1149,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1158,7 +1158,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1167,7 +1167,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1177,7 +1177,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1204,7 +1204,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1214,7 +1214,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1231,7 +1231,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1240,7 +1240,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}  else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1249,7 +1249,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1258,7 +1258,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1267,7 +1267,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1295,7 +1295,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1305,7 +1305,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	gparms.dir = parms->dir;
@@ -1320,7 +1320,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1329,7 +1329,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1338,7 +1338,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1366,7 +1366,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1376,7 +1376,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1393,7 +1393,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s, External table type not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 
 		return rc;
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1402,7 +1402,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table bulk get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		}
 		return rc;
 	}
@@ -1412,7 +1412,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1421,7 +1421,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Table get bulk failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -1442,7 +1442,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1452,7 +1452,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1463,7 +1463,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1472,7 +1472,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Get table increment not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1494,7 +1494,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1503,7 +1503,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1532,7 +1532,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1541,7 +1541,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1571,7 +1571,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1580,7 +1580,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1612,7 +1612,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1622,7 +1622,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1631,7 +1631,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1646,7 +1646,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1670,7 +1670,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1680,7 +1680,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1689,7 +1689,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1704,7 +1704,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1725,7 +1725,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1734,7 +1734,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1744,7 +1744,7 @@ int tf_get_session_info(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1752,14 +1752,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Ident get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tbl_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1767,14 +1767,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Tbl get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tcam_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1782,14 +1782,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "TCAM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_em_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1797,7 +1797,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -1861,7 +1861,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1870,7 +1870,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1901,7 +1901,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1911,7 +1911,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1943,7 +1943,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1952,7 +1952,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1984,7 +1984,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1993,7 +1993,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c
index c518150d1f..162bc275b9 100644
--- a/drivers/net/bnxt/tf_core/tf_em_common.c
+++ b/drivers/net/bnxt/tf_core/tf_em_common.c
@@ -51,7 +51,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (tfp_calloc(&parms) != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: external pool failure %s\n",
-			    tf_dir_2_str(dir), strerror(ENOMEM));
+			    tf_dir_2_str(dir), rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -61,7 +61,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (rc != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: stack init failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -78,7 +78,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 		rc = stack_push(pool, j);
 		if (rc != 0) {
 			TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-				    tf_dir_2_str(dir), strerror(-rc));
+				    tf_dir_2_str(dir), rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -93,7 +93,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 	if (!stack_is_full(pool)) {
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 	return 0;
@@ -921,7 +921,7 @@ tf_em_ext_common_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_ext_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -980,7 +980,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -989,7 +989,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -997,7 +997,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1157,7 +1157,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Map table scope operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1167,14 +1167,14 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 	data = aparms.mem_va;
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		rc = -ENOMEM;
 		goto clean;
 	}
@@ -1188,7 +1188,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map table scope config failure, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleaner;
 	}
 
@@ -1203,7 +1203,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map tbl scope, set failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 cleaner:
 	tfp_free(mask);
diff --git a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
index d72ac83295..fe9c710f26 100644
--- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
@@ -130,7 +130,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -165,7 +165,7 @@ tf_em_move_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c
index 9efffe4ee5..55d27b88a2 100644
--- a/drivers/net/bnxt/tf_core/tf_em_host.c
+++ b/drivers/net/bnxt/tf_core/tf_em_host.c
@@ -182,7 +182,7 @@ tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl)
 			TFP_DRV_LOG(WARNING,
 				"Failed to allocate page table: lvl: %d, rc:%s\n",
 				i,
-				strerror(-rc));
+				rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -379,7 +379,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -387,7 +387,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
@@ -396,7 +396,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EEM: PF query error rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -420,7 +420,7 @@ tf_em_ext_alloc(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			"Failed to allocate session table scope, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -436,7 +436,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to query for EEM capability,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 	}
@@ -456,7 +456,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to register for EEM ctx,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 
@@ -473,7 +473,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "TBL: Unable to configure EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -485,7 +485,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to enable EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -501,7 +501,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s TBL: Unable to allocate idx pools %s\n",
 				    tf_dir_2_str(dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 	}
@@ -547,7 +547,7 @@ tf_em_ext_free(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -555,7 +555,7 @@ tf_em_ext_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
index 46de63a9da..21cf19c45e 100644
--- a/drivers/net/bnxt/tf_core/tf_em_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
@@ -49,7 +49,7 @@ tf_em_insert_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -113,7 +113,7 @@ tf_em_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -153,7 +153,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -163,7 +163,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -202,7 +202,7 @@ tf_em_int_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -232,7 +232,7 @@ tf_em_int_bind(struct tf *tfp,
 				    "%s, EM Allocation must be in blocks of %d, failure %s\n",
 				    tf_dir_2_str(i),
 				    TF_SESSION_EM_ENTRY_SIZE,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 			return rc;
 		}
@@ -278,7 +278,7 @@ tf_em_int_bind(struct tf *tfp,
 				TFP_DRV_LOG(ERR,
 					 "%s, EM stack allocation failure %s\n",
 					 tf_dir_2_str(i),
-					 strerror(-rc));
+					 rte_strerror(-rc));
 				return rc;
 			}
 
diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c
index 3a8030a2fb..ba748fdc23 100644
--- a/drivers/net/bnxt/tf_core/tf_global_cfg.c
+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c
@@ -83,7 +83,7 @@ tf_global_cfg_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -141,7 +141,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -151,7 +151,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -185,7 +185,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -196,7 +196,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c
index 7d9d9595dd..21e60a8ad5 100644
--- a/drivers/net/bnxt/tf_core/tf_identifier.c
+++ b/drivers/net/bnxt/tf_core/tf_identifier.c
@@ -39,7 +39,7 @@ tf_ident_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "ident_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -124,7 +124,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -164,7 +164,7 @@ tf_ident_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -222,7 +222,7 @@ tf_ident_search(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c
index 578d361417..4d85b77b4e 100644
--- a/drivers/net/bnxt/tf_core/tf_if_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c
@@ -65,7 +65,7 @@ tf_if_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_if_tbl_set(struct tf *tfp,
 			    "%s, If Tbl set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -187,7 +187,7 @@ tf_if_tbl_get(struct tf *tfp,
 			    "%s, If Tbl get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c
index 1c66c7e01a..5e180813d8 100644
--- a/drivers/net/bnxt/tf_core/tf_msg.c
+++ b/drivers/net/bnxt/tf_core/tf_msg.c
@@ -216,7 +216,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -224,7 +224,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -291,7 +291,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -299,7 +299,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -361,7 +361,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -370,7 +370,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -378,7 +378,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(WARNING,
 			    "%s: QCAPS message size error, rc:%s, request %d vs response %d\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL),
+			    rte_strerror(EINVAL),
 			    size,
 			    resp.size);
 	}
@@ -498,7 +498,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -509,7 +509,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -559,7 +559,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -605,7 +605,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -616,7 +616,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -666,7 +666,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -712,7 +712,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -722,7 +722,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -731,7 +731,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -797,7 +797,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -807,7 +807,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -816,7 +816,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -830,7 +830,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -893,7 +893,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -903,7 +903,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -927,7 +927,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Record size to large, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -982,7 +982,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -992,7 +992,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1001,7 +1001,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1050,7 +1050,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1060,7 +1060,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1069,7 +1069,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1129,7 +1129,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1149,7 +1149,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 		rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n",
-				strerror(-rc));
+				rte_strerror(-rc));
 			return rc;
 		}
 
@@ -1180,7 +1180,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1189,7 +1189,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1231,7 +1231,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1240,7 +1240,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1284,7 +1284,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1293,7 +1293,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1334,7 +1334,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1345,7 +1345,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1401,7 +1401,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1411,7 +1411,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1465,7 +1465,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1475,7 +1475,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1534,7 +1534,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1544,7 +1544,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1585,7 +1585,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1594,7 +1594,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1664,7 +1664,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1673,7 +1673,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1705,7 +1705,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    parms->key_size,
 			    resp.key_size,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_size = resp.key_size;
@@ -1734,7 +1734,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1743,7 +1743,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(in_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1793,7 +1793,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1803,7 +1803,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1812,7 +1812,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1877,7 +1877,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1887,7 +1887,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1896,7 +1896,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -1964,7 +1964,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1974,7 +1974,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1983,7 +1983,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2043,7 +2043,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2053,7 +2053,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2062,7 +2062,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2082,7 +2082,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2140,7 +2140,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2150,7 +2150,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2159,7 +2159,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -2217,7 +2217,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2227,7 +2227,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2278,7 +2278,7 @@ tf_msg_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2366,7 +2366,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2375,7 +2375,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2383,7 +2383,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2421,7 +2421,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2430,7 +2430,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2438,7 +2438,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c
index 9b85f5397d..05d05befaa 100644
--- a/drivers/net/bnxt/tf_core/tf_rm.c
+++ b/drivers/net/bnxt/tf_core/tf_rm.c
@@ -1059,7 +1059,7 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db,
 			    "%s: Invalid pool for this type:%d, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
 			    tmp_subtype,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	*new_subtype = tmp_subtype;
@@ -1106,7 +1106,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Allocation failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc adjust of base index failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
index 253d716572..a1f9848aed 100644
--- a/drivers/net/bnxt/tf_core/tf_session.c
+++ b/drivers/net/bnxt/tf_core/tf_session.c
@@ -78,11 +78,11 @@ tf_session_create(struct tf *tfp,
 		if (rc == -EEXIST)
 			TFP_DRV_LOG(ERR,
 				    "Session is already open, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		else
 			TFP_DRV_LOG(ERR,
 				    "Open message send failed, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 		parms->open_cfg->session_id.id = TF_FW_SESSION_ID_INVALID;
 		return rc;
@@ -97,7 +97,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session info, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session = (struct tf_session_info *)cparms.mem_va;
@@ -111,7 +111,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session->core_data = cparms.mem_va;
@@ -154,7 +154,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -226,7 +226,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	if (tfp->session) {
 		tfp_free(tfp->session->core_data);
@@ -268,7 +268,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -289,7 +289,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to create client on session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -303,7 +303,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -320,7 +320,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session Firmware id lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -373,7 +373,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -405,7 +405,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Client destroy on FW Failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	ll_delete(&tfs->client_ll, &client->ll_entry);
@@ -435,7 +435,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to create session, ctrl_chan_name:%s, rc:%s\n",
 				    parms->open_cfg->ctrl_chan_name,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -457,7 +457,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 			      "Failed to create client on session 0x%x, rc:%s\n",
 			      parms->open_cfg->session_id.id,
-			      strerror(-rc));
+			      rte_strerror(-rc));
 			return rc;
 		}
 
@@ -480,7 +480,7 @@ tf_session_attach_session(struct tf *tfp __rte_unused,
 
 	TFP_DRV_LOG(ERR,
 		    "Attach not yet supported, rc:%s\n",
-		    strerror(-rc));
+		    rte_strerror(-rc));
 	return rc;
 }
 
@@ -503,7 +503,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -511,7 +511,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid session id, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -531,7 +531,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Client not part of the session, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_session_close_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to unregister Client %d, rc:%s\n",
 				    client->session_client_id.id,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -576,7 +576,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Device lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -586,7 +586,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -596,7 +596,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Device unbind failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	rc = tf_msg_session_close(tfp, fw_session_id, mailbox);
@@ -604,7 +604,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	/* Final cleanup as we're last user of the session thus we
@@ -658,7 +658,7 @@ tf_session_get_session_internal(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -689,7 +689,7 @@ tf_session_get_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Internal FID lookup\n, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_session_get_session(struct tf *tfp,
 		TFP_DRV_LOG
 			(ERR,
 			"Ctrl channel not registered with session\n, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -810,7 +810,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -818,7 +818,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -842,7 +842,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -850,7 +850,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1152,7 +1152,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1160,7 +1160,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to set state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1169,7 +1169,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Set session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
@@ -1186,7 +1186,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1194,7 +1194,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to get state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1203,7 +1203,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Get session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_sram_mgr.c b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
index 87e8882fed..afbc3a3e46 100644
--- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c
+++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
@@ -494,7 +494,7 @@ static struct tf_sram_block
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate block, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return NULL;
 	}
 	block = (struct tf_sram_block *)cparms.mem_va;
@@ -588,7 +588,7 @@ tf_sram_mgr_bind(void **sram_handle)
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate SRAM mgmt data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	sram = (struct tf_sram *)cparms.mem_va;
@@ -628,7 +628,7 @@ tf_sram_mgr_unbind(void *sram_handle)
 					/* Log error */
 					TFP_DRV_LOG(ERR,
 						  "No SRAM slice list, rc:%s\n",
-						  strerror(-rc));
+						  rte_strerror(-rc));
 					return rc;
 				}
 				if (tf_sram_get_block_cnt(slice_list))
@@ -670,7 +670,7 @@ int tf_sram_mgr_alloc(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -759,7 +759,7 @@ tf_sram_mgr_free(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -781,7 +781,7 @@ tf_sram_mgr_free(void *sram_handle,
 	rc = tf_sram_free_slice(parms->slice_size, slice_offset,
 				block, &block_is_empty);
 	if (rc) {
-		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", strerror(-rc));
+		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", rte_strerror(-rc));
 		return rc;
 	}
 #if (STATS_CLEAR_ON_READ_SUPPORT == 0)
@@ -805,7 +805,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -821,7 +821,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -836,14 +836,14 @@ tf_sram_mgr_free(void *sram_handle,
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n",
-				    block_id, strerror(-rc));
+				    block_id, rte_strerror(-rc));
 		}
 		fparms.index = block_id + 1;
 		rc = tf_rm_free(&fparms);
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free next block_id(%d) failed error(%s)\n",
-				    block_id + 1, strerror(-rc));
+				    block_id + 1, rte_strerror(-rc));
 		}
 		/* Free local entry regardless */
 		tf_sram_free_block(slice_list, block);
@@ -937,7 +937,7 @@ int tf_sram_mgr_is_allocated(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
index f5f3889934..0fbcba6c76 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl.c
@@ -45,7 +45,7 @@ tf_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -195,7 +195,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -234,7 +234,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -250,7 +250,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -302,7 +302,7 @@ tf_tbl_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -341,7 +341,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -356,7 +356,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -393,7 +393,7 @@ tf_tbl_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -432,7 +432,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -449,7 +449,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -485,7 +485,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -517,7 +517,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_tbl_sram.c b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
index 3a6f1c68c7..39dbe11610 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
@@ -114,7 +114,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get hcapi_type %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->bank_id = tf_tbl_sram_hcapi_2_bank[hcapi_type];
@@ -129,7 +129,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get slice cnt %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (slices)
@@ -168,7 +168,7 @@ tf_tbl_sram_unbind(struct tf *tfp __rte_unused)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (sram_handle)
@@ -204,7 +204,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -214,7 +214,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -290,7 +290,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -299,7 +299,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -345,7 +345,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -417,7 +417,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -426,7 +426,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -489,7 +489,7 @@ tf_tbl_sram_set(struct tf *tfp,
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
 				    parms->idx,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			rc = -ENOMEM;
 			return rc;
 		}
@@ -504,7 +504,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -519,7 +519,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -553,7 +553,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -562,7 +562,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -592,7 +592,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -607,7 +607,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (parms->type == TF_TBL_TYPE_ACT_STATS_64)
@@ -626,7 +626,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -661,7 +661,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -670,7 +670,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -703,7 +703,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->starting_idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -716,7 +716,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -730,7 +730,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -751,7 +751,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	return rc;
 }
diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c
index 9e0671d47b..5924c5e6c1 100644
--- a/drivers/net/bnxt/tf_core/tf_tcam.c
+++ b/drivers/net/bnxt/tf_core/tf_tcam.c
@@ -57,7 +57,7 @@ tf_tcam_bind(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -91,7 +91,7 @@ tf_tcam_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tcam_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -301,7 +301,7 @@ tf_tcam_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -320,7 +320,7 @@ tf_tcam_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tcam_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -385,7 +385,7 @@ tf_tcam_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -417,7 +417,7 @@ tf_tcam_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -477,7 +477,7 @@ tf_tcam_free(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -515,7 +515,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -579,7 +579,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return 0;
@@ -618,7 +618,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -662,7 +662,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 23/43] net/af_xdp: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (21 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 22/43] net/bnxt: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 24/43] net/bonding: " Dengdui Huang
                   ` (20 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 353c8688ec..087b6e33db 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1165,7 +1165,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
 				&rxq->fq, &rxq->cq, &usr_config);
 		if (ret) {
 			AF_XDP_LOG(ERR, "Failed to create umem [%d]: [%s]\n",
-				   errno, strerror(errno));
+				   errno, rte_strerror(errno));
 			goto err;
 		}
 		umem->buffer = base_addr;
@@ -1367,7 +1367,7 @@ init_uds_sock(struct sockaddr_un *server)
 	if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) < 0) {
 		close(sock);
 		AF_XDP_LOG(ERR, "Error connecting stream socket errno = [%d]: [%s]\n",
-			   errno, strerror(errno));
+			   errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1451,7 +1451,7 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd)
 		return 0;
 
 	if (msglen < 0) {
-		AF_XDP_LOG(ERR, "recvmsg failed, %s\n", strerror(errno));
+		AF_XDP_LOG(ERR, "recvmsg failed, %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -1486,7 +1486,7 @@ make_request_cni(int sock, struct sockaddr_un *server, char *request,
 		rval = send_msg(sock, request, req_fd);
 
 	if (rval < 0) {
-		AF_XDP_LOG(ERR, "Write error %s\n", strerror(errno));
+		AF_XDP_LOG(ERR, "Write error %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -1970,7 +1970,7 @@ parse_prog_arg(const char *key __rte_unused,
 
 	if (access(value, F_OK) != 0) {
 		AF_XDP_LOG(ERR, "Error accessing %s: %s\n",
-			   value, strerror(errno));
+			   value, rte_strerror(errno));
 		return -EINVAL;
 	}
 
@@ -2421,7 +2421,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(ETH_AF_XDP_MP_KEY, afxdp_mp_send_fds);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			AF_XDP_LOG(ERR, "%s: Failed to register multi-process IPC callback: %s\n",
-				   name, strerror(rte_errno));
+				   name, rte_strerror(rte_errno));
 			return -1;
 		}
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 24/43] net/bonding: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (22 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 23/43] net/af_xdp: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 25/43] net/dpaa: " Dengdui Huang
                   ` (19 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/bonding/bonding_testpmd.c   | 4 ++--
 drivers/net/bonding/rte_eth_bond_api.c  | 2 +-
 drivers/net/bonding/rte_eth_bond_flow.c | 4 ++--
 drivers/net/bonding/rte_eth_bond_pmd.c  | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..111f9de0e7 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -551,7 +551,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mac_addr_set =
@@ -604,7 +604,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 99e496556a..1d20d421bc 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -483,7 +483,7 @@ __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s\n",
-			__func__, member_port_id, strerror(-ret));
+			__func__, member_port_id, rte_strerror(-ret));
 
 		return ret;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 71a91675f7..b7e966f393 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -31,7 +31,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -45,7 +45,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c40d18d128..fdf152a51a 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -192,7 +192,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s\n",
-			__func__, member_port, strerror(-ret));
+			__func__, member_port, rte_strerror(-ret));
 
 		return ret;
 	}
@@ -223,7 +223,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
 			RTE_BOND_LOG(ERR,
 				"%s: Error during getting device (port %u) info: %s\n",
 				__func__, bond_dev->data->port_id,
-				strerror(-ret));
+				rte_strerror(-ret));
 
 			return ret;
 		}
@@ -2292,7 +2292,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 					"%s: Error during getting device (port %u) info: %s\n",
 					__func__,
 					member.port_id,
-					strerror(-ret));
+					rte_strerror(-ret));
 
 				return ret;
 			}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 25/43] net/dpaa: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (23 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 24/43] net/bonding: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 26/43] net/dpaa2: " Dengdui Huang
                   ` (18 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/dpaa/dpaa_ethdev.c  | 4 ++--
 drivers/net/dpaa/fmlib/fm_lib.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index ef4c06db6a..214627986f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1080,7 +1080,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		ret = qman_init_fq(rxq, flags, &opts);
 		if (ret) {
 			DPAA_PMD_ERR("Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 			return ret;
 		}
 		if (dpaa_svr_family == SVR_LS1043A_FAMILY) {
@@ -1210,7 +1210,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev,
 	ret = qman_init_fq(rxq, flags, &opts);
 	if (ret) {
 		DPAA_PMD_ERR("Ev-Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 		return ret;
 	}
 
diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c
index 1d6816050c..d4382d7065 100644
--- a/drivers/net/dpaa/fmlib/fm_lib.c
+++ b/drivers/net/dpaa/fmlib/fm_lib.c
@@ -103,7 +103,7 @@ fm_get_api_version(t_handle h_fm, ioc_fm_api_version_t *p_version)
 	ret = ioctl(p_dev->fd, FM_IOC_GET_API_VERSION, p_version);
 	if (ret) {
 		DPAA_PMD_ERR("cannot get API version, error %i (%s)\n",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 	_fml_dbg("Finishing.\n");
@@ -276,7 +276,7 @@ fm_pcd_kg_scheme_set(t_handle h_fm_pcd,
 	ret = ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_SET, params);
 	if (ret) {
 		DPAA_PMD_ERR("  cannot set kg scheme, error %i (%s)\n",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return NULL;
 	}
 
@@ -310,7 +310,7 @@ fm_pcd_kg_scheme_delete(t_handle h_scheme)
 
 	if (ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_DELETE, &id)) {
 		DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)\n",
-			      errno, strerror(errno));
+			      errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 26/43] net/dpaa2: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (24 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 25/43] net/dpaa: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 27/43] net/enetfec: " Dengdui Huang
                   ` (17 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8e610b6bba..48f1a2fafb 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1166,7 +1166,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				irq_index, mask);
 	if (err < 0) {
 		DPAA2_PMD_ERR("Error: dpni_set_irq_mask():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 		return err;
 	}
 
@@ -1174,7 +1174,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				  irq_index, enable);
 	if (err < 0)
 		DPAA2_PMD_ERR("Error: dpni_set_irq_enable():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 
 	return err;
 }
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 27/43] net/enetfec: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (25 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 26/43] net/dpaa2: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 28/43] net/failsafe: " Dengdui Huang
                   ` (16 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/enetfec/enet_uio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/enetfec/enet_uio.c b/drivers/net/enetfec/enet_uio.c
index 6539cbb354..93520e9760 100644
--- a/drivers/net/enetfec/enet_uio.c
+++ b/drivers/net/enetfec/enet_uio.c
@@ -231,7 +231,7 @@ enetfec_configure(void)
 	d = opendir(FEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		ENETFEC_PMD_ERR("\nError opening directory '%s': %s\n",
-			FEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			FEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 28/43] net/failsafe: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (26 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 27/43] net/enetfec: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 29/43] net/i40e: " Dengdui Huang
                   ` (15 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/failsafe/failsafe.c         | 8 ++++----
 drivers/net/failsafe/failsafe_args.c    | 4 ++--
 drivers/net/failsafe/failsafe_eal.c     | 4 ++--
 drivers/net/failsafe/failsafe_flow.c    | 4 ++--
 drivers/net/failsafe/failsafe_ops.c     | 2 +-
 drivers/net/failsafe/failsafe_private.h | 6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 32811403b4..f89c946ce4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -92,7 +92,7 @@ failsafe_hotplug_alarm_cancel(struct rte_eth_dev *dev)
 	rte_eal_alarm_cancel(fs_hotplug_alarm, dev);
 	if (rte_errno) {
 		ERROR("rte_eal_alarm_cancel failed (errno: %s)",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		ret = -rte_errno;
 	} else {
 		PRIV(dev)->pending_alarm = 0;
@@ -138,18 +138,18 @@ fs_mutex_init(struct fs_priv *priv)
 
 	ret = pthread_mutexattr_init(&attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex attributes - %s", strerror(ret));
+		ERROR("Cannot initiate mutex attributes - %s", rte_strerror(ret));
 		return ret;
 	}
 	/* Allow mutex relocks for the thread holding the mutex. */
 	ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 	if (ret) {
-		ERROR("Cannot set mutex type - %s", strerror(ret));
+		ERROR("Cannot set mutex type - %s", rte_strerror(ret));
 		return ret;
 	}
 	ret = pthread_mutex_init(&priv->hotplug_mutex, &attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex - %s", strerror(ret));
+		ERROR("Cannot initiate mutex - %s", rte_strerror(ret));
 		return ret;
 	}
 	return 0;
diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c
index b203e02d9a..77169b7bbe 100644
--- a/drivers/net/failsafe/failsafe_args.c
+++ b/drivers/net/failsafe/failsafe_args.c
@@ -112,7 +112,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 	fp = popen(sdev->cmdline, "r");
 	if (fp == NULL) {
 		ret = -errno;
-		ERROR("popen: %s", strerror(errno));
+		ERROR("popen: %s", rte_strerror(errno));
 		return ret;
 	}
 	/* We only read one line */
@@ -131,7 +131,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 		ERROR("Parsing device '%s' failed", output);
 ret_pclose:
 	if (pclose(fp) == -1)
-		ERROR("pclose: %s", strerror(errno));
+		ERROR("pclose: %s", rte_strerror(errno));
 	return ret;
 }
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index d71b512f81..b06579692a 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -52,7 +52,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			if (ret < 0) {
 				ERROR("sub_device %d probe failed %s%s%s", i,
 				      rte_errno ? "(" : "",
-				      rte_errno ? strerror(rte_errno) : "",
+				      rte_errno ? rte_strerror(rte_errno) : "",
 				      rte_errno ? ")" : "");
 				continue;
 			}
@@ -100,7 +100,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner);
 			if (ret < 0) {
 				INFO("sub_device %d owner set failed (%s), "
-				     "will try again later", i, strerror(-ret));
+				     "will try again later", i, rte_strerror(-ret));
 				continue;
 			} else if (strncmp(rte_eth_devices[pid].device->name,
 				   da->name, strlen(da->name)) != 0) {
diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c
index 707e6c63b5..5d17182cc5 100644
--- a/drivers/net/failsafe/failsafe_flow.c
+++ b/drivers/net/failsafe/failsafe_flow.c
@@ -33,7 +33,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Unable to process flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -47,7 +47,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Failed to copy flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 35649b6244..40bea1d6bf 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -452,7 +452,7 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,
 #ifdef RTE_EXEC_ENV_LINUX
 	rxq->event_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (rxq->event_fd < 0) {
-		ERROR("Failed to create an eventfd: %s", strerror(errno));
+		ERROR("Failed to create an eventfd: %s", rte_strerror(errno));
 		fs_unlock(dev, 0);
 		return -errno;
 	}
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 53a451c1b1..5961222400 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -410,14 +410,14 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm)
 		ret = pthread_mutex_trylock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
 			DEBUG("Hot-plug mutex lock trying failed(%s), will try"
-			      " again later...", strerror(ret));
+			      " again later...", rte_strerror(ret));
 			return ret;
 		}
 		PRIV(dev)->alarm_lock = 1;
 	} else {
 		ret = pthread_mutex_lock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
-			ERROR("Cannot lock mutex(%s)", strerror(ret));
+			ERROR("Cannot lock mutex(%s)", rte_strerror(ret));
 			return ret;
 		}
 	}
@@ -439,7 +439,7 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm)
 	}
 	ret = pthread_mutex_unlock(&PRIV(dev)->hotplug_mutex);
 	if (ret)
-		ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret));
+		ERROR("Cannot unlock hot-plug mutex(%s)", rte_strerror(ret));
 }
 
 /*
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 29/43] net/i40e: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (27 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 28/43] net/failsafe: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 30/43] net/ice: " Dengdui Huang
                   ` (14 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/i40e/i40e_testpmd.c | 42 ++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index b6ef5d6e42..d0995531bc 100644
--- a/drivers/net/i40e/i40e_testpmd.c
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -53,7 +53,7 @@ cmd_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -148,7 +148,7 @@ cmd_region_flowtype_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "region flowtype config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -233,7 +233,7 @@ cmd_user_priority_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "user_priority region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -320,7 +320,7 @@ cmd_flush_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config flush error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -433,7 +433,7 @@ cmd_show_queue_region_info_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config info show error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -536,7 +536,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 							add);
 	if (ret < 0)
 		fprintf(stderr, "flow director config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	close_file(conf.input.packet);
 }
 
@@ -666,7 +666,7 @@ cmd_set_vf_promisc_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -745,7 +745,7 @@ cmd_set_vf_allmulti_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -825,7 +825,7 @@ cmd_set_vf_broadcast_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -908,7 +908,7 @@ cmd_set_vf_vlan_tag_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1013,7 +1013,7 @@ cmd_vf_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1108,7 +1108,7 @@ cmd_vf_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1158,7 +1158,7 @@ cmd_vf_tc_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1207,7 +1207,7 @@ cmd_strict_link_prio_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1928,7 +1928,7 @@ cmd_pctype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2000,7 +2000,7 @@ cmd_pctype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		return;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 		return;
 	}
 
@@ -2111,7 +2111,7 @@ cmd_pctype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2191,7 +2191,7 @@ cmd_ptype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 
 	if (!ret) {
@@ -2280,7 +2280,7 @@ cmd_ptype_mapping_replace_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2347,7 +2347,7 @@ cmd_ptype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2427,7 +2427,7 @@ cmd_ptype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 30/43] net/ice: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (28 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 29/43] net/i40e: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 31/43] net/ixgbe: " Dengdui Huang
                   ` (13 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/ice/ice_testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_testpmd.c b/drivers/net/ice/ice_testpmd.c
index a7a8d0c53c..e1392059e0 100644
--- a/drivers/net/ice/ice_testpmd.c
+++ b/drivers/net/ice/ice_testpmd.c
@@ -60,7 +60,7 @@ cmd_ddp_dump_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
@@ -127,7 +127,7 @@ cmd_ddp_dump_switch_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP switch runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 31/43] net/ixgbe: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (29 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 30/43] net/ice: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 32/43] net/memif: " Dengdui Huang
                   ` (12 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/ixgbe/ixgbe_testpmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_testpmd.c b/drivers/net/ixgbe/ixgbe_testpmd.c
index e0d161eafe..3c6d648844 100644
--- a/drivers/net/ixgbe/ixgbe_testpmd.c
+++ b/drivers/net/ixgbe/ixgbe_testpmd.c
@@ -141,7 +141,7 @@ cmd_set_vf_split_drop_en_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -243,7 +243,7 @@ cmd_set_macsec_offload_on_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -327,7 +327,7 @@ cmd_set_macsec_offload_off_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -402,7 +402,7 @@ cmd_set_macsec_sc_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -510,7 +510,7 @@ cmd_set_macsec_sa_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -599,7 +599,7 @@ cmd_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 32/43] net/memif: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (30 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 31/43] net/ixgbe: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 33/43] net/mlx4: " Dengdui Huang
                   ` (11 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/memif/memif_socket.c  |  4 ++--
 drivers/net/memif/rte_eth_memif.c | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 649f8d0e61..592b71979a 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -71,7 +71,7 @@ memif_msg_send_from_queue(struct memif_control_channel *cc)
 	size = memif_msg_send(rte_intr_fd_get(cc->intr_handle), &e->msg,
 			      e->fd);
 	if (size != sizeof(memif_msg_t)) {
-		MIF_LOG(ERR, "sendmsg fail: %s.", strerror(errno));
+		MIF_LOG(ERR, "sendmsg fail: %s.", rte_strerror(errno));
 		ret = -1;
 	} else {
 		MIF_LOG(DEBUG, "Sent msg type %u.", e->msg.type);
@@ -975,7 +975,7 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract, uid_t owner_u
 	return sock;
 
  error:
-	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, strerror(errno));
+	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, rte_strerror(errno));
 	if (sock != NULL) {
 		rte_intr_instance_free(sock->intr_handle);
 		rte_free(sock);
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 7cc8c0da91..f7697394f1 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -805,7 +805,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			     sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -960,7 +960,7 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 				     &a, sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -1082,27 +1082,27 @@ memif_region_init_shm(struct rte_eth_dev *dev, uint8_t has_buffers)
 
 	r->fd = memfd_create(shm_name, MFD_ALLOW_SEALING);
 	if (r->fd < 0) {
-		MIF_LOG(ERR, "Failed to create shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to create shm file: %s.", rte_strerror(errno));
 		ret = -1;
 		goto error;
 	}
 
 	ret = fcntl(r->fd, F_ADD_SEALS, F_SEAL_SHRINK);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	ret = ftruncate(r->fd, r->region_size);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to truncate shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to truncate shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	r->addr = mmap(NULL, r->region_size, PROT_READ |
 		       PROT_WRITE, MAP_SHARED, r->fd, 0);
 	if (r->addr == MAP_FAILED) {
-		MIF_LOG(ERR, "Failed to mmap shm region: %s.", strerror(ret));
+		MIF_LOG(ERR, "Failed to mmap shm region: %s.", rte_strerror(ret));
 		ret = -1;
 		goto error;
 	}
@@ -1223,7 +1223,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for tx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1247,7 +1247,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for rx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1299,7 +1299,7 @@ memif_connect(struct rte_eth_dev *dev)
 						MAP_SHARED, mr->fd, 0);
 				if (mr->addr == MAP_FAILED) {
 					MIF_LOG(ERR, "mmap failed: %s\n",
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			}
@@ -1983,7 +1983,7 @@ rte_pmd_memif_probe(struct rte_vdev_device *vdev)
 	 */
 	if (ret < 0 && rte_errno != EEXIST)
 		MIF_LOG(WARNING, "Failed to register mp action callback: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 
 	/* use abstract address by default */
 	flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 33/43] net/mlx4: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (31 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 32/43] net/memif: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 34/43] net/mlx5: " Dengdui Huang
                   ` (10 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/mlx4/mlx4.c        | 14 +++++++-------
 drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++---------
 drivers/net/mlx4/mlx4_rxq.c    | 10 +++++-----
 drivers/net/mlx4/mlx4_txq.c    | 10 +++++-----
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index a1a7e93288..f06a6fee6e 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -255,7 +255,7 @@ mlx4_dev_configure(struct rte_eth_dev *dev)
 	if (ret) {
 		ERROR("cannot set up internal flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto exit;
 	}
@@ -302,7 +302,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 	ret = mlx4_rss_init(priv);
 	if (ret) {
 		ERROR("%p: cannot initialize RSS resources: %s",
-		      (void *)dev, strerror(-ret));
+		      (void *)dev, rte_strerror(-ret));
 		goto err;
 	}
 #ifdef RTE_LIBRTE_MLX4_DEBUG
@@ -319,7 +319,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 		ERROR("%p: cannot attach flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
 		      (void *)dev,
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto err;
 	}
@@ -793,7 +793,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	err = mlx4_init_once();
 	if (err) {
 		ERROR("unable to init PMD global data: %s",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	MLX4_ASSERT(pci_drv == &mlx4_driver);
@@ -946,7 +946,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_glue->query_port(ctx, port, &port_attr);
 		if (err) {
 			err = ENODEV;
-			ERROR("port query failed: %s", strerror(err));
+			ERROR("port query failed: %s", rte_strerror(err));
 			goto port_error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -963,7 +963,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_fd_set_non_blocking(ctx->async_fd);
 		if (err) {
 			ERROR("cannot make asynchronous FD non-blocking: %s",
-			      strerror(err));
+			      rte_strerror(err));
 			goto port_error;
 		}
 		/* Allocate protection domain. */
@@ -1024,7 +1024,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_get_mac(priv, &mac.addr_bytes);
 		if (err) {
 			ERROR("cannot get MAC address, is mlx4_en loaded?"
-			      " (error: %s)", strerror(err));
+			      " (error: %s)", rte_strerror(err));
 			goto port_error;
 		}
 		INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index bb1dd33e7c..a1cd345aae 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -373,7 +373,7 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 
 	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      mode, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -462,7 +462,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 	ERROR("failed to synchronize flow rules after removing MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 }
 
@@ -501,7 +501,7 @@ mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	ERROR("failed to synchronize flow rules after adding MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -558,7 +558,7 @@ mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list,
 		return 0;
 	ERROR("failed to synchronize flow rules after modifying MC list,"
 	      " (code %d, \"%s\"), flow error type %d, cause %p, message: %s",
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -600,7 +600,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	      " (code %d, \"%s\"), "
 	      " flow error type %d, cause %p, message: %s",
 	      on ? "enabling" : "disabling", vlan_id,
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -807,7 +807,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	}
 	(void)wait_to_complete;
 	if (mlx4_ifreq(priv, SIOCGIFFLAGS, &ifr)) {
-		WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno));
+		WARN("ioctl(SIOCGIFFLAGS) failed: %s", rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	memset(&dev_link, 0, sizeof(dev_link));
@@ -816,7 +816,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	ifr.ifr_data = (void *)&edata;
 	if (mlx4_ifreq(priv, SIOCETHTOOL, &ifr)) {
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	link_speed = ethtool_cmd_speed(&edata);
@@ -858,7 +858,7 @@ mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -913,7 +913,7 @@ mlx4_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	ret = 0;
diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c
index 781ee256df..d0ec84201e 100644
--- a/drivers/net/mlx4/mlx4_rxq.c
+++ b/drivers/net/mlx4/mlx4_rxq.c
@@ -353,7 +353,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	if (ret) {
 		ERROR("cannot set up range size for RSS context to %u"
 		      " (for %u Rx queues), error: %s",
-		      1 << log2_range, dev->data->nb_rx_queues, strerror(ret));
+		      1 << log2_range, dev->data->nb_rx_queues, rte_strerror(ret));
 		rte_errno = ret;
 		return -ret;
 	}
@@ -431,7 +431,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	return 0;
 error:
 	ERROR("cannot initialize common RSS resources (queue %u): %s: %s",
-	      i, msg, strerror(ret));
+	      i, msg, rte_strerror(ret));
 	while (i--) {
 		struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i];
 
@@ -631,7 +631,7 @@ mlx4_rxq_attach(struct rxq *rxq)
 	--rxq->usecnt;
 	rte_errno = ret;
 	ERROR("error while attaching Rx queue %p: %s: %s",
-	      (void *)rxq, msg, strerror(ret));
+	      (void *)rxq, msg, rte_strerror(ret));
 	priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE;
 	return -ret;
 }
@@ -882,13 +882,13 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 			rte_errno = ENOMEM;
 			ERROR("%p: Rx interrupt completion channel creation"
 			      " failure: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 		if (mlx4_fd_set_non_blocking(rxq->channel->fd) < 0) {
 			ERROR("%p: unable to make Rx interrupt completion"
 			      " channel non-blocking: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 	}
diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c
index 0db2e55bef..f08c152d5e 100644
--- a/drivers/net/mlx4/mlx4_txq.c
+++ b/drivers/net/mlx4/mlx4_txq.c
@@ -411,7 +411,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->cq) {
 		rte_errno = ENOMEM;
 		ERROR("%p: CQ creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	qp_init_attr = (struct ibv_qp_init_attr){
@@ -431,7 +431,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->qp) {
 		rte_errno = errno ? errno : EINVAL;
 		ERROR("%p: QP creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	txq->max_inline = qp_init_attr.cap.max_inline_data;
@@ -445,7 +445,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_INIT failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -457,7 +457,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTR failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -469,7 +469,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTS failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Retrieve device queue information. */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 34/43] net/mlx5: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (32 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 33/43] net/mlx4: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 35/43] net/qede: " Dengdui Huang
                   ` (9 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c     |  2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c   | 20 ++++++++++----------
 drivers/net/mlx5/linux/mlx5_os.c          | 18 +++++++++---------
 drivers/net/mlx5/linux/mlx5_socket.c      | 16 ++++++++--------
 drivers/net/mlx5/linux/mlx5_verbs.c       |  8 ++++----
 drivers/net/mlx5/mlx5.c                   |  8 ++++----
 drivers/net/mlx5/mlx5_devx.c              |  4 ++--
 drivers/net/mlx5/mlx5_mac.c               |  2 +-
 drivers/net/mlx5/mlx5_rxmode.c            |  8 ++++----
 drivers/net/mlx5/mlx5_rxq.c               |  4 ++--
 drivers/net/mlx5/mlx5_rxtx.c              |  2 +-
 drivers/net/mlx5/mlx5_stats.c             |  4 ++--
 drivers/net/mlx5/mlx5_testpmd.c           | 14 +++++++-------
 drivers/net/mlx5/mlx5_trigger.c           | 12 ++++++------
 drivers/net/mlx5/mlx5_vlan.c              |  2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c |  2 +-
 drivers/net/mlx5/windows/mlx5_os.c        | 12 ++++++------
 17 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 4ea161eae6..e5247c1295 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -1421,7 +1421,7 @@ mlx5dr_match_template_create(const struct rte_flow_item items[],
 	if (ret <= 0) {
 		DR_LOG(ERR, "Unable to process items (%s): %s",
 		       error.message ? error.message : "unspecified",
-		       strerror(rte_errno));
+		       rte_strerror(rte_errno));
 		goto free_template;
 	}
 
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index dd5a0c546d..f2364ff44e 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -398,7 +398,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -435,7 +435,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 			DRV_LOG(WARNING,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GSET) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -490,7 +490,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -525,7 +525,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 			DRV_LOG(DEBUG,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GLINKSETTINGS) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -543,7 +543,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 		DRV_LOG(DEBUG,
 			"port %u ioctl(SIOCETHTOOL,"
 			"ETHTOOL_GLINKSETTINGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link.link_speed = (ecmd->speed == UINT32_MAX) ?
@@ -674,7 +674,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(WARNING,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:"
 			" %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -727,7 +727,7 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(WARNING,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 			" failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	return 0;
@@ -1209,7 +1209,7 @@ mlx5_get_module_info(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	modinfo->type = info.type;
@@ -1258,7 +1258,7 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret)
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	else
 		rte_memcpy(info->data, eeprom->data, info->length);
 	mlx5_free(eeprom);
@@ -1662,7 +1662,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, xstats_ctrl->base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	stats_ctrl->imissed = 0;
 free:
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 07f31de5ae..108de96cf7 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1176,7 +1176,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		err = mlx5_glue->query_port(sh->cdev->ctx, spawn->phys_port,
 					    &port_attr);
 		if (err) {
-			DRV_LOG(ERR, "port query failed: %s", strerror(err));
+			DRV_LOG(ERR, "port query failed: %s", rte_strerror(err));
 			goto error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -1191,7 +1191,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			spawn->phys_port);
 		if (err < 0) {
 			DRV_LOG(INFO, "Failed to get netlink port state: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			err = -rte_errno;
 			goto error;
 		}
@@ -1342,7 +1342,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -1433,7 +1433,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -1479,7 +1479,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -1973,7 +1973,7 @@ mlx5_device_bond_pci_match(const char *ibdev_name,
 					   bond_info->ifname);
 		if (ret)
 			DRV_LOG(ERR, "unable to get bond info: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 		else
 			DRV_LOG(INFO, "PF device %u, bond device %u(%s)",
 				ifindex, bond_info->ifindex, bond_info->ifname);
@@ -2688,7 +2688,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,
 			" encountering an error: %s",
 			owner_pci.domain, owner_pci.bus,
 			owner_pci.devid, owner_pci.function,
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		ret = -rte_errno;
 		/* Roll back. */
 		while (i--) {
@@ -2868,13 +2868,13 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "Unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	ret = mlx5_probe_again_args_validate(cdev, mkvlist);
 	if (ret) {
 		DRV_LOG(ERR, "Probe again parameters are not compatible : %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	if (mlx5_dev_is_pci(cdev->dev))
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 6ce0e59643..cfcbd5a099 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -61,13 +61,13 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	/* Accept the connection from the client. */
 	conn_sock = accept(server_socket, NULL, NULL);
 	if (conn_sock < 0) {
-		DRV_LOG(WARNING, "connection failed: %s", strerror(errno));
+		DRV_LOG(WARNING, "connection failed: %s", rte_strerror(errno));
 		return;
 	}
 	ret = recvmsg(conn_sock, &msg, MSG_WAITALL);
 	if (ret != sizeof(struct mlx5_flow_dump_req)) {
 		DRV_LOG(WARNING, "wrong message received: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 
@@ -138,7 +138,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0)
 		DRV_LOG(WARNING, "failed to send response %s",
-			strerror(errno));
+			rte_strerror(errno));
 error:
 	if (conn_sock >= 0)
 		close(conn_sock);
@@ -167,7 +167,7 @@ mlx5_pmd_socket_init(void)
 	ret = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "Failed to open mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	server_socket = ret;
@@ -183,13 +183,13 @@ mlx5_pmd_socket_init(void)
 	ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun));
 	if (ret < 0) {
 		DRV_LOG(WARNING,
-			"cannot bind mlx5 socket: %s", strerror(errno));
+			"cannot bind mlx5 socket: %s", rte_strerror(errno));
 		goto remove;
 	}
 	ret = listen(server_socket, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "cannot listen on mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	server_intr_handle = mlx5_os_interrupt_handler_create
@@ -197,7 +197,7 @@ mlx5_pmd_socket_init(void)
 		 server_socket, mlx5_pmd_socket_handle, NULL);
 	if (server_intr_handle == NULL) {
 		DRV_LOG(WARNING, "cannot register interrupt handler for mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	return 0;
@@ -207,7 +207,7 @@ mlx5_pmd_socket_init(void)
 	claim_zero(close(server_socket));
 	server_socket = -1;
 error:
-	DRV_LOG(ERR, "Cannot initialize socket: %s", strerror(errno));
+	DRV_LOG(ERR, "Cannot initialize socket: %s", rte_strerror(errno));
 	return -errno;
 }
 
diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index b54f3ccd9a..9d41f6fbdf 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -100,7 +100,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Tx QP state to RESET %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -111,7 +111,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE | IBV_QP_PORT);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -119,7 +119,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -127,7 +127,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 2cf21a1921..7f95c0db85 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1504,7 +1504,7 @@ mlx5_shared_dev_ctx_args_config(struct mlx5_dev_ctx_shared *sh,
 					  mlx5_dev_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process device arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -1756,7 +1756,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
 	err = mlx5_shared_dev_ctx_args_config(sh, mkvlist, &sh->config);
 	if (err) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	sh->refcnt = 1;
@@ -2716,7 +2716,7 @@ mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist,
 					  mlx5_port_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process port arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -2947,7 +2947,7 @@ mlx5_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_shared_dev_ctx_args_config(sh, mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 9fa400fc48..95bed87103 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -134,7 +134,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to RESET"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -146,7 +146,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to READY"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 22a756a52b..f73b7bc394 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -100,7 +100,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 		ret = mlx5_traffic_restart(dev);
 		if (ret)
 			DRV_LOG(ERR, "port %u cannot restart traffic: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 	}
 }
 
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index f44906e1a7..fae684defb 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -44,7 +44,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_enable() rollback
@@ -77,7 +77,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_disable() rollback
@@ -117,7 +117,7 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_enable() rollback
@@ -150,7 +150,7 @@ mlx5_allmulticast_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_disable() rollback
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 88b2dc54b3..341714965b 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -488,7 +488,7 @@ mlx5_rx_queue_stop_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RDY2RST);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to RESET:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -587,7 +587,7 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RST2RDY);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to READY:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 54d410b513..59e49aa5af 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -378,7 +378,7 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
 		ret = priv->obj_ops.rxq_obj_modify(rxq, sm->state);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Rx WQ state to %u  - %s",
-					sm->state, strerror(errno));
+					sm->state, rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 615e1d073d..d2a8b8e852 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -233,7 +233,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	stats_n = mlx5_os_get_stats_n(dev);
 	if (stats_n < 0) {
 		DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
-			strerror(-stats_n));
+			rte_strerror(-stats_n));
 		return stats_n;
 	}
 	if (xstats_ctrl->stats_n != stats_n)
@@ -251,7 +251,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, counters);
 	if (ret) {
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		mlx5_free(counters);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
index 403f3a8f83..70d4d0039f 100644
--- a/drivers/net/mlx5/mlx5_testpmd.c
+++ b/drivers/net/mlx5/mlx5_testpmd.c
@@ -199,13 +199,13 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	socket_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
 	if (socket_fd < 0) {
 		TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n",
-			    strerror(errno));
+			    rte_strerror(errno));
 		return -1;
 	}
 	rte_strlcpy(un.sun_path, path, sizeof(un.sun_path));
 	if (connect(socket_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		TESTPMD_LOG(ERR, "Failed to connect %s: %s\n", un.sun_path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -216,7 +216,7 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0) {
 		TESTPMD_LOG(ERR, "Failed to send request to (%s): %s\n", path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -333,7 +333,7 @@ static void cmd_port_host_shaper_parsed(void *parsed_result,
 		ret = mlx5_test_set_port_host_shaper(res->port_num, res->fr,
 					   res->rate_num);
 	if (ret < 0)
-		printf("cmd_port_host_shaper error: (%s)\n", strerror(-ret));
+		printf("cmd_port_host_shaper error: (%s)\n", rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_port_host_shaper_mlx5 =
@@ -492,7 +492,7 @@ mlx5_cmd_map_ext_rxq_parsed(void *parsed_result,
 			res->sw_queue_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -565,7 +565,7 @@ mlx5_cmd_unmap_ext_rxq_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -648,7 +648,7 @@ mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result,
 	if (ret < 0)
 		fprintf(stderr, "Fail to set flow_engine to %s mode with flag 0x%x, error %s\n",
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag,
-			strerror(-ret));
+			rte_strerror(-ret));
 	else
 		TESTPMD_LOG(DEBUG, "Set %d ports flow_engine to %s mode with flag 0x%x\n", ret,
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag);
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 7bdb897612..eecd39d8a7 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -1190,14 +1190,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 		ret = mlx5_dev_configure_rss_reta(dev);
 		if (ret) {
 			DRV_LOG(ERR, "port %u reta config failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
 	ret = mlx5_txpp_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx packet pacing init failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_devx_obj_ops_en(priv->sh) &&
@@ -1209,7 +1209,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_txq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (priv->config.std_delay_drop || priv->config.hp_delay_drop) {
@@ -1233,7 +1233,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_rxq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Rx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/*
@@ -1243,7 +1243,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_hairpin_auto_bind(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u hairpin auto binding failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Set started flag here for the following steps like control flow. */
@@ -1296,7 +1296,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_flow_start_default(dev);
 	if (ret) {
 		DRV_LOG(DEBUG, "port %u failed to start default actions: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_dev_ctx_shared_mempool_subscribe(dev) != 0) {
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index e7161b66fe..e2914844c6 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -118,7 +118,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
 	ret = priv->obj_ops.rxq_obj_modify_vlan_strip(rxq, on);
 	if (ret) {
 		DRV_LOG(ERR, "Port %u failed to modify object stripping mode:"
-			" %s", dev->data->port_id, strerror(rte_errno));
+			" %s", dev->data->port_id, rte_strerror(rte_errno));
 		return;
 	}
 	/* Update related bits in RX queue. */
diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
index a31e1b5494..9e31ad9be7 100644
--- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
@@ -212,7 +212,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	stats_ctrl->imissed = 0;
 }
 
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index b731bdff06..9afc240b46 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -379,7 +379,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	err = mlx5_glue->devx_init_showdown_event(sh->cdev->ctx);
 	if (err) {
 		DRV_LOG(ERR, "failed to init showdown event: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	/* Allocate private eth device data. */
@@ -427,7 +427,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -437,7 +437,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -480,7 +480,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s).",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -730,7 +730,7 @@ mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return rte_errno;
 	}
 	if (!rte_is_same_ether_addr(&lmac, mac)) {
@@ -849,7 +849,7 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	spawn.eth_dev = mlx5_dev_spawn(cdev->dev, &spawn, mkvlist);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 35/43] net/qede: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (33 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 34/43] net/mlx5: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 36/43] net/sfc: " Dengdui Huang
                   ` (8 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/qede/qede_regs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_regs.c b/drivers/net/qede/qede_regs.c
index d2ea1c9108..3aa31a42c2 100644
--- a/drivers/net/qede/qede_regs.c
+++ b/drivers/net/qede/qede_regs.c
@@ -221,7 +221,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (!f) {
 		fprintf(stderr, "Can't open file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		return 1;
 	}
 	bytes = fwrite(dump, 1, len, f);
@@ -234,7 +234,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (fclose(f)) {
 		fprintf(stderr, "Can't close file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		err = 1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 36/43] net/sfc: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (34 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 35/43] net/qede: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 37/43] net/tap: " Dengdui Huang
                   ` (7 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/sfc/sfc_flow.c        |  2 +-
 drivers/net/sfc/sfc_flow_tunnel.c |  2 +-
 drivers/net/sfc/sfc_mae.c         | 58 +++++++++++++++----------------
 3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 1b50aefe5c..304628026d 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -1403,7 +1403,7 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa,
 		rc = item->parse(pattern, parse_ctx, error);
 		if (rc != 0) {
 			sfc_err(sa, "failed to parse item %s: %s",
-				item->name, strerror(-rc));
+				item->name, rte_strerror(-rc));
 			return rc;
 		}
 
diff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c
index 889fee569a..898d00dd6d 100644
--- a/drivers/net/sfc/sfc_flow_tunnel.c
+++ b/drivers/net/sfc/sfc_flow_tunnel.c
@@ -120,7 +120,7 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa,
 		if (rc != 0) {
 			/* The loop above might have spotted wrong actions. */
 			sfc_err(sa, "FT: TUNNEL: invalid actions: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			goto fail;
 		}
 
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index e5ec0ae49d..accde9bcb0 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -429,7 +429,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 					       &fw_rsrc->rule_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable outer_rule=%p: %s",
-				rule, strerror(rc));
+				rule, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -446,7 +446,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 			fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't match on outer rule ID: %s", strerror(rc));
+		sfc_err(sa, "can't match on outer rule ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -485,7 +485,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 						  &invalid_rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "cannot restore match on invalid outer rule ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 		return;
 	}
 
@@ -504,7 +504,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable outer_rule=%p with OR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -618,7 +618,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 					    &fw_rsrc->mac_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable mac_addr=%p: %s",
-				mac_addr, strerror(rc));
+				mac_addr, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -644,7 +644,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 		}
 
 		sfc_err(sa, "cannot fill in MAC address entry ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 
 		return rc;
 	}
@@ -687,7 +687,7 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa,
 				mac_addr, fw_rsrc->mac_id.id);
 		} else {
 			sfc_err(sa, "failed to disable mac_addr=%p with MAC_ID=0x%08x: %s",
-				mac_addr, fw_rsrc->mac_id.id, strerror(rc));
+				mac_addr, fw_rsrc->mac_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -820,7 +820,7 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa,
 						  bounce_eh->size);
 		if (ret != 0) {
 			sfc_err(sa, "failed to update encap_header=%p: %s",
-				encap_header, strerror(ret));
+				encap_header, rte_strerror(ret));
 			rte_free(buf);
 			return ret;
 		}
@@ -861,7 +861,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 						&fw_rsrc->eh_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable encap_header=%p: %s",
-				encap_header, strerror(rc));
+				encap_header, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -875,7 +875,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 			fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't fill in encap. header ID: %s", strerror(rc));
+		sfc_err(sa, "can't fill in encap. header ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -918,7 +918,7 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa,
 				encap_header, fw_rsrc->eh_id.id);
 		} else {
 			sfc_err(sa, "failed to disable encap_header=%p with EH_ID=0x%08x: %s",
-				encap_header, fw_rsrc->eh_id.id, strerror(rc));
+				encap_header, fw_rsrc->eh_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -1023,7 +1023,7 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter,
 			}
 
 			sfc_err(sa, "cannot fill in counter ID: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -1067,7 +1067,7 @@ sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter)
 				counter, counter->type, counter_id);
 		} else {
 			sfc_err(sa, "failed to disable counter=%p with COUNTER_ID=0x%x-#%u: %s",
-				counter, counter->type, counter_id, strerror(rc));
+				counter, counter->type, counter_id, rte_strerror(rc));
 		}
 
 		fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -1242,7 +1242,7 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa,
 					      &fw_rsrc->aset_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set=%p: %s",
-				action_set, strerror(rc));
+				action_set, rte_strerror(rc));
 
 			sfc_mae_encap_header_disable(sa, encap_header);
 			sfc_mae_mac_addr_disable(sa, src_mac_addr);
@@ -1290,7 +1290,7 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa,
 				action_set, fw_rsrc->aset_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_set=%p with AS_ID=0x%08x: %s",
-				action_set, fw_rsrc->aset_id.id, strerror(rc));
+				action_set, fw_rsrc->aset_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->aset_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1446,7 +1446,7 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa,
 						&fw_rsrc->aset_list_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set_list=%p: %s",
-				action_set_list, strerror(rc));
+				action_set_list, rte_strerror(rc));
 			goto fail_action_set_list_alloc;
 		}
 
@@ -1499,7 +1499,7 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa,
 		} else {
 			sfc_err(sa, "failed to disable action_set_list=%p with ASL_ID=0x%08x: %s",
 				action_set_list, fw_rsrc->aset_list_id.id,
-				strerror(rc));
+				rte_strerror(rc));
 		}
 		fw_rsrc->aset_list_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1710,7 +1710,7 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa,
 					as_idp, &fw_rsrc->rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "failed to enable action_rule=%p: %s",
-			rule, strerror(rc));
+			rule, rte_strerror(rc));
 		goto fail_action_rule_insert;
 	}
 
@@ -1761,7 +1761,7 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_rule=%p with AR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -4398,7 +4398,7 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa,
 
 	rc = efx_mae_action_set_populate_mark(spec, conf->id);
 	if (rc != 0)
-		sfc_err(sa, "failed to request action MARK: %s", strerror(rc));
+		sfc_err(sa, "failed to request action MARK: %s", rte_strerror(rc));
 
 	return rc;
 }
@@ -4570,14 +4570,14 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa,
 	if (rc != 0) {
 		sfc_err(sa, "failed to convert PF %u VF %d to m-port: %s",
 			encp->enc_pf, (vf != EFX_PCI_VF_INVALID) ? (int)vf : -1,
-			strerror(rc));
+			rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4606,14 +4606,14 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
 					     port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			port_id, strerror(rc));
+			port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4632,14 +4632,14 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa,
 					     conf->port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4658,14 +4658,14 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa,
 					     conf->port_id, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4758,7 +4758,7 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa,
 
 			if (action_name != NULL) {
 				sfc_err(sa, "action %s was rejected: %s",
-					action_name, strerror(rc));
+					action_name, rte_strerror(rc));
 			}
 		}
 		rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 37/43] net/tap: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (35 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 36/43] net/sfc: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 38/43] net/vhost: " Dengdui Huang
                   ` (6 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/tap/rte_eth_tap.c | 26 +++++++++++++-------------
 drivers/net/tap/tap_flow.c    | 18 +++++++++---------
 drivers/net/tap/tap_netlink.c |  5 +++--
 drivers/net/tap/tap_tcmsgs.c  |  6 ++++--
 4 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index b41fa971cb..ff290ea5bf 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -196,7 +196,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	/* Set the TUN/TAP configuration and set the name if needed */
 	if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) {
 		TAP_LOG(WARNING, "Unable to set TUNSETIFF for %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -204,7 +204,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (persistent && ioctl(fd, TUNSETPERSIST, 1) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set persist %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -224,7 +224,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		if (ioctl(fd, TUNSETQUEUE, (void *)&ifr) < 0) {
 			TAP_LOG(WARNING,
 				"Unable to detach keep-alive queue for %s: %s",
-				ifr.ifr_name, strerror(errno));
+				ifr.ifr_name, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -242,7 +242,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (fcntl(fd, F_SETFL, flags) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set %s to nonblocking: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -295,18 +295,18 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		/* Enable signal on file descriptor */
 		if (fcntl(fd, F_SETSIG, signo) < 0) {
 			TAP_LOG(WARNING, "Unable to set signo %d for fd %d: %s",
-				signo, fd, strerror(errno));
+				signo, fd, rte_strerror(errno));
 			goto error;
 		}
 		if (fcntl(fd, F_SETFL, flags | O_ASYNC) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl flags: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 
 		if (fcntl(fd, F_SETOWN, getpid()) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl owner: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -821,7 +821,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
 
 error:
 	TAP_LOG(DEBUG, "%s(%s) failed: %s(%d)", ifr->ifr_name,
-		tap_ioctl_req2str(request), strerror(errno), errno);
+		tap_ioctl_req2str(request), rte_strerror(errno), errno);
 	return -errno;
 }
 
@@ -1966,7 +1966,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 	if (pmd->ioctl_sock == -1) {
 		TAP_LOG(ERR,
 			"%s Unable to get a socket for management: %s",
-			tuntap_name, strerror(errno));
+			tuntap_name, rte_strerror(errno));
 		goto error_exit;
 	}
 
@@ -2127,7 +2127,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 
 disable_rte_flow:
 	TAP_LOG(ERR, " Disabling rte flow support: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	if (strlen(remote_iface)) {
 		TAP_LOG(ERR, "Remote feature requires flow support.");
 		goto error_exit;
@@ -2137,7 +2137,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 
 error_remote:
 	TAP_LOG(ERR, " Can't set up remote feature: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	tap_flow_implicit_flush(pmd, NULL);
 
 error_exit:
@@ -2475,7 +2475,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 			ret = rte_mp_action_register(TAP_MP_REQ_START_RXTX, tap_mp_req_start_rxtx);
 			if (ret < 0 && rte_errno != ENOTSUP) {
 				TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-					strerror(rte_errno));
+					rte_strerror(rte_errno));
 				return -1;
 			}
 		}
@@ -2535,7 +2535,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto leave;
 		}
 	}
diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index ed4d42f92f..9d6b84f5c7 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -1409,7 +1409,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 	if (err < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(error, EEXIST, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL,
 				   "overlapping rules or Kernel too old for flower support");
@@ -1454,7 +1454,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 		if (err < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule creation (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL,
@@ -1508,7 +1508,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 	if (ret < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule deletion (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"couldn't receive kernel ack to our request");
@@ -1532,7 +1532,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 		if (ret < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule deletion (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL, "Failure trying to receive nl ack");
@@ -1755,7 +1755,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd,
 			goto success;
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		goto fail;
 	}
 	LIST_INSERT_HEAD(&pmd->implicit_flows, remote_flow, next);
@@ -1871,7 +1871,7 @@ static int rss_enable(struct pmd_internals *pmd,
 	if (pmd->map_fd < 0) {
 		TAP_LOG(ERR,
 			"Failed to create BPF map (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
@@ -1946,7 +1946,7 @@ static int rss_enable(struct pmd_internals *pmd,
 		if (err < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule creation (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return err;
 		}
 		LIST_INSERT_HEAD(&pmd->rss_flows, rss_flow, next);
@@ -2111,7 +2111,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd,
 	if (err) {
 		TAP_LOG(ERR,
 			"Failed to update BPF map entry #%u (%d): %s",
-			flow->key_idx, errno, strerror(errno));
+			flow->key_idx, errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
@@ -2130,7 +2130,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd,
 	if (flow->bpf_fd[SEC_L3_L4] < 0) {
 		TAP_LOG(ERR,
 			"Failed to load BPF section %s (%d): %s",
-				sec_name[SEC_L3_L4], errno, strerror(errno));
+				sec_name[SEC_L3_L4], errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c
index 75af3404b0..354574ba29 100644
--- a/drivers/net/tap/tap_netlink.c
+++ b/drivers/net/tap/tap_netlink.c
@@ -14,6 +14,7 @@
 #include <rte_malloc.h>
 #include <tap_netlink.h>
 #include <rte_random.h>
+#include <rte_errno.h>
 
 #include "tap_log.h"
 
@@ -97,7 +98,7 @@ tap_nl_final(int nlsk_fd)
 {
 	if (close(nlsk_fd)) {
 		TAP_LOG(ERR, "Failed to close netlink socket: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return 0;
@@ -129,7 +130,7 @@ tap_nl_send(int nlsk_fd, struct nlmsghdr *nh)
 			goto retry;
 
 		TAP_LOG(ERR, "Failed to send netlink message: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return send_bytes;
diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c
index a3aae3c814..28d4809360 100644
--- a/drivers/net/tap/tap_tcmsgs.c
+++ b/drivers/net/tap/tap_tcmsgs.c
@@ -8,6 +8,8 @@
 #include <net/if.h>
 #include <string.h>
 
+#include <rte_errno.h>
+
 #include <rte_log.h>
 #include <tap_tcmsgs.h>
 #include "tap_log.h"
@@ -263,7 +265,7 @@ qdisc_create_multiq(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_multiq(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add multiq qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -289,7 +291,7 @@ qdisc_create_ingress(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_ingress(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add ingress qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 38/43] net/vhost: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (36 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 37/43] net/tap: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 39/43] net/virtio: " Dengdui Huang
                   ` (5 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 21bbb008e0..75b48dc31e 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -567,7 +567,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 			VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
-				vq->kickfd, rxq_idx, strerror(errno));
+				vq->kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
 				vq->kickfd, rxq_idx);
@@ -579,7 +579,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) {
 			VHOST_LOG(ERR, "Failed to register %d in rxq-%d epoll: %s\n",
-				vring.kickfd, rxq_idx, strerror(errno));
+				vring.kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			vq->kickfd = vring.kickfd;
 			VHOST_LOG(DEBUG, "Registered %d in rxq-%d epoll\n",
@@ -730,7 +730,7 @@ eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev)
 		if (vq->kickfd >= 0) {
 			if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 				VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
-					vq->kickfd, i, strerror(errno));
+					vq->kickfd, i, rte_strerror(errno));
 			} else {
 				VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
 					vq->kickfd, i);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 39/43] net/virtio: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (37 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 38/43] net/vhost: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 40/43] raw/ifpga: " Dengdui Huang
                   ` (4 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel.c |  8 +++---
 .../net/virtio/virtio_user/vhost_kernel_tap.c | 25 ++++++++++---------
 drivers/net/virtio/virtio_user/vhost_user.c   | 20 +++++++--------
 drivers/net/virtio/virtio_user/vhost_vdpa.c   | 12 ++++-----
 .../net/virtio/virtio_user/virtio_user_dev.c  |  8 +++---
 drivers/net/virtio/virtio_user_ethdev.c       |  6 ++---
 6 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
index e42bb35935..b1dec119fc 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -92,7 +92,7 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-kernel ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -428,7 +428,7 @@ vhost_kernel_setup(struct virtio_user_dev *dev)
 	for (i = 0; i < dev->max_queue_pairs; ++i) {
 		vhostfd = open(dev->path, O_RDWR);
 		if (vhostfd < 0) {
-			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, rte_strerror(errno));
 			goto err_tapfds;
 		}
 		data->vhostfds[i] = vhostfd;
@@ -511,14 +511,14 @@ vhost_kernel_set_backend(int vhostfd, int tapfd)
 	f.index = 0;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	f.index = 1;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index 611e2e25ec..4542ccbf04 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -13,6 +13,7 @@
 #include <limits.h>
 
 #include <rte_ether.h>
+#include <rte_errno.h>
 
 #include "vhost_kernel_tap.h"
 #include "../virtio_logs.h"
@@ -27,12 +28,12 @@ tap_support_features(unsigned int *tap_features)
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
 		PMD_DRV_LOG(ERR, "fail to open %s: %s",
-			    PATH_NET_TUN, strerror(errno));
+			    PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNGETFEATURES, tap_features) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -49,11 +50,11 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
-		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, strerror(errno));
+		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 	if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -68,12 +69,12 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 		if (multi_queue) {
 			PMD_DRV_LOG(DEBUG,
 				"TUNSETIFF failed (will retry without IFF_MULTI_QUEUE): %s",
-				strerror(errno));
+				rte_strerror(errno));
 			multi_queue = false;
 			goto retry_mono_q;
 		}
 
-		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", rte_strerror(errno));
 		close(tapfd);
 		tapfd = -1;
 	}
@@ -88,7 +89,7 @@ tap_get_name(int tapfd, char **name)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	ret = asprintf(name, "%s", ifr.ifr_name);
@@ -104,7 +105,7 @@ tap_get_flags(int tapfd, unsigned int *tap_flags)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	*tap_flags = ifr.ifr_flags;
@@ -120,7 +121,7 @@ tap_set_mac(int tapfd, uint8_t *mac)
 	ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
 	memcpy(ifr.ifr_hwaddr.sa_data, mac, RTE_ETHER_ADDR_LEN);
 	if (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -155,7 +156,7 @@ vhost_kernel_tap_set_offload(int fd, uint64_t features)
 		offload &= ~TUN_F_UFO;
 		if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
 			PMD_DRV_LOG(ERR, "TUNSETOFFLOAD ioctl() failed: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -175,12 +176,12 @@ vhost_kernel_tap_setup(int tapfd, int hdr_size, uint64_t features)
 	 * max_mem_regions, supported in newer version linux kernel
 	 */
 	if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNSETSNDBUF, &sndbuf) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 3c05ac9cc0..e079c726da 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -135,7 +135,7 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num)
 	} while (r < 0 && errno == EINTR);
 
 	if (r < 0)
-		PMD_DRV_LOG(ERR, "Failed to send msg: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to send msg: %s", rte_strerror(errno));
 
 	return r;
 }
@@ -148,7 +148,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 
 	ret = recv(fd, (void *)msg, sz_hdr, 0);
 	if (ret < 0) {
-		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", rte_strerror(errno));
 		return -1;
 	} else if (ret < sz_hdr) {
 		PMD_DRV_LOG(ERR, "Failed to recv msg hdr: %d instead of %d.",
@@ -174,7 +174,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 	if (sz_payload) {
 		ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
 		if (ret < 0) {
-			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", rte_strerror(errno));
 			return -1;
 		} else if (ret < sz_payload) {
 			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %d instead of %u.",
@@ -749,7 +749,7 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	ret = bind(fd, (struct sockaddr *)un, sizeof(*un));
 	if (ret < 0) {
 		PMD_DRV_LOG(ERR, "failed to bind to %s: %s; remove it and try again",
-			    dev->path, strerror(errno));
+			    dev->path, rte_strerror(errno));
 		return -1;
 	}
 	ret = listen(fd, MAX_VIRTIO_USER_BACKLOG);
@@ -760,13 +760,13 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	data->vhostfd = accept(fd, NULL, NULL);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to accept initial client connection (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	flag = fcntl(fd, F_GETFL);
 	if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl failed, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl failed, %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -834,15 +834,15 @@ vhost_user_setup(struct virtio_user_dev *dev)
 
 	fd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (fd < 0) {
-		PMD_DRV_LOG(ERR, "socket() error, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "socket() error, %s", rte_strerror(errno));
 		goto err_data;
 	}
 
 	flag = fcntl(fd, F_GETFD);
 	if (flag == -1)
-		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", rte_strerror(errno));
 	else if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0)
-		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", rte_strerror(errno));
 
 	memset(&un, 0, sizeof(un));
 	un.sun_family = AF_UNIX;
@@ -856,7 +856,7 @@ vhost_user_setup(struct virtio_user_dev *dev)
 		}
 	} else {
 		if (connect(fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
-			PMD_DRV_LOG(ERR, "connect error, %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "connect error, %s", rte_strerror(errno));
 			goto err_socket;
 		}
 		data->vhostfd = fd;
diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c
index 2c36b26224..ac0ef2c3f9 100644
--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
@@ -92,7 +92,7 @@ vhost_vdpa_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-vDPA ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -186,7 +186,7 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch begin (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -212,7 +212,7 @@ vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch end (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -243,7 +243,7 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -272,7 +272,7 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -530,7 +530,7 @@ vhost_vdpa_setup(struct virtio_user_dev *dev)
 	data->vhostfd = open(dev->path, O_RDWR);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to open %s: %s",
-				dev->path, strerror(errno));
+				dev->path, rte_strerror(errno));
 		free(data);
 		return -1;
 	}
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index af1f8c8237..ad7537a746 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -401,13 +401,13 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev)
 		 */
 		callfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 		if (callfd < 0) {
-			PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, rte_strerror(errno));
 			goto err;
 		}
 		kickfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 		if (kickfd < 0) {
 			close(callfd);
-			PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, rte_strerror(errno));
 			goto err;
 		}
 		dev->callfds[i] = callfd;
@@ -1043,7 +1043,7 @@ virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie)
 
 	if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
 		PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-			    strerror(errno));
+			    rte_strerror(errno));
 }
 
 int
@@ -1264,7 +1264,7 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev *dev)
 
 	if (dev->ops->get_features(dev, &dev->device_features) < 0) {
 		PMD_INIT_LOG(ERR, "get_features failed: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 3a31642899..908afde4fc 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -273,7 +273,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
 
 	if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
 		PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-			    strerror(errno));
+			    rte_strerror(errno));
 }
 
 static int
@@ -382,7 +382,7 @@ vdpa_dynamic_major_num(void)
 	fp = fopen("/proc/devices", "r");
 	if (fp == NULL) {
 		PMD_INIT_LOG(ERR, "Cannot open /proc/devices: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return UNNAMED_MAJOR;
 	}
 
@@ -409,7 +409,7 @@ virtio_user_backend_type(const char *path)
 			return VIRTIO_USER_BACKEND_VHOST_USER;
 
 		PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path,
-			     strerror(errno));
+			     rte_strerror(errno));
 		return VIRTIO_USER_BACKEND_UNKNOWN;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 40/43] raw/ifpga: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (38 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 39/43] net/virtio: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 41/43] vdpa/ifc: " Dengdui Huang
                   ` (3 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/raw/ifpga/afu_pmd_n3000.c      |  5 +++--
 drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +++++++-----
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 67b3941265..d7302edc3f 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -21,6 +21,7 @@
 #include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
+#include <rte_errno.h>
 
 #include "afu_pmd_core.h"
 #include "afu_pmd_n3000.h"
@@ -693,7 +694,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 	pfd.events = POLLIN;
 	poll_ret = poll(&pfd, 1, DMA_TIMEOUT_MSEC);
 	if (poll_ret < 0) {
-		IFPGA_RAWDEV_PMD_ERR("Error %s", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Error %s", rte_strerror(errno));
 		ret = -EFAULT;
 		goto out;
 	} else if (poll_ret == 0) {
@@ -708,7 +709,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 			ret = 0;
 		} else {
 			IFPGA_RAWDEV_PMD_ERR("Failed %s", bytes_read > 0 ?
-				strerror(errno) : "zero bytes read");
+				rte_strerror(errno) : "zero bytes read");
 			ret = -EIO;
 		}
 	}
diff --git a/drivers/raw/ifpga/base/ifpga_fme_rsu.c b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
index f147aaa1e8..8e8a611f9a 100644
--- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c
+++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
@@ -7,6 +7,8 @@
 #include <unistd.h>
 #include "ifpga_sec_mgr.h"
 
+#include <rte_errno.h>
+
 static struct ifpga_sec_mgr *sec_mgr;
 
 static void set_rsu_control(struct ifpga_sec_mgr *smgr, uint32_t ctrl)
@@ -112,7 +114,7 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 
@@ -130,14 +132,14 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 			IFPGA_RSU_DATA_BLK_SIZE : length;
 		if (lseek(fd, offset, SEEK_SET) < 0) {
 			dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
 		read_size = read(fd, buf, to_transfer);
 		if (read_size < 0) {
 			dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
@@ -316,7 +318,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	len = lseek(fd, 0, SEEK_END);
@@ -325,7 +327,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (len < 0) {
 		dev_err(smgr,
 			"Failed to get file length of \'%s\' [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	if (len == 0) {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index f89bd3f9e2..56d3ec02eb 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -847,7 +847,7 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id,
 	if (file_fd < 0) {
 		IFPGA_RAWDEV_PMD_ERR("%s: open file error: %s\n",
 				__func__, file_name);
-		IFPGA_RAWDEV_PMD_ERR("Message : %s\n", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Message : %s\n", rte_strerror(errno));
 		return -EINVAL;
 	}
 	ret = stat(file_name, &file_stat);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 41/43] vdpa/ifc: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (39 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 40/43] raw/ifpga: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 42/43] vdpa/mlx5: " Dengdui Huang
                   ` (2 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index f034bd59ba..34ea450d00 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
+#include <rte_errno.h>
 
 #include "base/ifcvf.h"
 
@@ -446,7 +447,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 			fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 			if (fd < 0) {
 				DRV_LOG(ERR, "can't setup eventfd: %s",
-					strerror(errno));
+					rte_strerror(errno));
 				return -1;
 			}
 			internal->intr_fd[i] = fd;
@@ -457,7 +458,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error enabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -489,7 +490,7 @@ vdpa_disable_vfio_intr(struct ifcvf_internal *internal)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error disabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -526,7 +527,7 @@ notify_relay(void *arg)
 		rte_vhost_get_vhost_vring(internal->vid, qid, &vring);
 		ev.data.u64 = qid | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -552,7 +553,7 @@ notify_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -628,7 +629,7 @@ intr_relay(void *arg)
 	ev.data.fd = rte_intr_fd_get(internal->pdev->intr_handle);
 	if (epoll_ctl(csc_epfd, EPOLL_CTL_ADD,
 		rte_intr_fd_get(internal->pdev->intr_handle), &ev) < 0) {
-		DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+		DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 		goto out;
 	}
 
@@ -653,7 +654,7 @@ intr_relay(void *arg)
 					continue;
 				DRV_LOG(ERR, "Error reading from file descriptor %d: %s\n",
 					csc_event.data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				goto out;
 			} else if (nbytes == 0) {
 				DRV_LOG(ERR, "Read nothing from file descriptor %d\n",
@@ -947,7 +948,7 @@ vring_relay(void *arg)
 		rte_vhost_get_vhost_vring(vid, qid, &vring);
 		ev.data.u64 = qid << 1 | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -961,7 +962,7 @@ vring_relay(void *arg)
 			(uint64_t)internal->intr_fd[qid] << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, internal->intr_fd[qid], &ev)
 				< 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 		update_used_ring(internal, qid);
@@ -992,7 +993,7 @@ vring_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -1265,7 +1266,7 @@ ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret) {
 		DRV_LOG(ERR, "Get not get device region info: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 42/43] vdpa/mlx5: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (40 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 41/43] vdpa/ifc: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14  8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang
  2023-11-15  0:16 ` [PATCH 00/43] " Stephen Hemminger
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 607e290995..243abef588 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -44,7 +44,7 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
 			    errno == EAGAIN)
 				continue;
 			DRV_LOG(ERR,  "Failed to read kickfd of virtq %d: %s.",
-				virtq->index, strerror(errno));
+				virtq->index, rte_strerror(errno));
 		}
 		break;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH 43/43] vdpa/sfc: use rte strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (41 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 42/43] vdpa/mlx5: " Dengdui Huang
@ 2023-11-14  8:25 ` Dengdui Huang
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                     ` (2 more replies)
  2023-11-15  0:16 ` [PATCH 00/43] " Stephen Hemminger
  43 siblings, 3 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14  8:25 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index 00f9a4b04c..56fb7f96d8 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -137,7 +137,7 @@ sfc_vdpa_enable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error enabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -165,7 +165,7 @@ sfc_vdpa_disable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error disabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -841,7 +841,7 @@ sfc_vdpa_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret != 0) {
 		sfc_vdpa_err(dev, "could not get device region info: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 00/43] replace strerror
  2023-11-14  8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang
@ 2023-11-14 11:23   ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang
                       ` (42 more replies)
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
  2 siblings, 43 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This series of patches fix it. In this patchset, only the libs and
drivers are modified.

chang log:
v1-v2 fix ci error

Dengdui Huang (43):
  devtools: forbid use of strerror
  eal: use rte strerror
  eventdev: use rte strerror
  latency: use rte strerror
  node: use rte strerror
  pdump: use rte strerror
  power: use rte strerror
  telemetry: replace strerror
  vhost: use rte strerror
  bpf: use rte strerror
  bus/cdx: use rte strerror
  bus/dpaa: use rte strerror
  bus/fslmc: use rte strerror
  bus/pci: use rte strerror
  bus/vdev: use rte strerror
  bus/vmbus: use rte strerror
  common/cnxk: use rte strerror
  common/mlx5: use rte strerror
  crypto/caam_jr: use rte strerror
  dma/idxd: use rte strerror
  net/af_packet: use rte strerror
  net/bnxt: use rte strerror
  net/af_xdp: use rte strerror
  net/bonding: use rte strerror
  net/dpaa: use rte strerror
  net/dpaa2: use rte strerror
  net/enetfec: use rte strerror
  net/failsafe: use rte strerror
  net/i40e: use rte strerror
  net/ice: use rte strerror
  net/ixgbe: use rte strerror
  net/memif: use rte strerror
  net/mlx4: use rte strerror
  net/mlx5: use rte strerror
  net/qede: use rte strerror
  net/sfc: use rte strerror
  net/tap: use rte strerror
  net/vhost: use rte strerror
  net/virtio: use rte strerror
  raw/ifpga: use rte strerror
  vdpa/ifc: use rte strerror
  vdpa/mlx5: use rte strerror
  vdpa/sfc: use rte strerror

 devtools/checkpatches.sh                      |   8 +
 drivers/bus/cdx/cdx.c                         |   2 +-
 drivers/bus/cdx/cdx_vfio.c                    |  13 +-
 drivers/bus/dpaa/base/fman/fman.c             |   2 +-
 drivers/bus/dpaa/dpaa_bus.c                   |   2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  12 +-
 drivers/bus/pci/bsd/pci.c                     |   8 +-
 drivers/bus/pci/linux/pci.c                   |   7 +-
 drivers/bus/pci/linux/pci_uio.c               |  23 +-
 drivers/bus/pci/linux/pci_vfio.c              |  23 +-
 drivers/bus/pci/pci_common_uio.c              |   3 +-
 drivers/bus/vdev/vdev.c                       |   2 +-
 drivers/bus/vmbus/linux/vmbus_bus.c           |   7 +-
 drivers/bus/vmbus/linux/vmbus_uio.c           |  21 +-
 drivers/bus/vmbus/vmbus_common.c              |   4 +-
 drivers/bus/vmbus/vmbus_common_uio.c          |   3 +-
 drivers/common/cnxk/roc_dev.c                 |   4 +-
 drivers/common/cnxk/roc_model.c               |   4 +-
 drivers/common/cnxk/roc_utils.c               |   4 +-
 drivers/common/mlx5/linux/mlx5_nl.c           |  12 +-
 drivers/common/mlx5/mlx5_common.c             |   6 +-
 drivers/common/mlx5/mlx5_devx_cmds.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr_uio.c          |   5 +-
 drivers/dma/idxd/idxd_bus.c                   |  15 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  12 +-
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 drivers/net/bonding/bonding_testpmd.c         |   4 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_flow.c       |   4 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   6 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   4 +-
 drivers/net/dpaa/fmlib/fm_lib.c               |   6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/enetfec/enet_uio.c                |   2 +-
 drivers/net/failsafe/failsafe.c               |   8 +-
 drivers/net/failsafe/failsafe_args.c          |   4 +-
 drivers/net/failsafe/failsafe_eal.c           |   4 +-
 drivers/net/failsafe/failsafe_flow.c          |   4 +-
 drivers/net/failsafe/failsafe_ops.c           |   2 +-
 drivers/net/failsafe/failsafe_private.h       |   6 +-
 drivers/net/i40e/i40e_testpmd.c               |  42 +--
 drivers/net/ice/ice_testpmd.c                 |   4 +-
 drivers/net/ixgbe/ixgbe_testpmd.c             |  12 +-
 drivers/net/memif/memif_socket.c              |   4 +-
 drivers/net/memif/rte_eth_memif.c             |  20 +-
 drivers/net/mlx4/mlx4.c                       |  14 +-
 drivers/net/mlx4/mlx4_ethdev.c                |  18 +-
 drivers/net/mlx4/mlx4_rxq.c                   |  10 +-
 drivers/net/mlx4/mlx4_txq.c                   |  10 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c         |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |  20 +-
 drivers/net/mlx5/linux/mlx5_os.c              |  18 +-
 drivers/net/mlx5/linux/mlx5_socket.c          |  16 +-
 drivers/net/mlx5/linux/mlx5_verbs.c           |   8 +-
 drivers/net/mlx5/mlx5.c                       |   8 +-
 drivers/net/mlx5/mlx5_devx.c                  |   4 +-
 drivers/net/mlx5/mlx5_mac.c                   |   2 +-
 drivers/net/mlx5/mlx5_rxmode.c                |   8 +-
 drivers/net/mlx5/mlx5_rxq.c                   |   4 +-
 drivers/net/mlx5/mlx5_rxtx.c                  |   2 +-
 drivers/net/mlx5/mlx5_stats.c                 |   4 +-
 drivers/net/mlx5/mlx5_testpmd.c               |  14 +-
 drivers/net/mlx5/mlx5_trigger.c               |  12 +-
 drivers/net/mlx5/mlx5_vlan.c                  |   2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c     |   2 +-
 drivers/net/mlx5/windows/mlx5_os.c            |  12 +-
 drivers/net/qede/qede_regs.c                  |   4 +-
 drivers/net/sfc/sfc_flow.c                    |   2 +-
 drivers/net/sfc/sfc_flow_tunnel.c             |   2 +-
 drivers/net/sfc/sfc_mae.c                     |  58 ++---
 drivers/net/tap/rte_eth_tap.c                 |  26 +-
 drivers/net/tap/tap_flow.c                    |  18 +-
 drivers/net/tap/tap_netlink.c                 |   5 +-
 drivers/net/tap/tap_tcmsgs.c                  |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   6 +-
 drivers/net/virtio/virtio_user/vhost_kernel.c |   8 +-
 .../net/virtio/virtio_user/vhost_kernel_tap.c |  25 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |  20 +-
 drivers/net/virtio/virtio_user/vhost_vdpa.c   |  12 +-
 .../net/virtio/virtio_user/virtio_user_dev.c  |   8 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   6 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   5 +-
 drivers/raw/ifpga/base/ifpga_fme_rsu.c        |  12 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |  23 +-
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c           |   2 +-
 drivers/vdpa/sfc/sfc_vdpa_ops.c               |   6 +-
 lib/bpf/bpf_load_elf.c                        |   2 +-
 lib/eal/common/eal_common_fbarray.c           |   2 +-
 lib/eal/common/eal_common_options.c           |   7 +-
 lib/eal/common/eal_common_proc.c              |  12 +-
 lib/eal/common/eal_common_trace_utils.c       |   6 +-
 lib/eal/freebsd/eal.c                         |   4 +-
 lib/eal/freebsd/eal_interrupts.c              |   8 +-
 lib/eal/freebsd/eal_memory.c                  |   2 +-
 lib/eal/freebsd/eal_timer.c                   |   6 +-
 lib/eal/linux/eal.c                           |  10 +-
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/linux/eal_hugepage_info.c             |   5 +-
 lib/eal/linux/eal_interrupts.c                |  18 +-
 lib/eal/linux/eal_memalloc.c                  |  47 ++--
 lib/eal/linux/eal_memory.c                    |  43 ++--
 lib/eal/linux/eal_timer.c                     |   2 +-
 lib/eal/linux/eal_vfio.c                      |  40 +--
 lib/eal/unix/eal_filesystem.c                 |   5 +-
 lib/eal/unix/eal_unix_memory.c                |   6 +-
 lib/eal/unix/rte_thread.c                     |   6 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |   2 +-
 lib/latencystats/rte_latencystats.c           |   4 +-
 lib/node/kernel_tx.c                          |   2 +-
 lib/pdump/rte_pdump.c                         |   6 +-
 lib/power/guest_channel.c                     |   7 +-
 lib/power/power_kvm_vm.c                      |   3 +-
 lib/power/power_pstate_cpufreq.c              |   7 +-
 lib/power/rte_power_pmd_mgmt.c                |   2 +-
 lib/telemetry/telemetry.c                     |  28 +-
 lib/telemetry/telemetry_legacy.c              |   5 +-
 lib/vhost/socket.c                            |  13 +-
 lib/vhost/vduse.c                             |  31 +--
 lib/vhost/vhost_user.c                        |  11 +-
 137 files changed, 965 insertions(+), 903 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 01/43] devtools: forbid use of strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 02/43] eal: use rte strerror Dengdui Huang
                       ` (41 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
rte_strerror() has been provided in DPDK to replace it.

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 066449d147..7fbd0df3b3 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -159,6 +159,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from using strerror() for drivers and libs
+	awk -v FOLDERS="lib drivers" \
+		-v EXPRESSIONS="\\\sstrerror\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using strerror, prefer rte_strerror' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# refrain from using RTE_LOG_REGISTER for drivers and libs
 	awk -v FOLDERS='lib drivers' \
 		-v EXPRESSIONS='\\<RTE_LOG_REGISTER\\>' \
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 02/43] eal: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 03/43] eventdev: " Dengdui Huang
                       ` (40 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_fbarray.c     |  2 +-
 lib/eal/common/eal_common_options.c     |  7 ++--
 lib/eal/common/eal_common_proc.c        | 12 +++----
 lib/eal/common/eal_common_trace_utils.c |  6 ++--
 lib/eal/freebsd/eal.c                   |  4 +--
 lib/eal/freebsd/eal_interrupts.c        |  8 ++---
 lib/eal/freebsd/eal_memory.c            |  2 +-
 lib/eal/freebsd/eal_timer.c             |  6 ++--
 lib/eal/linux/eal.c                     | 10 +++---
 lib/eal/linux/eal_dev.c                 |  2 +-
 lib/eal/linux/eal_hugepage_info.c       |  5 +--
 lib/eal/linux/eal_interrupts.c          | 18 +++++-----
 lib/eal/linux/eal_memalloc.c            | 47 +++++++++++++------------
 lib/eal/linux/eal_memory.c              | 43 +++++++++++-----------
 lib/eal/linux/eal_timer.c               |  2 +-
 lib/eal/linux/eal_vfio.c                | 40 ++++++++++-----------
 lib/eal/unix/eal_filesystem.c           |  5 +--
 lib/eal/unix/eal_unix_memory.c          |  6 ++--
 lib/eal/unix/rte_thread.c               |  6 ++--
 19 files changed, 118 insertions(+), 113 deletions(-)

diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c
index 2055bfa57d..a2936bbd91 100644
--- a/lib/eal/common/eal_common_fbarray.c
+++ b/lib/eal/common/eal_common_fbarray.c
@@ -1027,7 +1027,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		eal_get_fbarray_path(path, sizeof(path), arr->name);
 		if (unlink(path)) {
 			RTE_LOG(DEBUG, EAL, "Cannot unlink fbarray: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			/*
 			 * we're still holding an exclusive lock, so drop it to
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index a6d21f1cba..8a09fe2719 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -44,6 +44,7 @@
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include "eal_trace.h"
 #endif
+#include <rte_errno.h>
 
 #define BITS_PER_HEX 4
 #define LCORE_OPT_LST 1
@@ -391,7 +392,7 @@ eal_plugindir_init(const char *path)
 	d = opendir(path);
 	if (d == NULL) {
 		RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n",
-			path, strerror(errno));
+			path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -443,7 +444,7 @@ verify_perms(const char *dirpath)
 	/* call stat to check for permissions and ensure not world writable */
 	if (stat(dirpath, &st) != 0) {
 		RTE_LOG(ERR, EAL, "Error with stat on %s, %s\n",
-				dirpath, strerror(errno));
+				dirpath, rte_strerror(errno));
 		return -1;
 	}
 	if (st.st_mode & S_IWOTH) {
@@ -471,7 +472,7 @@ eal_dlopen(const char *pathname)
 	}
 	if (realp == NULL) {
 		RTE_LOG(ERR, EAL, "Error with realpath for %s, %s\n",
-				pathname, strerror(errno));
+				pathname, rte_strerror(errno));
 		goto out;
 	}
 	if (strnlen(realp, PATH_MAX) == PATH_MAX) {
diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index 728815c4a9..2e39180d40 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -291,7 +291,7 @@ read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s)
 		if (errno == EINTR)
 			goto retry;
 
-		RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", strerror(errno));
+		RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -583,7 +583,7 @@ open_socket_fd(void)
 
 	if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		RTE_LOG(ERR, EAL, "failed to bind %s: %s\n",
-			un.sun_path, strerror(errno));
+			un.sun_path, rte_strerror(errno));
 		close(mp_fd);
 		return -1;
 	}
@@ -631,13 +631,13 @@ rte_mp_channel_init(void)
 	dir_fd = open(mp_dir_path, O_RDONLY);
 	if (dir_fd < 0) {
 		RTE_LOG(ERR, EAL, "failed to open %s: %s\n",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		return -1;
 	}
 
 	if (flock(dir_fd, LOCK_EX)) {
 		RTE_LOG(ERR, EAL, "failed to lock %s: %s\n",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
@@ -650,7 +650,7 @@ rte_mp_channel_init(void)
 	if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg",
 			mp_handle, NULL) < 0) {
 		RTE_LOG(ERR, EAL, "failed to create mp thread: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dir_fd);
 		close(rte_atomic_exchange_explicit(&mp_fd, -1, rte_memory_order_relaxed));
 		return -1;
@@ -733,7 +733,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type)
 			return 0;
 		}
 		RTE_LOG(ERR, EAL, "failed to send to (%s) due to %s\n",
-			dst_path, strerror(errno));
+			dst_path, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c
index 8561a0e198..b74adf6589 100644
--- a/lib/eal/common/eal_common_trace_utils.c
+++ b/lib/eal/common/eal_common_trace_utils.c
@@ -244,7 +244,7 @@ eal_trace_dir_args_save(char const *val)
 	int rc;
 
 	if (asprintf(&dir_path, "%s/", val) == -1) {
-		trace_err("failed to copy directory: %s", strerror(errno));
+		trace_err("failed to copy directory: %s", rte_strerror(errno));
 		return -ENOMEM;
 	}
 
@@ -328,7 +328,7 @@ trace_mkdir(void)
 	/* Create the path if it t exist, no "mkdir -p" available here */
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0 && errno != EEXIST) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
@@ -343,7 +343,7 @@ trace_mkdir(void)
 
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 568e06e9ed..a82f3ab8d0 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -203,7 +203,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -250,7 +250,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 2b31dfb099..0672e88e4e 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -186,7 +186,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
 			else
 				RTE_LOG(ERR, EAL, "Error adding fd %d kevent, %s\n",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			ret = -errno;
 			goto fail;
 		}
@@ -323,7 +323,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,
 		if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 			RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n",
 				rte_intr_fd_get(src->intr_handle),
-				strerror(errno));
+				rte_strerror(errno));
 			/* removing non-existent even is an expected condition
 			 * in some circumstances (e.g. oneshot events).
 			 */
@@ -516,7 +516,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				RTE_LOG(ERR, EAL, "Error reading from file "
 					"descriptor %d: %s\n",
 					event_fd,
-					strerror(errno));
+					rte_strerror(errno));
 			} else if (bytes_read == 0)
 				RTE_LOG(ERR, EAL, "Read nothing from file "
 					"descriptor %d\n", event_fd);
@@ -567,7 +567,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 					RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n",
 						rte_intr_fd_get(src->intr_handle),
-						strerror(errno));
+						rte_strerror(errno));
 					/* removing non-existent even is an expected
 					 * condition in some circumstances
 					 * (e.g. oneshot events).
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index 5c6165c580..35e11970c6 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -85,7 +85,7 @@ rte_eal_hugepage_init(void)
 				MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 		if (addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			return -1;
 		}
 
diff --git a/lib/eal/freebsd/eal_timer.c b/lib/eal/freebsd/eal_timer.c
index beff755a47..7125e4e0e8 100644
--- a/lib/eal/freebsd/eal_timer.c
+++ b/lib/eal/freebsd/eal_timer.c
@@ -36,20 +36,20 @@ get_tsc_freq(void)
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0))
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 	else if (tmp != 1)
 		RTE_LOG(WARNING, EAL, "TSC is not safe to use in SMP mode\n");
 
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0))
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 	else if (tmp != 1)
 		RTE_LOG(WARNING, EAL, "TSC is not invariant\n");
 
 	sz = sizeof(tsc_hz);
 	if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) {
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 57da058cec..0da0a000ac 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -160,7 +160,7 @@ eal_clean_runtime_dir(void)
 		closedir(dir);
 
 	RTE_LOG(ERR, EAL, "Error while clearing runtime dir: %s\n",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -288,7 +288,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -335,7 +335,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1421,7 +1421,7 @@ rte_eal_check_module(const char *module_name)
 	/* Check if there is sysfs mounted */
 	if (stat("/sys/module", &st) != 0) {
 		RTE_LOG(DEBUG, EAL, "sysfs is not mounted! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1434,7 +1434,7 @@ rte_eal_check_module(const char *module_name)
 
 	if (stat(sysfs_mod_name, &st) != 0) {
 		RTE_LOG(DEBUG, EAL, "Module %s not found! error %i (%s)\n",
-		        sysfs_mod_name, errno, strerror(errno));
+			sysfs_mod_name, errno, rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ac76f6174d..ede68f32cf 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -73,7 +73,7 @@ static void sigbus_handler(int signum, siginfo_t *info,
 	if (ret == -1) {
 		rte_exit(EXIT_FAILURE,
 			 "Failed to handle SIGBUS for hot-unplug, "
-			 "(rte_errno: %s)!", strerror(rte_errno));
+			 "(rte_errno: %s)!", rte_strerror(rte_errno));
 	} else if (ret == 1) {
 		if (sigbus_action_old.sa_flags == SA_SIGINFO
 		    && sigbus_action_old.sa_sigaction) {
diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c
index 581d9dfc91..6286ab3efb 100644
--- a/lib/eal/linux/eal_hugepage_info.c
+++ b/lib/eal/linux/eal_hugepage_info.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_common.h>
 #include "rte_string_fns.h"
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
@@ -378,7 +379,7 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void *user_data)
 		closedir(dir);
 
 	RTE_LOG(ERR, EAL, "Error while walking hugepage dir: %s\n",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -404,7 +405,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd)
 
 	if (fstat(whd->file_fd, &st) < 0)
 		RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s",
-				__func__, whd->file_name, strerror(errno));
+				__func__, whd->file_name, rte_strerror(errno));
 	else
 		(*total_size) += st.st_size;
 }
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index d4919dff45..660e64dd41 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -460,7 +460,7 @@ uio_intr_disable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		RTE_LOG(ERR, EAL, "Error disabling interrupts for fd %d (%s)\n",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -474,7 +474,7 @@ uio_intr_enable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		RTE_LOG(ERR, EAL, "Error enabling interrupts for fd %d (%s)\n",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -975,7 +975,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 				RTE_LOG(ERR, EAL, "Error reading from file "
 					"descriptor %d: %s\n",
 					events[n].data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				/*
 				 * The device is unplugged or buggy, remove
 				 * it as an interrupt source and return to
@@ -1130,7 +1130,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 		if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
 						&pipe_event) < 0) {
 			rte_panic("Error adding fd to %d epoll_ctl, %s\n",
-					intr_pipe.readfd, strerror(errno));
+					intr_pipe.readfd, rte_strerror(errno));
 		}
 		numfds++;
 
@@ -1153,7 +1153,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 					rte_intr_fd_get(src->intr_handle), &ev) < 0) {
 				rte_panic("Error adding fd %d epoll_ctl, %s\n",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			}
 			else
 				numfds++;
@@ -1244,7 +1244,7 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
 				continue;
 			RTE_LOG(ERR, EAL,
 				"Error reading from fd %d: %s\n",
-				fd, strerror(errno));
+				fd, rte_strerror(errno));
 		} else if (nbytes == 0)
 			RTE_LOG(ERR, EAL, "Read nothing from fd %d\n", fd);
 		return;
@@ -1343,7 +1343,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events,
 			}
 			/* epoll_wait fail */
 			RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			rc = -1;
 			break;
 		} else {
@@ -1412,7 +1412,7 @@ rte_epoll_ctl(int epfd, int op, int fd,
 	ev.events = event->epdata.event;
 	if (epoll_ctl(epfd, op, fd, &ev) < 0) {
 		RTE_LOG(ERR, EAL, "Error op %d fd %d epoll_ctl, %s\n",
-			op, fd, strerror(errno));
+			op, fd, rte_strerror(errno));
 		if (op == EPOLL_CTL_ADD)
 			/* rollback status when CTL_ADD fail */
 			rte_atomic_store_explicit(&event->status, RTE_EPOLL_INVALID,
@@ -1525,7 +1525,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
 			if (fd < 0) {
 				RTE_LOG(ERR, EAL,
 					"can't setup eventfd, error %i (%s)\n",
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 				return -errno;
 			}
 
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index 9853ec78a2..53a7e5dd3b 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -31,6 +31,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "eal_internal_cfg.h"
@@ -161,7 +162,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id)
 			  oldmask->size + 1, 0, 0) < 0) {
 		RTE_LOG(ERR, EAL,
 			"Failed to get current mempolicy: %s. "
-			"Assuming MPOL_DEFAULT.\n", strerror(errno));
+			"Assuming MPOL_DEFAULT.\n", rte_strerror(errno));
 		*oldpolicy = MPOL_DEFAULT;
 	}
 	RTE_LOG(DEBUG, EAL,
@@ -180,7 +181,7 @@ restore_numa(int *oldpolicy, struct bitmask *oldmask)
 	} else if (set_mempolicy(*oldpolicy, oldmask->maskp,
 				 oldmask->size + 1) < 0) {
 		RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		numa_set_localalloc();
 	}
 	numa_free_cpumask(oldmask);
@@ -224,7 +225,7 @@ static int lock(int fd, int type)
 		return 0;
 	} else if (ret) {
 		RTE_LOG(ERR, EAL, "%s(): error calling flock(): %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 	/* lock was successful */
@@ -252,7 +253,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].memseg_list_fd = fd;
@@ -266,7 +267,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].fds[seg_idx] = fd;
@@ -317,7 +318,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	ret = stat(path, &st);
 	if (ret < 0 && errno != ENOENT) {
 		RTE_LOG(DEBUG, EAL, "%s(): stat() for '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	if (!internal_conf->hugepage_file.unlink_existing && ret == 0 &&
@@ -343,7 +344,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 		/* coverity[toctou] */
 		if (unlink(path) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): could not remove '%s': %s\n",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -352,13 +353,13 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	fd = open(path, O_CREAT | O_RDWR, 0600);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "%s(): open '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	/* take out a read lock */
 	if (lock(fd, LOCK_SH) < 0) {
 		RTE_LOG(ERR, EAL, "%s(): lock '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -380,7 +381,7 @@ resize_hugefile_in_memory(int fd, uint64_t fa_offset,
 	if (ret < 0) {
 		RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n",
 				__func__,
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -415,7 +416,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 			if (new_size > cur_size &&
 					ftruncate(fd, new_size) < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 		} else {
@@ -451,7 +452,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 				} else {
 					RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n",
 						__func__,
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			} else {
@@ -484,7 +485,7 @@ close_hugefile(int fd, char *path, int list_idx)
 			rte_eal_process_type() == RTE_PROC_PRIMARY &&
 			unlink(path))
 		RTE_LOG(ERR, EAL, "%s(): unlinking '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 
 	close(fd);
 	fd_list[list_idx].memseg_list_fd = -1;
@@ -585,14 +586,14 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 			map_offset = 0;
 			if (ftruncate(fd, alloc_sz) < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				goto resized;
 			}
 			if (internal_conf->hugepage_file.unlink_before_mapping &&
 					!internal_conf->in_memory) {
 				if (unlink(path)) {
 					RTE_LOG(DEBUG, EAL, "%s(): unlink() failed: %s\n",
-						__func__, strerror(errno));
+						__func__, rte_strerror(errno));
 					goto resized;
 				}
 			}
@@ -611,7 +612,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 
 	if (va == MAP_FAILED) {
 		RTE_LOG(DEBUG, EAL, "%s(): mmap() failed: %s\n", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		/* mmap failed, but the previous region might have been
 		 * unmapped anyway. try to remap it
 		 */
@@ -662,7 +663,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 					MPOL_F_NODE | MPOL_F_ADDR);
 		if (ret < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mapped;
 		} else if (cur_socket_id != socket_id) {
 			RTE_LOG(DEBUG, EAL,
@@ -874,13 +875,13 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -981,13 +982,13 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -1345,13 +1346,13 @@ sync_existing(struct rte_memseg_list *primary_msl,
 	dir_fd = open(hi->hugedir, O_RDONLY);
 	if (dir_fd < 0) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		return -1;
 	}
 	/* blocking writelock */
 	if (flock(dir_fd, LOCK_EX)) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 9b6f08fba8..db92d1a602 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -105,7 +105,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	fd = open("/proc/self/pagemap", O_RDONLY);
 	if (fd < 0) {
 		RTE_LOG(INFO, EAL, "%s(): cannot open /proc/self/pagemap: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	}
 
@@ -113,7 +113,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	offset = sizeof(uint64_t) * virt_pfn;
 	if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
 		RTE_LOG(INFO, EAL, "%s(): seek error in /proc/self/pagemap: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		close(fd);
 		return RTE_BAD_IOVA;
 	}
@@ -122,7 +122,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	close(fd);
 	if (retval < 0) {
 		RTE_LOG(INFO, EAL, "%s(): cannot read /proc/self/pagemap: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	} else if (retval != PFN_MASK_SIZE) {
 		RTE_LOG(INFO, EAL, "%s(): read %d bytes from /proc/self/pagemap "
@@ -237,7 +237,7 @@ static int huge_wrap_sigsetjmp(void)
 /* Callback for numa library. */
 void numa_error(char *where)
 {
-	RTE_LOG(ERR, EAL, "%s failed: %s\n", where, strerror(errno));
+	RTE_LOG(ERR, EAL, "%s failed: %s\n", where, rte_strerror(errno));
 }
 #endif
 
@@ -278,7 +278,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				  oldmask->size + 1, 0, 0) < 0) {
 			RTE_LOG(ERR, EAL,
 				"Failed to get current mempolicy: %s. "
-				"Assuming MPOL_DEFAULT.\n", strerror(errno));
+				"Assuming MPOL_DEFAULT.\n", rte_strerror(errno));
 			oldpolicy = MPOL_DEFAULT;
 		}
 		for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
@@ -333,7 +333,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		fd = open(hf->filepath, O_CREAT | O_RDWR, 0600);
 		if (fd < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): open failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			goto out;
 		}
 
@@ -346,7 +346,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				MAP_SHARED | MAP_POPULATE, fd, 0);
 		if (virtaddr == MAP_FAILED) {
 			RTE_LOG(DEBUG, EAL, "%s(): mmap failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -379,7 +379,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): Locking file failed:%s \n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -397,7 +397,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		} else if (set_mempolicy(oldpolicy, oldmask->maskp,
 					 oldmask->size + 1) < 0) {
 			RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			numa_set_localalloc();
 		}
 	}
@@ -590,7 +590,7 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl,
 
 		if (hp->orig_va != NULL && unlink(hp->filepath)) {
 			RTE_LOG(WARNING, EAL, "%s(): Removing %s failed: %s\n",
-				__func__, hp->filepath, strerror(errno));
+				__func__, hp->filepath, rte_strerror(errno));
 		}
 	}
 	return 0;
@@ -640,7 +640,8 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl,
 						hp->orig_va = NULL;
 						if (unlink(hp->filepath) == -1) {
 							RTE_LOG(ERR, EAL, "%s(): Removing %s failed: %s\n",
-									__func__, hp->filepath, strerror(errno));
+								__func__, hp->filepath,
+								rte_strerror(errno));
 							return -1;
 						}
 					} else {
@@ -736,13 +737,13 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 		fd = open(hfile->filepath, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Could not open '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			return -1;
 		}
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "Could not lock '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -756,7 +757,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 				MAP_SHARED | MAP_POPULATE | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "Couldn't remap '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -1178,13 +1179,13 @@ eal_legacy_hugepage_init(void)
 		memfd = memfd_create("nohuge", 0);
 		if (memfd < 0) {
 			RTE_LOG(DEBUG, EAL, "Cannot create memfd: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 			RTE_LOG(DEBUG, EAL, "Falling back to anonymous map\n");
 		} else {
 			/* we got an fd - now resize it */
 			if (ftruncate(memfd, internal_conf->memory) < 0) {
 				RTE_LOG(ERR, EAL, "Cannot resize memfd: %s\n",
-						strerror(errno));
+						rte_strerror(errno));
 				RTE_LOG(ERR, EAL, "Falling back to anonymous map\n");
 				close(memfd);
 			} else {
@@ -1212,7 +1213,7 @@ eal_legacy_hugepage_init(void)
 				flags | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED || addr != prealloc_addr) {
 			RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			munmap(prealloc_addr, mem_sz);
 			return -1;
 		}
@@ -1571,7 +1572,7 @@ eal_legacy_hugepage_attach(void)
 		fd = open(hf->filepath, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Could not open %s: %s\n",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto error;
 		}
 
@@ -1579,14 +1580,14 @@ eal_legacy_hugepage_attach(void)
 				MAP_SHARED | MAP_FIXED, fd, 0);
 		if (map_addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "Could not map %s: %s\n",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto fd_error;
 		}
 
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): Locking file failed: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mmap_error;
 		}
 
@@ -1931,7 +1932,7 @@ rte_eal_memseg_init(void)
 
 		if (setrlimit(RLIMIT_NOFILE, &lim) < 0) {
 			RTE_LOG(DEBUG, EAL, "Setting maximum number of open files failed: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 		} else {
 			RTE_LOG(DEBUG, EAL, "Setting maximum number of open files to %"
 					PRIu64 "\n",
diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c
index 3a30284e3a..c80e87309c 100644
--- a/lib/eal/linux/eal_timer.c
+++ b/lib/eal/linux/eal_timer.c
@@ -146,7 +146,7 @@ rte_eal_hpet_init(int make_default)
 	fd = open(DEV_HPET, O_RDONLY);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "ERROR: Cannot open "DEV_HPET": %s!\n",
-			strerror(errno));
+			rte_strerror(errno));
 		internal_conf->no_hpet = 1;
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index ad3c1654b2..c18d4ee8ab 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -368,7 +368,7 @@ vfio_open_group_fd(int iommu_group_num)
 			/* if file not found, it's not an error */
 			if (errno != ENOENT) {
 				RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 				return -1;
 			}
 
@@ -381,7 +381,7 @@ vfio_open_group_fd(int iommu_group_num)
 				if (errno != ENOENT) {
 					RTE_LOG(ERR, EAL,
 						"Cannot open %s: %s\n",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 					return -1;
 				}
 				return -ENOENT;
@@ -791,7 +791,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status);
 	if (ret) {
 		RTE_LOG(ERR, EAL, "%s cannot get VFIO group status, "
-			"error %i (%s)\n", dev_addr, errno, strerror(errno));
+			"error %i (%s)\n", dev_addr, errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -819,7 +819,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"%s cannot add VFIO group to container, error "
-				"%i (%s)\n", dev_addr, errno, strerror(errno));
+				"%i (%s)\n", dev_addr, errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			rte_vfio_clear_group(vfio_group_fd);
 			return -1;
@@ -860,7 +860,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 				RTE_LOG(ERR, EAL,
 					"%s DMA remapping failed, error "
 					"%i (%s)\n",
-					dev_addr, errno, strerror(errno));
+					dev_addr, errno, rte_strerror(errno));
 				close(vfio_group_fd);
 				rte_vfio_clear_group(vfio_group_fd);
 				rte_mcfg_mem_read_unlock();
@@ -978,7 +978,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		RTE_LOG(ERR, EAL, "%s cannot get device info, "
 				"error %i (%s)\n", dev_addr, errno,
-				strerror(errno));
+				rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
@@ -1216,7 +1216,7 @@ vfio_set_iommu_type(int vfio_container_fd)
 		/* not an error, there may be more supported IOMMU types */
 		RTE_LOG(DEBUG, EAL, "Set IOMMU type %d (%s) failed, error "
 				"%i (%s)\n", t->type_id, t->name, errno,
-				strerror(errno));
+				rte_strerror(errno));
 	}
 	/* if we didn't find a suitable IOMMU type, fail */
 	return NULL;
@@ -1234,7 +1234,7 @@ vfio_has_supported_extensions(int vfio_container_fd)
 				t->type_id);
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL, "Could not get IOMMU type, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			close(vfio_container_fd);
 			return -1;
 		} else if (ret == 1) {
@@ -1274,7 +1274,7 @@ rte_vfio_get_container_fd(void)
 			RTE_LOG(ERR, EAL,
 					"Cannot open VFIO container %s, error "
 					"%i (%s)\n", VFIO_CONTAINER_PATH,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1284,7 +1284,7 @@ rte_vfio_get_container_fd(void)
 			if (ret < 0)
 				RTE_LOG(ERR, EAL,
 					"Could not get VFIO API version, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			else
 				RTE_LOG(ERR, EAL, "Unsupported VFIO API version!\n");
 			close(vfio_container_fd);
@@ -1416,7 +1416,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 			} else {
 				RTE_LOG(ERR, EAL,
 					"Cannot set up DMA remapping, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 				return -1;
 			}
 		}
@@ -1430,7 +1430,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot clear DMA remapping, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		} else if (dma_unmap.size != len) {
 			RTE_LOG(ERR, EAL, "Unexpected size %"PRIu64
@@ -1479,7 +1479,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"Cannot register vaddr for IOMMU, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1494,7 +1494,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot map vaddr for IOMMU, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1510,7 +1510,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot unmap vaddr for IOMMU, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1519,7 +1519,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"Cannot unregister vaddr for IOMMU, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -1704,7 +1704,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 	ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
 	if (ret) {
 		RTE_LOG(ERR, EAL, "Cannot get IOMMU info, error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1745,7 +1745,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */
 	if (ret) {
 		RTE_LOG(ERR, EAL, "Cannot create new DMA window, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 		RTE_LOG(ERR, EAL,
 			"Consider using a larger hugepage size if supported by the system\n");
 		return -1;
@@ -2006,7 +2006,7 @@ rte_vfio_noiommu_is_enabled(void)
 	if (fd < 0) {
 		if (errno != ENOENT) {
 			RTE_LOG(ERR, EAL, "Cannot open VFIO noiommu file "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 		/*
@@ -2020,7 +2020,7 @@ rte_vfio_noiommu_is_enabled(void)
 	close(fd);
 	if (cnt != 1) {
 		RTE_LOG(ERR, EAL, "Unable to read from VFIO noiommu file "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c
index afbab9368a..51b4d513f2 100644
--- a/lib/eal/unix/eal_filesystem.c
+++ b/lib/eal/unix/eal_filesystem.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_filesystem.h"
@@ -59,14 +60,14 @@ int eal_create_runtime_dir(void)
 	ret = mkdir(tmp, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
-			tmp, strerror(errno));
+			tmp, rte_strerror(errno));
 		return -1;
 	}
 
 	ret = mkdir(run_dir, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
-			run_dir, strerror(errno));
+			run_dir, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index 68ae93bd6e..d9652496df 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -32,7 +32,7 @@ mem_map(void *requested_addr, size_t size, int prot, int flags,
 		RTE_LOG(DEBUG, EAL,
 		    "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s\n",
 		    requested_addr, size, prot, flags, fd, offset,
-		    strerror(errno));
+		    rte_strerror(errno));
 		rte_errno = errno;
 		return NULL;
 	}
@@ -45,7 +45,7 @@ mem_unmap(void *virt, size_t size)
 	int ret = munmap(virt, size);
 	if (ret < 0) {
 		RTE_LOG(DEBUG, EAL, "Cannot munmap(%p, 0x%zx): %s\n",
-			virt, size, strerror(errno));
+			virt, size, rte_strerror(errno));
 		rte_errno = errno;
 	}
 	return ret;
@@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump)
 	int ret = madvise(virt, size, flags);
 	if (ret) {
 		RTE_LOG(DEBUG, EAL, "madvise(%p, %#zx, %d) failed: %s\n",
-				virt, size, flags, strerror(rte_errno));
+				virt, size, flags, rte_strerror(rte_errno));
 		rte_errno = errno;
 	}
 	return ret;
diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c
index 36a21ab2f9..486fd72277 100644
--- a/lib/eal/unix/rte_thread.c
+++ b/lib/eal/unix/rte_thread.c
@@ -302,7 +302,7 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *))
 	err = pthread_key_create(&((*key)->thread_index), destructor);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_key_create failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		free(*key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -323,7 +323,7 @@ rte_thread_key_delete(rte_thread_key key)
 	err = pthread_key_delete(key->thread_index);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_key_delete failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		free(key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -345,7 +345,7 @@ rte_thread_value_set(rte_thread_key key, const void *value)
 	err = pthread_setspecific(key->thread_index, value);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_setspecific failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		rte_errno = ENOEXEC;
 		return -1;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 03/43] eventdev: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 02/43] eal: use rte strerror Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 04/43] latency: " Dengdui Huang
                       ` (39 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 6db03adf04..d45c2c899e 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1106,7 +1106,7 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data)
 		 */
 		if (err)
 			RTE_EDEV_LOG_ERR("Failed to enqueue interrupt"
-				" to ring: %s", strerror(-err));
+				" to ring: %s", rte_strerror(-err));
 		else
 			rte_eth_dev_rx_intr_disable(port_id, queue);
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 04/43] latency: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (2 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 03/43] eventdev: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 05/43] node: " Dengdui Huang
                       ` (38 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/latencystats/rte_latencystats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db..a395f9b3bc 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -265,7 +265,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
 		if (ret != 0) {
 			RTE_LOG(INFO, LATENCY_STATS,
 				"Error during getting device (port %u) info: %s\n",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
@@ -309,7 +309,7 @@ rte_latencystats_uninit(void)
 		if (ret != 0) {
 			RTE_LOG(INFO, LATENCY_STATS,
 				"Error during getting device (port %u) info: %s\n",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 05/43] node: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (3 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 04/43] latency: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 06/43] pdump: " Dengdui Huang
                       ` (37 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/node/kernel_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/node/kernel_tx.c b/lib/node/kernel_tx.c
index 27d1808c71..ab92f22cb9 100644
--- a/lib/node/kernel_tx.c
+++ b/lib/node/kernel_tx.c
@@ -36,7 +36,7 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t
 		sin.sin_addr.s_addr = ip4->dst_addr;
 
 		if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0)
-			node_err("kernel_tx", "Unable to send packets: %s\n", strerror(errno));
+			node_err("kernel_tx", "Unable to send packets: %s\n", rte_strerror(errno));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 06/43] pdump: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (4 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 05/43] node: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 07/43] power: " Dengdui Huang
                       ` (36 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/pdump/rte_pdump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 80b90c6f7d..7b7b87bbd1 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -340,7 +340,7 @@ set_pdump_rxtx_cbs(const struct pdump_request *p)
 		if (ret != 0) {
 			PDUMP_LOG(ERR,
 				"Error during getting device (port %u) info: %s\n",
-				port, strerror(-ret));
+				port, rte_strerror(-ret));
 			return ret;
 		}
 
@@ -410,7 +410,7 @@ pdump_server(const struct rte_mp_msg *mp_msg, const void *peer)
 	mp_resp.num_fds = 0;
 	if (rte_mp_reply(&mp_resp, peer) < 0) {
 		PDUMP_LOG(ERR, "failed to send to client:%s\n",
-			  strerror(rte_errno));
+			  rte_strerror(rte_errno));
 		return -1;
 	}
 
@@ -741,7 +741,7 @@ rte_pdump_stats(uint16_t port, struct rte_pdump_stats *stats)
 	if (ret != 0) {
 		PDUMP_LOG(ERR,
 			  "Error during getting device (port %u) info: %s\n",
-			  port, strerror(-ret));
+			  port, rte_strerror(-ret));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 07/43] power: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (5 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 06/43] pdump: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 08/43] telemetry: replace strerror Dengdui Huang
                       ` (35 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/power/guest_channel.c        | 7 ++++---
 lib/power/power_kvm_vm.c         | 3 ++-
 lib/power/power_pstate_cpufreq.c | 7 ++++---
 lib/power/rte_power_pmd_mgmt.c   | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index 7b2ae0b650..1484b384df 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -14,6 +14,7 @@
 
 #include <rte_log.h>
 #include <rte_power.h>
+#include <rte_errno.h>
 
 #include "guest_channel.h"
 
@@ -75,7 +76,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	fd = open(fd_path, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Unable to connect to '%s' with error "
-				"%s\n", fd_path, strerror(errno));
+				"%s\n", fd_path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -104,7 +105,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	if (ret != 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL,
 				"Error on channel '%s' communications test: %s\n",
-				fd_path, ret > 0 ? strerror(ret) :
+				fd_path, ret > 0 ? rte_strerror(ret) :
 				"channel not connected");
 		goto error;
 	}
@@ -184,7 +185,7 @@ int power_guest_channel_read_msg(void *pkt,
 		return -1;
 	} else if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Error occurred during poll function: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index 6a8109d449..bb9c9b95fe 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -5,6 +5,7 @@
 #include <string.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
@@ -82,7 +83,7 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 	if (ret == 0)
 		return 1;
 	RTE_LOG(DEBUG, POWER, "Error sending message: %s\n",
-			ret > 0 ? strerror(ret) : "channel not connected");
+			ret > 0 ? rte_strerror(ret) : "channel not connected");
 	return -1;
 }
 
diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 5ca5f60bcd..eeb0f3831b 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -13,6 +13,7 @@
 
 #include <rte_memcpy.h>
 #include <rte_stdatomic.h>
+#include <rte_errno.h>
 
 #include "rte_power_pmd_mgmt.h"
 #include "power_pstate_cpufreq.h"
@@ -83,7 +84,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (fd < 0) {
 		RTE_LOG(ERR, POWER, "Error opening '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		return fd;
 	}
 
@@ -91,7 +92,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (ret < 0) {
 		RTE_LOG(ERR, POWER, "Error reading '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		goto out;
 	}
 
@@ -99,7 +100,7 @@ power_read_turbo_pct(uint64_t *outVal)
 	*outVal = (uint64_t) strtol(val, &endptr, 10);
 	if (errno != 0 || (*endptr != 0 && *endptr != '\n')) {
 		RTE_LOG(ERR, POWER, "Error converting str to digits, read from %s: %s\n",
-				 POWER_SYSFILE_TURBO_PCT, strerror(errno));
+				 POWER_SYSFILE_TURBO_PCT, rte_strerror(errno));
 		ret = -1;
 		goto out;
 	}
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index 38f8384085..a61a5c8f98 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -574,7 +574,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
 	ret = queue_list_add(lcore_cfg, &qdata);
 	if (ret < 0) {
 		RTE_LOG(DEBUG, POWER, "Failed to add queue to list: %s\n",
-				strerror(-ret));
+				rte_strerror(-ret));
 		goto end;
 	}
 	/* new queue is always added last */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 08/43] telemetry: replace strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (6 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 07/43] power: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 09/43] vhost: use rte strerror Dengdui Huang
                       ` (34 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses strerror_r() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/telemetry/telemetry.c        | 28 ++++++++++++++++++++++------
 lib/telemetry/telemetry_legacy.c |  5 ++++-
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 92982842a8..27c19979fb 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -411,6 +411,9 @@ client_handler(void *sock_id)
 static void *
 socket_listener(void *socket)
 {
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
+
 	while (1) {
 		pthread_t th;
 		int rc;
@@ -433,8 +436,9 @@ socket_listener(void *socket)
 		rc = pthread_create(&th, NULL, s->fn,
 				    (void *)(uintptr_t)s_accepted);
 		if (rc != 0) {
+			(void)strerror_r(rc, err_buf, sizeof(err_buf));
 			TMTY_LOG(ERR, "Error with create client thread: %s\n",
-				 strerror(rc));
+				 err_buf);
 			close(s_accepted);
 			if (s->num_clients != NULL)
 				rte_atomic_fetch_sub_explicit(s->num_clients, 1,
@@ -467,9 +471,13 @@ unlink_sockets(void)
 static int
 create_socket(char *path)
 {
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
+
 	int sock = socket(AF_UNIX, SOCK_SEQPACKET, 0);
 	if (sock < 0) {
-		TMTY_LOG(ERR, "Error with socket creation, %s\n", strerror(errno));
+		(void)strerror_r(errno, err_buf, sizeof(err_buf));
+		TMTY_LOG(ERR, "Error with socket creation, %s\n", err_buf);
 		return -1;
 	}
 
@@ -499,14 +507,16 @@ create_socket(char *path)
 		TMTY_LOG(DEBUG, "Attempting unlink and retrying bind\n");
 		unlink(sun.sun_path);
 		if (bind(sock, (void *) &sun, sizeof(sun)) < 0) {
-			TMTY_LOG(ERR, "Error binding socket: %s\n", strerror(errno));
+			(void)strerror_r(errno, err_buf, sizeof(err_buf));
+			TMTY_LOG(ERR, "Error binding socket: %s\n", err_buf);
 			close(sock);
 			return -errno; /* if unlink failed, this will be -EADDRINUSE as above */
 		}
 	}
 
 	if (listen(sock, 1) < 0) {
-		TMTY_LOG(ERR, "Error calling listen for socket: %s\n", strerror(errno));
+		(void)strerror_r(errno, err_buf, sizeof(err_buf));
+		TMTY_LOG(ERR, "Error calling listen for socket: %s\n", err_buf);
 		unlink(sun.sun_path);
 		close(sock);
 		return -errno;
@@ -531,6 +541,8 @@ set_thread_name(pthread_t id __rte_unused, const char *name __rte_unused)
 static int
 telemetry_legacy_init(void)
 {
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
 	pthread_t t_old;
 	int rc;
 
@@ -552,8 +564,9 @@ telemetry_legacy_init(void)
 	}
 	rc = pthread_create(&t_old, NULL, socket_listener, &v1_socket);
 	if (rc != 0) {
+		(void)strerror_r(rc, err_buf, sizeof(err_buf));
 		TMTY_LOG(ERR, "Error with create legacy socket thread: %s\n",
-			 strerror(rc));
+			 err_buf);
 		close(v1_socket.sock);
 		v1_socket.sock = -1;
 		unlink(v1_socket.path);
@@ -570,7 +583,9 @@ telemetry_legacy_init(void)
 static int
 telemetry_v2_init(void)
 {
+#define ERR_BUFF_SZ 256
 	char spath[sizeof(v2_socket.path)];
+	char err_buf[ERR_BUFF_SZ] = {0};
 	pthread_t t_new;
 	short suffix = 0;
 	int rc;
@@ -606,8 +621,9 @@ telemetry_v2_init(void)
 	}
 	rc = pthread_create(&t_new, NULL, socket_listener, &v2_socket);
 	if (rc != 0) {
+		(void)strerror_r(rc, err_buf, sizeof(err_buf));
 		TMTY_LOG(ERR, "Error with create socket thread: %s\n",
-			 strerror(rc));
+			 err_buf);
 		close(v2_socket.sock);
 		v2_socket.sock = -1;
 		unlink(v2_socket.path);
diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c
index 4c1d1c353a..09e8d220ca 100644
--- a/lib/telemetry/telemetry_legacy.c
+++ b/lib/telemetry/telemetry_legacy.c
@@ -81,6 +81,8 @@ register_client(const char *cmd __rte_unused, const char *params,
 		char *buffer __rte_unused, int buf_len __rte_unused)
 {
 #ifndef RTE_EXEC_ENV_WINDOWS
+#define ERR_BUFF_SZ 256
+	char err_buf[ERR_BUFF_SZ] = {0};
 	pthread_t th;
 	char data[BUF_SIZE];
 	int fd;
@@ -117,8 +119,9 @@ register_client(const char *cmd __rte_unused, const char *params,
 	rc = pthread_create(&th, NULL, &legacy_client_handler,
 				(void *)(uintptr_t)fd);
 	if (rc != 0) {
+		(void)strerror_r(rc, err_buf, sizeof(err_buf));
 		fprintf(stderr, "Failed to create legacy client thread: %s\n",
-			strerror(rc));
+			err_buf);
 		close(fd);
 		return -1;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 09/43] vhost: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (7 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 08/43] telemetry: replace strerror Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 10/43] bpf: " Dengdui Huang
                       ` (33 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/vhost/socket.c     | 13 +++++++------
 lib/vhost/vduse.c      | 31 ++++++++++++++++---------------
 lib/vhost/vhost_user.c | 11 ++++++-----
 3 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 5882e44176..0b030222d6 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -16,6 +16,7 @@
 
 #include <rte_thread.h>
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 #include "vduse.h"
@@ -129,7 +130,7 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m
 	if (ret <= 0) {
 		if (ret)
 			VHOST_LOG_CONFIG(ifname, ERR, "recvmsg failed on fd %d (%s)\n",
-				sockfd, strerror(errno));
+				sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -200,7 +201,7 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f
 
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(ifname, ERR, "sendmsg error on fd %d (%s)\n",
-			sockfd, strerror(errno));
+			sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -358,7 +359,7 @@ create_unix_socket(struct vhost_user_socket *vsocket)
 	if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) {
 		VHOST_LOG_CONFIG(vsocket->path, ERR,
 			"vhost-user: can't set nonblocking mode for socket, fd: %d (%s)\n",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -392,7 +393,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket)
 	ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(path, ERR, "failed to bind: %s; remove it and try again\n",
-			strerror(errno));
+			rte_strerror(errno));
 		goto err;
 	}
 	VHOST_LOG_CONFIG(path, INFO, "binding succeeded\n");
@@ -445,7 +446,7 @@ vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz)
 	flags = fcntl(fd, F_GETFL, 0);
 	if (flags < 0) {
 		VHOST_LOG_CONFIG(path, ERR, "can't get flags for connfd %d (%s)\n",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		return -2;
 	}
 	if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) {
@@ -539,7 +540,7 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
 		return 0;
 	}
 
-	VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", strerror(errno));
+	VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", rte_strerror(errno));
 
 	if (ret == -2 || !vsocket->reconnect) {
 		close(fd);
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index 080b58f7de..e2e056754c 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -17,6 +17,7 @@
 
 #include <rte_common.h>
 #include <rte_thread.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 #include "iotlb.h"
@@ -135,7 +136,7 @@ vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &buf, sizeof(buf));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read control queue event: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -157,7 +158,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_GET_INFO, &vq_info);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get VQ %u info: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		return;
 	}
 
@@ -183,7 +184,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	vq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (vq->kickfd < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to init kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		vq->kickfd = VIRTIO_INVALID_EVENTFD;
 		return;
 	}
@@ -213,7 +214,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to setup kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		close(vq->kickfd);
 		vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
 		return;
@@ -224,7 +225,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 		if (ret) {
 			VHOST_LOG_CONFIG(dev->ifname, ERR,
 					"Failed to setup kickfd handler for VQ %u: %s\n",
-					index, strerror(errno));
+					index, rte_strerror(errno));
 			vq_efd.fd = VDUSE_EVENTFD_DEASSIGN;
 			ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 			close(vq->kickfd);
@@ -254,7 +255,7 @@ vduse_vring_cleanup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret)
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 
 	close(vq->kickfd);
 	vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
@@ -291,7 +292,7 @@ vduse_device_start(struct virtio_net *dev)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_DEV_GET_FEATURES, &dev->features);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get features: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -358,7 +359,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &req, sizeof(req));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read request: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	} else if (ret < (int)sizeof(req)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Incomplete to read request %d\n", ret);
@@ -400,7 +401,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = write(dev->vduse_dev_fd, &resp, sizeof(resp));
 	if (ret != sizeof(resp)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to write response %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -453,13 +454,13 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	control_fd = open(VDUSE_CTRL_PATH, O_RDWR);
 	if (control_fd < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to open %s: %s\n",
-				VDUSE_CTRL_PATH, strerror(errno));
+				VDUSE_CTRL_PATH, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(control_fd, VDUSE_SET_API_VERSION, &ver)) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to set API version: %" PRIu64 ": %s\n",
-				ver, strerror(errno));
+				ver, rte_strerror(errno));
 		ret = -1;
 		goto out_ctrl_close;
 	}
@@ -507,14 +508,14 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	ret = ioctl(control_fd, VDUSE_CREATE_DEV, dev_config);
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to create VDUSE device: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		goto out_free;
 	}
 
 	dev_fd = open(path, O_RDWR);
 	if (dev_fd < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to open device %s: %s\n",
-				path, strerror(errno));
+				path, rte_strerror(errno));
 		ret = -1;
 		goto out_dev_close;
 	}
@@ -522,7 +523,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	ret = fcntl(dev_fd, F_SETFL, O_NONBLOCK);
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to set chardev as non-blocking: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		goto out_dev_close;
 	}
 
@@ -625,7 +626,7 @@ vduse_device_destroy(const char *path)
 		ret = ioctl(dev->vduse_ctrl_fd, VDUSE_DESTROY_DEV, name);
 		if (ret)
 			VHOST_LOG_CONFIG(name, ERR, "Failed to destroy VDUSE device: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 		close(dev->vduse_ctrl_fd);
 		dev->vduse_ctrl_fd = -1;
 	}
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index e36312181a..ebf5afe45d 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -772,7 +772,8 @@ mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz)
 
 	if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) {
 		rte_log(RTE_LOG_INFO, vhost_config_log_level,
-			"VHOST_CONFIG: could not set coredump preference (%s).\n", strerror(errno));
+			"VHOST_CONFIG: could not set coredump preference (%s).\n",
+			rte_strerror(errno));
 	}
 #endif
 }
@@ -1138,7 +1139,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev,
 			(uint64_t)reg_struct.range.start +
 			(uint64_t)reg_struct.range.len - 1,
 			dev->postcopy_ufd,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -1267,7 +1268,7 @@ vhost_user_mmap_region(struct virtio_net *dev,
 			MAP_SHARED | populate, region->fd, 0);
 
 	if (mmap_addr == MAP_FAILED) {
-		VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", strerror(errno));
+		VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -2698,7 +2699,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (dev->postcopy_ufd == -1) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR,
 			"userfaultfd not available: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		return RTE_VHOST_MSG_RESULT_ERR;
 	}
 	api_struct.api = UFFD_API;
@@ -2706,7 +2707,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR,
 			"UFFDIO_API ioctl failure: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dev->postcopy_ufd);
 		dev->postcopy_ufd = -1;
 		return RTE_VHOST_MSG_RESULT_ERR;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 10/43] bpf: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (8 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 09/43] vhost: use rte strerror Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 11/43] bus/cdx: " Dengdui Huang
                       ` (32 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/bpf/bpf_load_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bpf/bpf_load_elf.c b/lib/bpf/bpf_load_elf.c
index 02a5d8ba0d..6fc7018ddf 100644
--- a/lib/bpf/bpf_load_elf.c
+++ b/lib/bpf/bpf_load_elf.c
@@ -310,7 +310,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	if (fd < 0) {
 		rc = errno;
 		RTE_BPF_LOG(ERR, "%s(%s) error code: %d(%s)\n",
-			__func__, fname, rc, strerror(rc));
+			__func__, fname, rc, rte_strerror(rc));
 		rte_errno = EINVAL;
 		return NULL;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 11/43] bus/cdx: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (9 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 10/43] bpf: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 12/43] bus/dpaa: " Dengdui Huang
                       ` (31 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/cdx/cdx.c      |  2 +-
 drivers/bus/cdx/cdx_vfio.c | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 541aae76c3..a3161f8ee4 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -271,7 +271,7 @@ cdx_scan(void)
 	dir = opendir(RTE_CDX_BUS_DEVICES_PATH);
 	if (dir == NULL) {
 		CDX_BUS_INFO("%s(): opendir failed: %s", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 8a3ac0b995..6fb38abfac 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -20,6 +20,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "bus_cdx_driver.h"
 #include "cdx_logs.h"
@@ -198,7 +199,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			CDX_BUS_ERR("Cannot get VFIO IRQ info, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -216,7 +217,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			CDX_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -252,7 +253,7 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd,
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		CDX_BUS_ERR("Unable to reset device! Error: %d (%s)", errno,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -410,7 +411,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s cannot get device region info error %i (%s)",
-				dev_name, errno, strerror(errno));
+				dev_name, errno, rte_strerror(errno));
 			goto err_vfio_res;
 		}
 
@@ -438,7 +439,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, 0);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping region %i failed: %s",
-				cdx_addr, i, strerror(errno));
+				cdx_addr, i, rte_strerror(errno));
 			free(reg);
 			goto err_vfio_res;
 		}
@@ -506,7 +507,7 @@ cdx_vfio_map_resource_secondary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping MMIO region %i failed: %s",
-				dev_name, i, strerror(errno));
+				dev_name, i, rte_strerror(errno));
 			goto err_vfio_dev_fd;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 12/43] bus/dpaa: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (10 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 11/43] bus/cdx: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 13/43] bus/fslmc: " Dengdui Huang
                       ` (30 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 2 +-
 drivers/bus/dpaa/dpaa_bus.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 1814372a40..fe694e447c 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -725,7 +725,7 @@ fman_finish(void)
 		if (unlikely(_errno < 0))
 			fprintf(stderr, "%s:%d:%s(): munmap() = %d (%s)\n",
 				__FILE__, __LINE__, __func__,
-				-errno, strerror(errno));
+				-errno, rte_strerror(errno));
 		printf("Tearing down %s\n", __if->node_path);
 		list_del(&__if->__if.node);
 		rte_free(__if);
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e57159f5d8..ea80168b7c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -605,7 +605,7 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		DPAA_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return errno;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 13/43] bus/fslmc: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (11 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 12/43] bus/dpaa: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 14/43] bus/pci: " Dengdui Huang
                       ` (29 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 5966776a85..1cbbcf9019 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -481,7 +481,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get group status, "
 				"error %i (%s)\n", dev_addr,
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -504,7 +504,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			DPAA2_BUS_ERR("  %s cannot add VFIO group to container, "
 					"error %i (%s)\n", dev_addr,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			close(vfio_container_fd);
 			rte_vfio_clear_group(vfio_group_fd);
@@ -551,7 +551,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info);
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get device info, error %i (%s)",
-				dev_addr, errno, strerror(errno));
+				dev_addr, errno, rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		close(vfio_container_fd);
@@ -617,7 +617,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index)
 	if (ret) {
 		DPAA2_BUS_ERR("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)",
 			      rte_intr_fd_get(intr_handle), errno,
-			      strerror(errno));
+			      rte_strerror(errno));
 		return ret;
 	}
 
@@ -667,7 +667,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info);
 		if (ret < 0) {
 			DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)",
-				      i, errno, strerror(errno));
+				      i, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -682,7 +682,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				      errno, strerror(errno));
+				      errno, rte_strerror(errno));
 			return -1;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 14/43] bus/pci: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (12 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 13/43] bus/fslmc: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 15/43] bus/vdev: " Dengdui Huang
                       ` (28 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/pci/bsd/pci.c        |  8 ++++----
 drivers/bus/pci/linux/pci.c      |  7 ++++---
 drivers/bus/pci/linux/pci_uio.c  | 23 ++++++++++++-----------
 drivers/bus/pci/linux/pci_vfio.c | 23 ++++++++++++-----------
 drivers/bus/pci/pci_common_uio.c |  3 ++-
 5 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 27f12590d4..ce08372931 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -125,7 +125,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
 	if (rte_intr_fd_get(dev->intr_handle) < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -169,7 +169,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
 	if (maps[map_idx].path == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -179,7 +179,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+				devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -353,7 +353,7 @@ rte_pci_scan(void)
 		unsigned i;
 		if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
 			RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 			goto error;
 		}
 
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 3d237398d9..7d870b43d2 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -12,6 +12,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -455,7 +456,7 @@ rte_pci_scan(void)
 	dir = opendir(rte_pci_get_sysfs_path());
 	if (dir == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -506,7 +507,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev)
 			return true;
 
 		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return false;
 	}
 
@@ -557,7 +558,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
 
 	if (fp == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return ret;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 97d740dfe5..2ee0179ea2 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -21,6 +21,7 @@
 #include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
@@ -111,7 +112,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
 	ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);
 	if (ret != 0) {
 		RTE_LOG(ERR, EAL, "%s(): mknod() failed %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -241,7 +242,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -254,7 +255,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	uio_cfg_fd = open(cfgname, O_RDWR);
 	if (uio_cfg_fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			cfgname, strerror(errno));
+			cfgname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -314,7 +315,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0);
 	if (maps[map_idx].path == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -348,7 +349,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 		fd = open(devname, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+				devname, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -404,7 +405,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot open sysfs resource: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -446,7 +447,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
 		if (uio_num < 0) {
 			RTE_LOG(ERR, EAL, "cannot open %s: %s\n",
-				dirname, strerror(errno));
+				dirname, rte_strerror(errno));
 			goto error;
 		}
 
@@ -454,7 +455,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		fd = open(filename, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				filename, strerror(errno));
+				filename, rte_strerror(errno));
 			goto error;
 		}
 		if (rte_intr_fd_set(dev->intr_handle, fd))
@@ -494,7 +495,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot open sysfs resource: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 	for (i = 0; i < bar + 1; i++) {
@@ -518,7 +519,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	fd = open(filename, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", filename,
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE,
@@ -526,7 +527,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	close(fd);
 	if (addr == MAP_FAILED) {
 		RTE_LOG(ERR, EAL, "Cannot mmap IO port resource: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 3f3201daf2..671b0f36bc 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -21,6 +21,7 @@
 #include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -225,7 +226,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL, "Cannot get VFIO IRQ info, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -252,7 +253,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot set up eventfd, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -336,7 +337,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot set up eventfd, error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -460,7 +461,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -742,7 +743,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd,
 		ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			RTE_LOG(DEBUG, EAL, "%s cannot get device region info error %i (%s)\n",
-				dev->name, errno, strerror(errno));
+				dev->name, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -811,7 +812,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		VFIO_PCI_CONFIG_REGION_INDEX);
 	if (ret < 0) {
 		RTE_LOG(ERR, EAL, "%s cannot get device region info error %i (%s)\n",
-			dev->name, errno, strerror(errno));
+			dev->name, errno, rte_strerror(errno));
 		goto err_vfio_res;
 	}
 	pdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size;
@@ -851,7 +852,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL,
 				"%s cannot get device region info error "
-				"%i (%s)\n", pci_addr, errno, strerror(errno));
+				"%i (%s)\n", pci_addr, errno, rte_strerror(errno));
 			goto err_map;
 		}
 
@@ -914,7 +915,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -922,7 +923,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -1019,14 +1020,14 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		} else {
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		}
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index 76c661f054..5d59a90b33 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -15,6 +15,7 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -44,7 +45,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 			fd = open(uio_res->maps[i].path, O_RDWR);
 			if (fd < 0) {
 				RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-					uio_res->maps[i].path, strerror(errno));
+					uio_res->maps[i].path, rte_strerror(errno));
 				return -1;
 			}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 15/43] bus/vdev: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (13 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 14/43] bus/pci: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 16/43] bus/vmbus: " Dengdui Huang
                       ` (27 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/vdev/vdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7974b27295..bdb5fa8fce 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -432,7 +432,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 			strlcpy(ou->name, devname, RTE_DEV_NAME_MAX_LEN);
 			if (rte_mp_sendmsg(&mp_resp) < 0)
 				VDEV_LOG(ERR, "send vdev, %s, failed, %s",
-					 devname, strerror(rte_errno));
+					 devname, rte_strerror(rte_errno));
 			num++;
 		}
 		rte_spinlock_recursive_unlock(&vdev_device_list_lock);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 16/43] bus/vmbus: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (14 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 15/43] bus/vdev: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 17/43] common/cnxk: " Dengdui Huang
                       ` (26 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/vmbus/linux/vmbus_bus.c  |  7 ++++---
 drivers/bus/vmbus/linux/vmbus_uio.c  | 21 +++++++++++----------
 drivers/bus/vmbus/vmbus_common.c     |  4 ++--
 drivers/bus/vmbus/vmbus_common_uio.c |  3 ++-
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 01d8111b85..0c92c1d4dd 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -18,6 +18,7 @@
 #include <rte_memory.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "private.h"
@@ -50,7 +51,7 @@ parse_sysfs_uuid(const char *filename, rte_uuid_t uu)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s: %s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -92,7 +93,7 @@ get_sysfs_string(const char *filename, char *buf, size_t buflen)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s:%s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -350,7 +351,7 @@ rte_vmbus_scan(void)
 			return 0;
 
 		VMBUS_LOG(ERR, "opendir %s failed: %s",
-			  SYSFS_VMBUS_DEVICES, strerror(errno));
+			  SYSFS_VMBUS_DEVICES, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 26edef342d..5fce68d880 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -18,6 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
 #include <rte_string_fns.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -34,7 +35,7 @@ void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff)
 		  sizeof(onoff)) < 0) {
 		VMBUS_LOG(ERR, "cannot write to %d:%s",
 			  rte_intr_fd_get(dev->intr_handle),
-			  strerror(errno));
+			  rte_strerror(errno));
 	}
 }
 
@@ -51,7 +52,7 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev)
 	if (cc < (int)sizeof(count)) {
 		if (cc < 0) {
 			VMBUS_LOG(ERR, "IRQ read failed %s",
-				  strerror(errno));
+				  rte_strerror(errno));
 			return -errno;
 		}
 		VMBUS_LOG(ERR, "can't read IRQ count");
@@ -91,7 +92,7 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -158,7 +159,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -256,13 +257,13 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
 	fd = open(ring_path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		return -errno;
 	}
 
 	if (fstat(fd, &sb) < 0) {
 		VMBUS_LOG(ERR, "Cannot state %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		close(fd);
 		return -errno;
 	}
@@ -342,7 +343,7 @@ static int vmbus_uio_sysfs_read(const char *dir, const char *name,
 	f = fopen(path, "r");
 	if (!f) {
 		VMBUS_LOG(ERR, "can't open %s:%s",
-			  path, strerror(errno));
+			  path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -404,7 +405,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 	chan_dir = opendir(chan_path);
 	if (!chan_dir) {
 		VMBUS_LOG(ERR, "cannot open %s: %s",
-			  chan_path, strerror(errno));
+			  chan_path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -441,7 +442,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &subid, UINT16_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no subchannel_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
@@ -452,7 +453,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &monid, UINT8_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no monitor_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index b9139c6e6c..e1a80c9587 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -38,7 +38,7 @@ vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 		VMBUS_LOG(ERR,
 			  "mmap(%d, %p, %zu, %ld) failed: %s",
 			  fd, requested_addr, size, (long)offset,
-			  strerror(errno));
+			  rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory mapped at %p",
 			  mapaddr);
@@ -57,7 +57,7 @@ vmbus_unmap_resource(void *requested_addr, size_t size)
 	if (munmap(requested_addr, size)) {
 		VMBUS_LOG(ERR, "munmap(%p, 0x%lx) failed: %s",
 			requested_addr, (unsigned long)size,
-			strerror(errno));
+			rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory unmapped at %p",
 			  requested_addr);
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 4d4613513c..54c1187026 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -14,6 +14,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -56,7 +57,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 17/43] common/cnxk: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (15 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 16/43] bus/vmbus: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 18/43] common/mlx5: " Dengdui Huang
                       ` (25 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/common/cnxk/roc_dev.c   | 4 +++-
 drivers/common/cnxk/roc_model.c | 4 +++-
 drivers/common/cnxk/roc_utils.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index e7e89bf3d6..812e6890f0 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -8,6 +8,8 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -1313,7 +1315,7 @@ dev_lmt_setup(struct dev *dev)
 	mz = plt_lmt_region_reserve_aligned(name, LMT_REGION_SIZE,
 					    LMT_REGION_SIZE);
 	if (!mz) {
-		plt_err("Memory alloc failed: %s", strerror(errno));
+		plt_err("Memory alloc failed: %s", rte_strerror(errno));
 		goto fail;
 	}
 
diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index 6dc2afe7f0..647af4b7ab 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -6,6 +6,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -154,7 +156,7 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass)
 	dir = opendir(SYSFS_PCI_DEVICES);
 	if (dir == NULL) {
 		plt_err("%s(): opendir failed: %s\n", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return -errno;
 	}
 
diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c
index 9af2ae9b69..418cd6b477 100644
--- a/drivers/common/cnxk/roc_utils.c
+++ b/drivers/common/cnxk/roc_utils.c
@@ -2,6 +2,8 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -245,7 +247,7 @@ roc_error_msg_get(int errorcode)
 		 * Handle general error (as defined in linux errno.h)
 		 */
 		if (abs(errorcode) < 300)
-			err_msg = strerror(abs(errorcode));
+			err_msg = rte_strerror(abs(errorcode));
 		else
 			err_msg = "Unknown error code";
 		break;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 18/43] common/mlx5: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (16 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 17/43] common/cnxk: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 19/43] crypto/caam_jr: " Dengdui Huang
                       ` (24 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/common/mlx5/linux/mlx5_nl.c  | 12 ++++++------
 drivers/common/mlx5/mlx5_common.c    |  6 +++---
 drivers/common/mlx5/mlx5_devx_cmds.c |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index 28a1f56dba..1de867089f 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -547,7 +547,7 @@ mlx5_nl_mac_addr_list(int nlsk_fd, unsigned int iface_idx,
 	return 0;
 error:
 	DRV_LOG(DEBUG, "Interface %u cannot retrieve MAC address list %s",
-		iface_idx, strerror(rte_errno));
+		iface_idx, rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -617,7 +617,7 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s MAC address %s %s",
 			iface_idx,
-			add ? "add" : "remove", m, strerror(rte_errno));
+			add ? "add" : "remove", m, rte_strerror(rte_errno));
 	}
 #endif
 	return -rte_errno;
@@ -704,7 +704,7 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		RTE_ETHER_ADDR_PRT_FMT " : %s",
 		vf_index,
 		RTE_ETHER_ADDR_BYTES(mac),
-		strerror(rte_errno));
+		rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -929,7 +929,7 @@ mlx5_nl_promisc(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s promisc mode: Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -956,7 +956,7 @@ mlx5_nl_allmulti(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s allmulti : Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -1934,7 +1934,7 @@ mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg)
 			if (errno == EINTR)
 				continue;
 			DRV_LOG(DEBUG, "Failed to receive netlink message: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return -rte_errno;
 		}
diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index ca8543e36e..7aafd0083d 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -762,7 +762,7 @@ mlx5_common_dev_create(struct rte_device *eal_dev, uint32_t classes,
 	ret = mlx5_common_config_get(mkvlist, &cdev->config);
 	if (ret < 0) {
 		DRV_LOG(ERR, "Failed to process device arguments: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		rte_free(cdev);
 		return NULL;
 	}
@@ -837,7 +837,7 @@ mlx5_common_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_common_config_get(mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
@@ -1011,7 +1011,7 @@ mlx5_common_dev_probe(struct rte_device *eal_dev)
 		if (ret) {
 			DRV_LOG(ERR,
 				"Probe again parameters aren't compatible : %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto class_err;
 		}
 	}
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 4d8818924a..b33b5d3044 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -640,7 +640,7 @@ mlx5_devx_cmd_match_sample_info_query(void *ctx, uint32_t sample_field_id,
 	rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 	if (rc) {
 		DRV_LOG(ERR, "Failed to query match sample info using DevX: %s",
-			strerror(rc));
+			rte_strerror(rc));
 		rte_errno = rc;
 		return -rc;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 19/43] crypto/caam_jr: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (17 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 18/43] common/mlx5: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 20/43] dma/idxd: " Dengdui Huang
                       ` (23 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 583ba3b523..b612407c41 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -17,6 +17,7 @@
 #include <rte_malloc.h>
 #include <rte_crypto.h>
 #include <rte_security.h>
+#include <rte_errno.h>
 
 #include <caam_jr_config.h>
 #include <caam_jr_hw_specific.h>
@@ -355,7 +356,7 @@ free_job_ring(int uio_fd)
 	if (munmap(job_ring->register_base_addr, job_ring->map_size)) {
 		CAAM_JR_INFO("cannot munmap(%p, 0x%lx): %s",
 			job_ring->register_base_addr,
-			(unsigned long)job_ring->map_size, strerror(errno));
+			(unsigned long)job_ring->map_size, rte_strerror(errno));
 	} else
 		CAAM_JR_DEBUG("JR UIO memory is unmapped");
 
@@ -419,7 +420,7 @@ sec_configure(void)
 	d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		printf("\nError opening directory '%s': %s\n",
-			SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 20/43] dma/idxd: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (18 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 19/43] crypto/caam_jr: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 21/43] net/af_packet: " Dengdui Huang
                       ` (22 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/dma/idxd/idxd_bus.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 3b2d4c2b65..d0919504af 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -16,6 +16,7 @@
 #include <rte_log.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_string_fns.h>
+#include <rte_errno.h>
 
 #include "idxd_internal.h"
 
@@ -145,7 +146,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	fd = open(sysfs_node, O_RDONLY);
 	if (fd < 0) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
@@ -153,7 +154,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	close(fd);
 	if (len < 0) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 	value[len] = '\0';
@@ -173,13 +174,13 @@ read_wq_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -200,13 +201,13 @@ read_device_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -317,7 +318,7 @@ dsa_scan(void)
 		if (errno == ENOENT)
 			return 0; /* no bus, return without error */
 		IDXD_PMD_ERR("%s(): opendir '%s' failed: %s",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 21/43] net/af_packet: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (19 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 20/43] dma/idxd: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 22/43] net/bnxt: " Dengdui Huang
                       ` (21 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 397a32db58..2f884d4b7f 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -108,7 +108,7 @@ RTE_LOG_REGISTER_DEFAULT(af_packet_logtype, NOTICE);
 
 #define PMD_LOG_ERRNO(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
-		"%s(): " fmt ":%s\n", __func__, ##args, strerror(errno))
+		"%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno))
 
 static uint16_t
 eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 22/43] net/bnxt: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (20 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 21/43] net/af_packet: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 23/43] net/af_xdp: " Dengdui Huang
                       ` (20 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 17 files changed, 360 insertions(+), 360 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 0e25207fc3..4212065b32 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -942,7 +942,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 	ret = bnxt_hwrm_port_clr_stats(bp);
 	if (ret != 0)
 		PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n",
-			    strerror(-ret));
+			    rte_strerror(-ret));
 
 	bnxt_clear_prev_stat(bp);
 
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 964a5aeb05..558085ec0c 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -149,7 +149,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -191,7 +191,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -249,7 +249,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -308,7 +308,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -365,7 +365,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -409,7 +409,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -600,7 +600,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -636,7 +636,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -670,7 +670,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -705,7 +705,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -744,7 +744,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -827,7 +827,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -871,7 +871,7 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 3a812bee3a..2c7ee09888 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -205,7 +205,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -215,7 +215,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -232,7 +232,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM insert failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -261,7 +261,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -271,7 +271,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -285,7 +285,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM delete failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -313,7 +313,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -323,7 +323,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -338,7 +338,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -347,7 +347,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -375,7 +375,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -385,7 +385,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -400,7 +400,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -409,7 +409,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -437,7 +437,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -456,7 +456,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -468,7 +468,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -497,7 +497,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -507,7 +507,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -516,7 +516,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -529,7 +529,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -566,7 +566,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -575,7 +575,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -589,7 +589,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier search failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -615,7 +615,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -625,7 +625,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -634,7 +634,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -656,7 +656,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -688,7 +688,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -707,7 +707,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -720,7 +720,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -748,7 +748,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -758,7 +758,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -768,7 +768,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -786,7 +786,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	TFP_DRV_LOG(DEBUG,
@@ -816,7 +816,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -826,7 +826,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -835,7 +835,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -853,7 +853,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_sz_in_bits = gparms.key_size * 8;
@@ -881,7 +881,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -891,7 +891,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -900,7 +900,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -935,7 +935,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -945,7 +945,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -954,7 +954,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -963,7 +963,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries move failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -986,7 +986,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -996,7 +996,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1005,7 +1005,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1014,7 +1014,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries clear failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1042,7 +1042,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1052,7 +1052,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1067,7 +1067,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1076,7 +1076,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: External table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1085,7 +1085,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1094,7 +1094,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1124,7 +1124,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1134,7 +1134,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1149,7 +1149,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1158,7 +1158,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1167,7 +1167,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1177,7 +1177,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1204,7 +1204,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1214,7 +1214,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1231,7 +1231,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1240,7 +1240,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}  else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1249,7 +1249,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1258,7 +1258,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1267,7 +1267,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1295,7 +1295,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1305,7 +1305,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	gparms.dir = parms->dir;
@@ -1320,7 +1320,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1329,7 +1329,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1338,7 +1338,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1366,7 +1366,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1376,7 +1376,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1393,7 +1393,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s, External table type not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 
 		return rc;
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1402,7 +1402,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table bulk get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		}
 		return rc;
 	}
@@ -1412,7 +1412,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1421,7 +1421,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Table get bulk failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -1442,7 +1442,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1452,7 +1452,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1463,7 +1463,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1472,7 +1472,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Get table increment not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1494,7 +1494,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1503,7 +1503,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1532,7 +1532,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1541,7 +1541,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1571,7 +1571,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1580,7 +1580,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1612,7 +1612,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1622,7 +1622,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1631,7 +1631,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1646,7 +1646,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1670,7 +1670,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1680,7 +1680,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1689,7 +1689,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1704,7 +1704,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1725,7 +1725,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1734,7 +1734,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1744,7 +1744,7 @@ int tf_get_session_info(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1752,14 +1752,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Ident get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tbl_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1767,14 +1767,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Tbl get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tcam_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1782,14 +1782,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "TCAM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_em_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1797,7 +1797,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -1861,7 +1861,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1870,7 +1870,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1901,7 +1901,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1911,7 +1911,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1943,7 +1943,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1952,7 +1952,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1984,7 +1984,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1993,7 +1993,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c
index c518150d1f..162bc275b9 100644
--- a/drivers/net/bnxt/tf_core/tf_em_common.c
+++ b/drivers/net/bnxt/tf_core/tf_em_common.c
@@ -51,7 +51,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (tfp_calloc(&parms) != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: external pool failure %s\n",
-			    tf_dir_2_str(dir), strerror(ENOMEM));
+			    tf_dir_2_str(dir), rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -61,7 +61,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (rc != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: stack init failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -78,7 +78,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 		rc = stack_push(pool, j);
 		if (rc != 0) {
 			TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-				    tf_dir_2_str(dir), strerror(-rc));
+				    tf_dir_2_str(dir), rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -93,7 +93,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 	if (!stack_is_full(pool)) {
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 	return 0;
@@ -921,7 +921,7 @@ tf_em_ext_common_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_ext_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -980,7 +980,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -989,7 +989,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -997,7 +997,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1157,7 +1157,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Map table scope operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1167,14 +1167,14 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 	data = aparms.mem_va;
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		rc = -ENOMEM;
 		goto clean;
 	}
@@ -1188,7 +1188,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map table scope config failure, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleaner;
 	}
 
@@ -1203,7 +1203,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map tbl scope, set failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 cleaner:
 	tfp_free(mask);
diff --git a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
index d72ac83295..fe9c710f26 100644
--- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
@@ -130,7 +130,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -165,7 +165,7 @@ tf_em_move_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c
index 9efffe4ee5..55d27b88a2 100644
--- a/drivers/net/bnxt/tf_core/tf_em_host.c
+++ b/drivers/net/bnxt/tf_core/tf_em_host.c
@@ -182,7 +182,7 @@ tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl)
 			TFP_DRV_LOG(WARNING,
 				"Failed to allocate page table: lvl: %d, rc:%s\n",
 				i,
-				strerror(-rc));
+				rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -379,7 +379,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -387,7 +387,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
@@ -396,7 +396,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EEM: PF query error rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -420,7 +420,7 @@ tf_em_ext_alloc(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			"Failed to allocate session table scope, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -436,7 +436,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to query for EEM capability,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 	}
@@ -456,7 +456,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to register for EEM ctx,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 
@@ -473,7 +473,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "TBL: Unable to configure EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -485,7 +485,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to enable EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -501,7 +501,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s TBL: Unable to allocate idx pools %s\n",
 				    tf_dir_2_str(dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 	}
@@ -547,7 +547,7 @@ tf_em_ext_free(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -555,7 +555,7 @@ tf_em_ext_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
index 46de63a9da..21cf19c45e 100644
--- a/drivers/net/bnxt/tf_core/tf_em_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
@@ -49,7 +49,7 @@ tf_em_insert_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -113,7 +113,7 @@ tf_em_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -153,7 +153,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -163,7 +163,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -202,7 +202,7 @@ tf_em_int_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -232,7 +232,7 @@ tf_em_int_bind(struct tf *tfp,
 				    "%s, EM Allocation must be in blocks of %d, failure %s\n",
 				    tf_dir_2_str(i),
 				    TF_SESSION_EM_ENTRY_SIZE,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 			return rc;
 		}
@@ -278,7 +278,7 @@ tf_em_int_bind(struct tf *tfp,
 				TFP_DRV_LOG(ERR,
 					 "%s, EM stack allocation failure %s\n",
 					 tf_dir_2_str(i),
-					 strerror(-rc));
+					 rte_strerror(-rc));
 				return rc;
 			}
 
diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c
index 3a8030a2fb..ba748fdc23 100644
--- a/drivers/net/bnxt/tf_core/tf_global_cfg.c
+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c
@@ -83,7 +83,7 @@ tf_global_cfg_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -141,7 +141,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -151,7 +151,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -185,7 +185,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -196,7 +196,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c
index 7d9d9595dd..21e60a8ad5 100644
--- a/drivers/net/bnxt/tf_core/tf_identifier.c
+++ b/drivers/net/bnxt/tf_core/tf_identifier.c
@@ -39,7 +39,7 @@ tf_ident_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "ident_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -124,7 +124,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -164,7 +164,7 @@ tf_ident_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -222,7 +222,7 @@ tf_ident_search(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c
index 578d361417..4d85b77b4e 100644
--- a/drivers/net/bnxt/tf_core/tf_if_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c
@@ -65,7 +65,7 @@ tf_if_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_if_tbl_set(struct tf *tfp,
 			    "%s, If Tbl set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -187,7 +187,7 @@ tf_if_tbl_get(struct tf *tfp,
 			    "%s, If Tbl get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c
index 1c66c7e01a..5e180813d8 100644
--- a/drivers/net/bnxt/tf_core/tf_msg.c
+++ b/drivers/net/bnxt/tf_core/tf_msg.c
@@ -216,7 +216,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -224,7 +224,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -291,7 +291,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -299,7 +299,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -361,7 +361,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -370,7 +370,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -378,7 +378,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(WARNING,
 			    "%s: QCAPS message size error, rc:%s, request %d vs response %d\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL),
+			    rte_strerror(EINVAL),
 			    size,
 			    resp.size);
 	}
@@ -498,7 +498,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -509,7 +509,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -559,7 +559,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -605,7 +605,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -616,7 +616,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -666,7 +666,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -712,7 +712,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -722,7 +722,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -731,7 +731,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -797,7 +797,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -807,7 +807,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -816,7 +816,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -830,7 +830,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -893,7 +893,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -903,7 +903,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -927,7 +927,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Record size to large, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -982,7 +982,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -992,7 +992,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1001,7 +1001,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1050,7 +1050,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1060,7 +1060,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1069,7 +1069,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1129,7 +1129,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1149,7 +1149,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 		rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n",
-				strerror(-rc));
+				rte_strerror(-rc));
 			return rc;
 		}
 
@@ -1180,7 +1180,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1189,7 +1189,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1231,7 +1231,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1240,7 +1240,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1284,7 +1284,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1293,7 +1293,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1334,7 +1334,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1345,7 +1345,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1401,7 +1401,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1411,7 +1411,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1465,7 +1465,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1475,7 +1475,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1534,7 +1534,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1544,7 +1544,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1585,7 +1585,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1594,7 +1594,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1664,7 +1664,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1673,7 +1673,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1705,7 +1705,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    parms->key_size,
 			    resp.key_size,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_size = resp.key_size;
@@ -1734,7 +1734,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1743,7 +1743,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(in_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1793,7 +1793,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1803,7 +1803,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1812,7 +1812,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1877,7 +1877,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1887,7 +1887,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1896,7 +1896,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -1964,7 +1964,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1974,7 +1974,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1983,7 +1983,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2043,7 +2043,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2053,7 +2053,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2062,7 +2062,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2082,7 +2082,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2140,7 +2140,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2150,7 +2150,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2159,7 +2159,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -2217,7 +2217,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2227,7 +2227,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2278,7 +2278,7 @@ tf_msg_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2366,7 +2366,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2375,7 +2375,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2383,7 +2383,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2421,7 +2421,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2430,7 +2430,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2438,7 +2438,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c
index 9b85f5397d..05d05befaa 100644
--- a/drivers/net/bnxt/tf_core/tf_rm.c
+++ b/drivers/net/bnxt/tf_core/tf_rm.c
@@ -1059,7 +1059,7 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db,
 			    "%s: Invalid pool for this type:%d, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
 			    tmp_subtype,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	*new_subtype = tmp_subtype;
@@ -1106,7 +1106,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Allocation failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc adjust of base index failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
index 253d716572..a1f9848aed 100644
--- a/drivers/net/bnxt/tf_core/tf_session.c
+++ b/drivers/net/bnxt/tf_core/tf_session.c
@@ -78,11 +78,11 @@ tf_session_create(struct tf *tfp,
 		if (rc == -EEXIST)
 			TFP_DRV_LOG(ERR,
 				    "Session is already open, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		else
 			TFP_DRV_LOG(ERR,
 				    "Open message send failed, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 		parms->open_cfg->session_id.id = TF_FW_SESSION_ID_INVALID;
 		return rc;
@@ -97,7 +97,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session info, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session = (struct tf_session_info *)cparms.mem_va;
@@ -111,7 +111,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session->core_data = cparms.mem_va;
@@ -154,7 +154,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -226,7 +226,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	if (tfp->session) {
 		tfp_free(tfp->session->core_data);
@@ -268,7 +268,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -289,7 +289,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to create client on session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -303,7 +303,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -320,7 +320,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session Firmware id lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -373,7 +373,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -405,7 +405,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Client destroy on FW Failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	ll_delete(&tfs->client_ll, &client->ll_entry);
@@ -435,7 +435,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to create session, ctrl_chan_name:%s, rc:%s\n",
 				    parms->open_cfg->ctrl_chan_name,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -457,7 +457,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 			      "Failed to create client on session 0x%x, rc:%s\n",
 			      parms->open_cfg->session_id.id,
-			      strerror(-rc));
+			      rte_strerror(-rc));
 			return rc;
 		}
 
@@ -480,7 +480,7 @@ tf_session_attach_session(struct tf *tfp __rte_unused,
 
 	TFP_DRV_LOG(ERR,
 		    "Attach not yet supported, rc:%s\n",
-		    strerror(-rc));
+		    rte_strerror(-rc));
 	return rc;
 }
 
@@ -503,7 +503,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -511,7 +511,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid session id, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -531,7 +531,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Client not part of the session, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_session_close_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to unregister Client %d, rc:%s\n",
 				    client->session_client_id.id,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -576,7 +576,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Device lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -586,7 +586,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -596,7 +596,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Device unbind failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	rc = tf_msg_session_close(tfp, fw_session_id, mailbox);
@@ -604,7 +604,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	/* Final cleanup as we're last user of the session thus we
@@ -658,7 +658,7 @@ tf_session_get_session_internal(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -689,7 +689,7 @@ tf_session_get_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Internal FID lookup\n, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_session_get_session(struct tf *tfp,
 		TFP_DRV_LOG
 			(ERR,
 			"Ctrl channel not registered with session\n, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -810,7 +810,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -818,7 +818,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -842,7 +842,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -850,7 +850,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1152,7 +1152,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1160,7 +1160,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to set state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1169,7 +1169,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Set session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
@@ -1186,7 +1186,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1194,7 +1194,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to get state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1203,7 +1203,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Get session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_sram_mgr.c b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
index 87e8882fed..afbc3a3e46 100644
--- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c
+++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
@@ -494,7 +494,7 @@ static struct tf_sram_block
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate block, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return NULL;
 	}
 	block = (struct tf_sram_block *)cparms.mem_va;
@@ -588,7 +588,7 @@ tf_sram_mgr_bind(void **sram_handle)
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate SRAM mgmt data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	sram = (struct tf_sram *)cparms.mem_va;
@@ -628,7 +628,7 @@ tf_sram_mgr_unbind(void *sram_handle)
 					/* Log error */
 					TFP_DRV_LOG(ERR,
 						  "No SRAM slice list, rc:%s\n",
-						  strerror(-rc));
+						  rte_strerror(-rc));
 					return rc;
 				}
 				if (tf_sram_get_block_cnt(slice_list))
@@ -670,7 +670,7 @@ int tf_sram_mgr_alloc(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -759,7 +759,7 @@ tf_sram_mgr_free(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -781,7 +781,7 @@ tf_sram_mgr_free(void *sram_handle,
 	rc = tf_sram_free_slice(parms->slice_size, slice_offset,
 				block, &block_is_empty);
 	if (rc) {
-		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", strerror(-rc));
+		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", rte_strerror(-rc));
 		return rc;
 	}
 #if (STATS_CLEAR_ON_READ_SUPPORT == 0)
@@ -805,7 +805,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -821,7 +821,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -836,14 +836,14 @@ tf_sram_mgr_free(void *sram_handle,
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n",
-				    block_id, strerror(-rc));
+				    block_id, rte_strerror(-rc));
 		}
 		fparms.index = block_id + 1;
 		rc = tf_rm_free(&fparms);
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free next block_id(%d) failed error(%s)\n",
-				    block_id + 1, strerror(-rc));
+				    block_id + 1, rte_strerror(-rc));
 		}
 		/* Free local entry regardless */
 		tf_sram_free_block(slice_list, block);
@@ -937,7 +937,7 @@ int tf_sram_mgr_is_allocated(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
index f5f3889934..0fbcba6c76 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl.c
@@ -45,7 +45,7 @@ tf_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -195,7 +195,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -234,7 +234,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -250,7 +250,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -302,7 +302,7 @@ tf_tbl_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -341,7 +341,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -356,7 +356,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -393,7 +393,7 @@ tf_tbl_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -432,7 +432,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -449,7 +449,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -485,7 +485,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -517,7 +517,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_tbl_sram.c b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
index 3a6f1c68c7..39dbe11610 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
@@ -114,7 +114,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get hcapi_type %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->bank_id = tf_tbl_sram_hcapi_2_bank[hcapi_type];
@@ -129,7 +129,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get slice cnt %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (slices)
@@ -168,7 +168,7 @@ tf_tbl_sram_unbind(struct tf *tfp __rte_unused)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (sram_handle)
@@ -204,7 +204,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -214,7 +214,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -290,7 +290,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -299,7 +299,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -345,7 +345,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -417,7 +417,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -426,7 +426,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -489,7 +489,7 @@ tf_tbl_sram_set(struct tf *tfp,
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
 				    parms->idx,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			rc = -ENOMEM;
 			return rc;
 		}
@@ -504,7 +504,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -519,7 +519,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -553,7 +553,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -562,7 +562,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -592,7 +592,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -607,7 +607,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (parms->type == TF_TBL_TYPE_ACT_STATS_64)
@@ -626,7 +626,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -661,7 +661,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -670,7 +670,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -703,7 +703,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->starting_idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -716,7 +716,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -730,7 +730,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -751,7 +751,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	return rc;
 }
diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c
index 9e0671d47b..5924c5e6c1 100644
--- a/drivers/net/bnxt/tf_core/tf_tcam.c
+++ b/drivers/net/bnxt/tf_core/tf_tcam.c
@@ -57,7 +57,7 @@ tf_tcam_bind(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -91,7 +91,7 @@ tf_tcam_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tcam_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -301,7 +301,7 @@ tf_tcam_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -320,7 +320,7 @@ tf_tcam_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tcam_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -385,7 +385,7 @@ tf_tcam_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -417,7 +417,7 @@ tf_tcam_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -477,7 +477,7 @@ tf_tcam_free(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -515,7 +515,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -579,7 +579,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return 0;
@@ -618,7 +618,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -662,7 +662,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 23/43] net/af_xdp: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (21 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 22/43] net/bnxt: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 24/43] net/bonding: " Dengdui Huang
                       ` (19 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 353c8688ec..087b6e33db 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1165,7 +1165,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
 				&rxq->fq, &rxq->cq, &usr_config);
 		if (ret) {
 			AF_XDP_LOG(ERR, "Failed to create umem [%d]: [%s]\n",
-				   errno, strerror(errno));
+				   errno, rte_strerror(errno));
 			goto err;
 		}
 		umem->buffer = base_addr;
@@ -1367,7 +1367,7 @@ init_uds_sock(struct sockaddr_un *server)
 	if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) < 0) {
 		close(sock);
 		AF_XDP_LOG(ERR, "Error connecting stream socket errno = [%d]: [%s]\n",
-			   errno, strerror(errno));
+			   errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1451,7 +1451,7 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd)
 		return 0;
 
 	if (msglen < 0) {
-		AF_XDP_LOG(ERR, "recvmsg failed, %s\n", strerror(errno));
+		AF_XDP_LOG(ERR, "recvmsg failed, %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -1486,7 +1486,7 @@ make_request_cni(int sock, struct sockaddr_un *server, char *request,
 		rval = send_msg(sock, request, req_fd);
 
 	if (rval < 0) {
-		AF_XDP_LOG(ERR, "Write error %s\n", strerror(errno));
+		AF_XDP_LOG(ERR, "Write error %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -1970,7 +1970,7 @@ parse_prog_arg(const char *key __rte_unused,
 
 	if (access(value, F_OK) != 0) {
 		AF_XDP_LOG(ERR, "Error accessing %s: %s\n",
-			   value, strerror(errno));
+			   value, rte_strerror(errno));
 		return -EINVAL;
 	}
 
@@ -2421,7 +2421,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(ETH_AF_XDP_MP_KEY, afxdp_mp_send_fds);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			AF_XDP_LOG(ERR, "%s: Failed to register multi-process IPC callback: %s\n",
-				   name, strerror(rte_errno));
+				   name, rte_strerror(rte_errno));
 			return -1;
 		}
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 24/43] net/bonding: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (22 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 23/43] net/af_xdp: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 25/43] net/dpaa: " Dengdui Huang
                       ` (18 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/bonding/bonding_testpmd.c   | 4 ++--
 drivers/net/bonding/rte_eth_bond_api.c  | 2 +-
 drivers/net/bonding/rte_eth_bond_flow.c | 4 ++--
 drivers/net/bonding/rte_eth_bond_pmd.c  | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..111f9de0e7 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -551,7 +551,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mac_addr_set =
@@ -604,7 +604,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 99e496556a..1d20d421bc 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -483,7 +483,7 @@ __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s\n",
-			__func__, member_port_id, strerror(-ret));
+			__func__, member_port_id, rte_strerror(-ret));
 
 		return ret;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 71a91675f7..b7e966f393 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -31,7 +31,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -45,7 +45,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c40d18d128..fdf152a51a 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -192,7 +192,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s\n",
-			__func__, member_port, strerror(-ret));
+			__func__, member_port, rte_strerror(-ret));
 
 		return ret;
 	}
@@ -223,7 +223,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
 			RTE_BOND_LOG(ERR,
 				"%s: Error during getting device (port %u) info: %s\n",
 				__func__, bond_dev->data->port_id,
-				strerror(-ret));
+				rte_strerror(-ret));
 
 			return ret;
 		}
@@ -2292,7 +2292,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 					"%s: Error during getting device (port %u) info: %s\n",
 					__func__,
 					member.port_id,
-					strerror(-ret));
+					rte_strerror(-ret));
 
 				return ret;
 			}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 25/43] net/dpaa: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (23 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 24/43] net/bonding: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 26/43] net/dpaa2: " Dengdui Huang
                       ` (17 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/dpaa/dpaa_ethdev.c  | 4 ++--
 drivers/net/dpaa/fmlib/fm_lib.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index ef4c06db6a..214627986f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1080,7 +1080,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		ret = qman_init_fq(rxq, flags, &opts);
 		if (ret) {
 			DPAA_PMD_ERR("Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 			return ret;
 		}
 		if (dpaa_svr_family == SVR_LS1043A_FAMILY) {
@@ -1210,7 +1210,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev,
 	ret = qman_init_fq(rxq, flags, &opts);
 	if (ret) {
 		DPAA_PMD_ERR("Ev-Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 		return ret;
 	}
 
diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c
index 1d6816050c..d4382d7065 100644
--- a/drivers/net/dpaa/fmlib/fm_lib.c
+++ b/drivers/net/dpaa/fmlib/fm_lib.c
@@ -103,7 +103,7 @@ fm_get_api_version(t_handle h_fm, ioc_fm_api_version_t *p_version)
 	ret = ioctl(p_dev->fd, FM_IOC_GET_API_VERSION, p_version);
 	if (ret) {
 		DPAA_PMD_ERR("cannot get API version, error %i (%s)\n",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 	_fml_dbg("Finishing.\n");
@@ -276,7 +276,7 @@ fm_pcd_kg_scheme_set(t_handle h_fm_pcd,
 	ret = ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_SET, params);
 	if (ret) {
 		DPAA_PMD_ERR("  cannot set kg scheme, error %i (%s)\n",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return NULL;
 	}
 
@@ -310,7 +310,7 @@ fm_pcd_kg_scheme_delete(t_handle h_scheme)
 
 	if (ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_DELETE, &id)) {
 		DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)\n",
-			      errno, strerror(errno));
+			      errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 26/43] net/dpaa2: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (24 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 25/43] net/dpaa: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 27/43] net/enetfec: " Dengdui Huang
                       ` (16 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8e610b6bba..48f1a2fafb 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1166,7 +1166,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				irq_index, mask);
 	if (err < 0) {
 		DPAA2_PMD_ERR("Error: dpni_set_irq_mask():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 		return err;
 	}
 
@@ -1174,7 +1174,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				  irq_index, enable);
 	if (err < 0)
 		DPAA2_PMD_ERR("Error: dpni_set_irq_enable():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 
 	return err;
 }
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 27/43] net/enetfec: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (25 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 26/43] net/dpaa2: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 28/43] net/failsafe: " Dengdui Huang
                       ` (15 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/enetfec/enet_uio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/enetfec/enet_uio.c b/drivers/net/enetfec/enet_uio.c
index 6539cbb354..93520e9760 100644
--- a/drivers/net/enetfec/enet_uio.c
+++ b/drivers/net/enetfec/enet_uio.c
@@ -231,7 +231,7 @@ enetfec_configure(void)
 	d = opendir(FEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		ENETFEC_PMD_ERR("\nError opening directory '%s': %s\n",
-			FEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			FEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 28/43] net/failsafe: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (26 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 27/43] net/enetfec: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 29/43] net/i40e: " Dengdui Huang
                       ` (14 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/failsafe/failsafe.c         | 8 ++++----
 drivers/net/failsafe/failsafe_args.c    | 4 ++--
 drivers/net/failsafe/failsafe_eal.c     | 4 ++--
 drivers/net/failsafe/failsafe_flow.c    | 4 ++--
 drivers/net/failsafe/failsafe_ops.c     | 2 +-
 drivers/net/failsafe/failsafe_private.h | 6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 32811403b4..f89c946ce4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -92,7 +92,7 @@ failsafe_hotplug_alarm_cancel(struct rte_eth_dev *dev)
 	rte_eal_alarm_cancel(fs_hotplug_alarm, dev);
 	if (rte_errno) {
 		ERROR("rte_eal_alarm_cancel failed (errno: %s)",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		ret = -rte_errno;
 	} else {
 		PRIV(dev)->pending_alarm = 0;
@@ -138,18 +138,18 @@ fs_mutex_init(struct fs_priv *priv)
 
 	ret = pthread_mutexattr_init(&attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex attributes - %s", strerror(ret));
+		ERROR("Cannot initiate mutex attributes - %s", rte_strerror(ret));
 		return ret;
 	}
 	/* Allow mutex relocks for the thread holding the mutex. */
 	ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 	if (ret) {
-		ERROR("Cannot set mutex type - %s", strerror(ret));
+		ERROR("Cannot set mutex type - %s", rte_strerror(ret));
 		return ret;
 	}
 	ret = pthread_mutex_init(&priv->hotplug_mutex, &attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex - %s", strerror(ret));
+		ERROR("Cannot initiate mutex - %s", rte_strerror(ret));
 		return ret;
 	}
 	return 0;
diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c
index b203e02d9a..77169b7bbe 100644
--- a/drivers/net/failsafe/failsafe_args.c
+++ b/drivers/net/failsafe/failsafe_args.c
@@ -112,7 +112,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 	fp = popen(sdev->cmdline, "r");
 	if (fp == NULL) {
 		ret = -errno;
-		ERROR("popen: %s", strerror(errno));
+		ERROR("popen: %s", rte_strerror(errno));
 		return ret;
 	}
 	/* We only read one line */
@@ -131,7 +131,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 		ERROR("Parsing device '%s' failed", output);
 ret_pclose:
 	if (pclose(fp) == -1)
-		ERROR("pclose: %s", strerror(errno));
+		ERROR("pclose: %s", rte_strerror(errno));
 	return ret;
 }
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index d71b512f81..b06579692a 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -52,7 +52,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			if (ret < 0) {
 				ERROR("sub_device %d probe failed %s%s%s", i,
 				      rte_errno ? "(" : "",
-				      rte_errno ? strerror(rte_errno) : "",
+				      rte_errno ? rte_strerror(rte_errno) : "",
 				      rte_errno ? ")" : "");
 				continue;
 			}
@@ -100,7 +100,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner);
 			if (ret < 0) {
 				INFO("sub_device %d owner set failed (%s), "
-				     "will try again later", i, strerror(-ret));
+				     "will try again later", i, rte_strerror(-ret));
 				continue;
 			} else if (strncmp(rte_eth_devices[pid].device->name,
 				   da->name, strlen(da->name)) != 0) {
diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c
index 707e6c63b5..5d17182cc5 100644
--- a/drivers/net/failsafe/failsafe_flow.c
+++ b/drivers/net/failsafe/failsafe_flow.c
@@ -33,7 +33,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Unable to process flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -47,7 +47,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Failed to copy flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 35649b6244..40bea1d6bf 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -452,7 +452,7 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,
 #ifdef RTE_EXEC_ENV_LINUX
 	rxq->event_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (rxq->event_fd < 0) {
-		ERROR("Failed to create an eventfd: %s", strerror(errno));
+		ERROR("Failed to create an eventfd: %s", rte_strerror(errno));
 		fs_unlock(dev, 0);
 		return -errno;
 	}
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 53a451c1b1..5961222400 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -410,14 +410,14 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm)
 		ret = pthread_mutex_trylock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
 			DEBUG("Hot-plug mutex lock trying failed(%s), will try"
-			      " again later...", strerror(ret));
+			      " again later...", rte_strerror(ret));
 			return ret;
 		}
 		PRIV(dev)->alarm_lock = 1;
 	} else {
 		ret = pthread_mutex_lock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
-			ERROR("Cannot lock mutex(%s)", strerror(ret));
+			ERROR("Cannot lock mutex(%s)", rte_strerror(ret));
 			return ret;
 		}
 	}
@@ -439,7 +439,7 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm)
 	}
 	ret = pthread_mutex_unlock(&PRIV(dev)->hotplug_mutex);
 	if (ret)
-		ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret));
+		ERROR("Cannot unlock hot-plug mutex(%s)", rte_strerror(ret));
 }
 
 /*
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 29/43] net/i40e: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (27 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 28/43] net/failsafe: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 30/43] net/ice: " Dengdui Huang
                       ` (13 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/i40e/i40e_testpmd.c | 42 ++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index b6ef5d6e42..d0995531bc 100644
--- a/drivers/net/i40e/i40e_testpmd.c
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -53,7 +53,7 @@ cmd_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -148,7 +148,7 @@ cmd_region_flowtype_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "region flowtype config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -233,7 +233,7 @@ cmd_user_priority_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "user_priority region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -320,7 +320,7 @@ cmd_flush_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config flush error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -433,7 +433,7 @@ cmd_show_queue_region_info_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config info show error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -536,7 +536,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 							add);
 	if (ret < 0)
 		fprintf(stderr, "flow director config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	close_file(conf.input.packet);
 }
 
@@ -666,7 +666,7 @@ cmd_set_vf_promisc_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -745,7 +745,7 @@ cmd_set_vf_allmulti_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -825,7 +825,7 @@ cmd_set_vf_broadcast_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -908,7 +908,7 @@ cmd_set_vf_vlan_tag_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1013,7 +1013,7 @@ cmd_vf_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1108,7 +1108,7 @@ cmd_vf_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1158,7 +1158,7 @@ cmd_vf_tc_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1207,7 +1207,7 @@ cmd_strict_link_prio_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1928,7 +1928,7 @@ cmd_pctype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2000,7 +2000,7 @@ cmd_pctype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		return;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 		return;
 	}
 
@@ -2111,7 +2111,7 @@ cmd_pctype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2191,7 +2191,7 @@ cmd_ptype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 
 	if (!ret) {
@@ -2280,7 +2280,7 @@ cmd_ptype_mapping_replace_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2347,7 +2347,7 @@ cmd_ptype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2427,7 +2427,7 @@ cmd_ptype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 30/43] net/ice: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (28 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 29/43] net/i40e: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 31/43] net/ixgbe: " Dengdui Huang
                       ` (12 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/ice/ice_testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_testpmd.c b/drivers/net/ice/ice_testpmd.c
index a7a8d0c53c..e1392059e0 100644
--- a/drivers/net/ice/ice_testpmd.c
+++ b/drivers/net/ice/ice_testpmd.c
@@ -60,7 +60,7 @@ cmd_ddp_dump_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
@@ -127,7 +127,7 @@ cmd_ddp_dump_switch_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP switch runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 31/43] net/ixgbe: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (29 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 30/43] net/ice: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 32/43] net/memif: " Dengdui Huang
                       ` (11 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/ixgbe/ixgbe_testpmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_testpmd.c b/drivers/net/ixgbe/ixgbe_testpmd.c
index e0d161eafe..3c6d648844 100644
--- a/drivers/net/ixgbe/ixgbe_testpmd.c
+++ b/drivers/net/ixgbe/ixgbe_testpmd.c
@@ -141,7 +141,7 @@ cmd_set_vf_split_drop_en_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -243,7 +243,7 @@ cmd_set_macsec_offload_on_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -327,7 +327,7 @@ cmd_set_macsec_offload_off_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -402,7 +402,7 @@ cmd_set_macsec_sc_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -510,7 +510,7 @@ cmd_set_macsec_sa_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -599,7 +599,7 @@ cmd_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 32/43] net/memif: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (30 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 31/43] net/ixgbe: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 33/43] net/mlx4: " Dengdui Huang
                       ` (10 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/memif/memif_socket.c  |  4 ++--
 drivers/net/memif/rte_eth_memif.c | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 649f8d0e61..592b71979a 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -71,7 +71,7 @@ memif_msg_send_from_queue(struct memif_control_channel *cc)
 	size = memif_msg_send(rte_intr_fd_get(cc->intr_handle), &e->msg,
 			      e->fd);
 	if (size != sizeof(memif_msg_t)) {
-		MIF_LOG(ERR, "sendmsg fail: %s.", strerror(errno));
+		MIF_LOG(ERR, "sendmsg fail: %s.", rte_strerror(errno));
 		ret = -1;
 	} else {
 		MIF_LOG(DEBUG, "Sent msg type %u.", e->msg.type);
@@ -975,7 +975,7 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract, uid_t owner_u
 	return sock;
 
  error:
-	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, strerror(errno));
+	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, rte_strerror(errno));
 	if (sock != NULL) {
 		rte_intr_instance_free(sock->intr_handle);
 		rte_free(sock);
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 7cc8c0da91..f7697394f1 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -805,7 +805,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			     sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -960,7 +960,7 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 				     &a, sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -1082,27 +1082,27 @@ memif_region_init_shm(struct rte_eth_dev *dev, uint8_t has_buffers)
 
 	r->fd = memfd_create(shm_name, MFD_ALLOW_SEALING);
 	if (r->fd < 0) {
-		MIF_LOG(ERR, "Failed to create shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to create shm file: %s.", rte_strerror(errno));
 		ret = -1;
 		goto error;
 	}
 
 	ret = fcntl(r->fd, F_ADD_SEALS, F_SEAL_SHRINK);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	ret = ftruncate(r->fd, r->region_size);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to truncate shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to truncate shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	r->addr = mmap(NULL, r->region_size, PROT_READ |
 		       PROT_WRITE, MAP_SHARED, r->fd, 0);
 	if (r->addr == MAP_FAILED) {
-		MIF_LOG(ERR, "Failed to mmap shm region: %s.", strerror(ret));
+		MIF_LOG(ERR, "Failed to mmap shm region: %s.", rte_strerror(ret));
 		ret = -1;
 		goto error;
 	}
@@ -1223,7 +1223,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for tx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1247,7 +1247,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for rx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1299,7 +1299,7 @@ memif_connect(struct rte_eth_dev *dev)
 						MAP_SHARED, mr->fd, 0);
 				if (mr->addr == MAP_FAILED) {
 					MIF_LOG(ERR, "mmap failed: %s\n",
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			}
@@ -1983,7 +1983,7 @@ rte_pmd_memif_probe(struct rte_vdev_device *vdev)
 	 */
 	if (ret < 0 && rte_errno != EEXIST)
 		MIF_LOG(WARNING, "Failed to register mp action callback: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 
 	/* use abstract address by default */
 	flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 33/43] net/mlx4: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (31 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 32/43] net/memif: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 34/43] net/mlx5: " Dengdui Huang
                       ` (9 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/mlx4/mlx4.c        | 14 +++++++-------
 drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++---------
 drivers/net/mlx4/mlx4_rxq.c    | 10 +++++-----
 drivers/net/mlx4/mlx4_txq.c    | 10 +++++-----
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index a1a7e93288..f06a6fee6e 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -255,7 +255,7 @@ mlx4_dev_configure(struct rte_eth_dev *dev)
 	if (ret) {
 		ERROR("cannot set up internal flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto exit;
 	}
@@ -302,7 +302,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 	ret = mlx4_rss_init(priv);
 	if (ret) {
 		ERROR("%p: cannot initialize RSS resources: %s",
-		      (void *)dev, strerror(-ret));
+		      (void *)dev, rte_strerror(-ret));
 		goto err;
 	}
 #ifdef RTE_LIBRTE_MLX4_DEBUG
@@ -319,7 +319,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 		ERROR("%p: cannot attach flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
 		      (void *)dev,
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto err;
 	}
@@ -793,7 +793,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	err = mlx4_init_once();
 	if (err) {
 		ERROR("unable to init PMD global data: %s",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	MLX4_ASSERT(pci_drv == &mlx4_driver);
@@ -946,7 +946,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_glue->query_port(ctx, port, &port_attr);
 		if (err) {
 			err = ENODEV;
-			ERROR("port query failed: %s", strerror(err));
+			ERROR("port query failed: %s", rte_strerror(err));
 			goto port_error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -963,7 +963,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_fd_set_non_blocking(ctx->async_fd);
 		if (err) {
 			ERROR("cannot make asynchronous FD non-blocking: %s",
-			      strerror(err));
+			      rte_strerror(err));
 			goto port_error;
 		}
 		/* Allocate protection domain. */
@@ -1024,7 +1024,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_get_mac(priv, &mac.addr_bytes);
 		if (err) {
 			ERROR("cannot get MAC address, is mlx4_en loaded?"
-			      " (error: %s)", strerror(err));
+			      " (error: %s)", rte_strerror(err));
 			goto port_error;
 		}
 		INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index bb1dd33e7c..a1cd345aae 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -373,7 +373,7 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 
 	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      mode, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -462,7 +462,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 	ERROR("failed to synchronize flow rules after removing MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 }
 
@@ -501,7 +501,7 @@ mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	ERROR("failed to synchronize flow rules after adding MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -558,7 +558,7 @@ mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list,
 		return 0;
 	ERROR("failed to synchronize flow rules after modifying MC list,"
 	      " (code %d, \"%s\"), flow error type %d, cause %p, message: %s",
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -600,7 +600,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	      " (code %d, \"%s\"), "
 	      " flow error type %d, cause %p, message: %s",
 	      on ? "enabling" : "disabling", vlan_id,
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -807,7 +807,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	}
 	(void)wait_to_complete;
 	if (mlx4_ifreq(priv, SIOCGIFFLAGS, &ifr)) {
-		WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno));
+		WARN("ioctl(SIOCGIFFLAGS) failed: %s", rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	memset(&dev_link, 0, sizeof(dev_link));
@@ -816,7 +816,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	ifr.ifr_data = (void *)&edata;
 	if (mlx4_ifreq(priv, SIOCETHTOOL, &ifr)) {
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	link_speed = ethtool_cmd_speed(&edata);
@@ -858,7 +858,7 @@ mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -913,7 +913,7 @@ mlx4_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	ret = 0;
diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c
index 781ee256df..d0ec84201e 100644
--- a/drivers/net/mlx4/mlx4_rxq.c
+++ b/drivers/net/mlx4/mlx4_rxq.c
@@ -353,7 +353,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	if (ret) {
 		ERROR("cannot set up range size for RSS context to %u"
 		      " (for %u Rx queues), error: %s",
-		      1 << log2_range, dev->data->nb_rx_queues, strerror(ret));
+		      1 << log2_range, dev->data->nb_rx_queues, rte_strerror(ret));
 		rte_errno = ret;
 		return -ret;
 	}
@@ -431,7 +431,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	return 0;
 error:
 	ERROR("cannot initialize common RSS resources (queue %u): %s: %s",
-	      i, msg, strerror(ret));
+	      i, msg, rte_strerror(ret));
 	while (i--) {
 		struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i];
 
@@ -631,7 +631,7 @@ mlx4_rxq_attach(struct rxq *rxq)
 	--rxq->usecnt;
 	rte_errno = ret;
 	ERROR("error while attaching Rx queue %p: %s: %s",
-	      (void *)rxq, msg, strerror(ret));
+	      (void *)rxq, msg, rte_strerror(ret));
 	priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE;
 	return -ret;
 }
@@ -882,13 +882,13 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 			rte_errno = ENOMEM;
 			ERROR("%p: Rx interrupt completion channel creation"
 			      " failure: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 		if (mlx4_fd_set_non_blocking(rxq->channel->fd) < 0) {
 			ERROR("%p: unable to make Rx interrupt completion"
 			      " channel non-blocking: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 	}
diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c
index 0db2e55bef..f08c152d5e 100644
--- a/drivers/net/mlx4/mlx4_txq.c
+++ b/drivers/net/mlx4/mlx4_txq.c
@@ -411,7 +411,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->cq) {
 		rte_errno = ENOMEM;
 		ERROR("%p: CQ creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	qp_init_attr = (struct ibv_qp_init_attr){
@@ -431,7 +431,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->qp) {
 		rte_errno = errno ? errno : EINVAL;
 		ERROR("%p: QP creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	txq->max_inline = qp_init_attr.cap.max_inline_data;
@@ -445,7 +445,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_INIT failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -457,7 +457,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTR failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -469,7 +469,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTS failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Retrieve device queue information. */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 34/43] net/mlx5: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (32 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 33/43] net/mlx4: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:23     ` [PATCH v2 35/43] net/qede: " Dengdui Huang
                       ` (8 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c     |  2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c   | 20 ++++++++++----------
 drivers/net/mlx5/linux/mlx5_os.c          | 18 +++++++++---------
 drivers/net/mlx5/linux/mlx5_socket.c      | 16 ++++++++--------
 drivers/net/mlx5/linux/mlx5_verbs.c       |  8 ++++----
 drivers/net/mlx5/mlx5.c                   |  8 ++++----
 drivers/net/mlx5/mlx5_devx.c              |  4 ++--
 drivers/net/mlx5/mlx5_mac.c               |  2 +-
 drivers/net/mlx5/mlx5_rxmode.c            |  8 ++++----
 drivers/net/mlx5/mlx5_rxq.c               |  4 ++--
 drivers/net/mlx5/mlx5_rxtx.c              |  2 +-
 drivers/net/mlx5/mlx5_stats.c             |  4 ++--
 drivers/net/mlx5/mlx5_testpmd.c           | 14 +++++++-------
 drivers/net/mlx5/mlx5_trigger.c           | 12 ++++++------
 drivers/net/mlx5/mlx5_vlan.c              |  2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c |  2 +-
 drivers/net/mlx5/windows/mlx5_os.c        | 12 ++++++------
 17 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 4ea161eae6..e5247c1295 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -1421,7 +1421,7 @@ mlx5dr_match_template_create(const struct rte_flow_item items[],
 	if (ret <= 0) {
 		DR_LOG(ERR, "Unable to process items (%s): %s",
 		       error.message ? error.message : "unspecified",
-		       strerror(rte_errno));
+		       rte_strerror(rte_errno));
 		goto free_template;
 	}
 
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index dd5a0c546d..f2364ff44e 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -398,7 +398,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -435,7 +435,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 			DRV_LOG(WARNING,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GSET) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -490,7 +490,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -525,7 +525,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 			DRV_LOG(DEBUG,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GLINKSETTINGS) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -543,7 +543,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 		DRV_LOG(DEBUG,
 			"port %u ioctl(SIOCETHTOOL,"
 			"ETHTOOL_GLINKSETTINGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link.link_speed = (ecmd->speed == UINT32_MAX) ?
@@ -674,7 +674,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(WARNING,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:"
 			" %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -727,7 +727,7 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(WARNING,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 			" failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	return 0;
@@ -1209,7 +1209,7 @@ mlx5_get_module_info(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	modinfo->type = info.type;
@@ -1258,7 +1258,7 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret)
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	else
 		rte_memcpy(info->data, eeprom->data, info->length);
 	mlx5_free(eeprom);
@@ -1662,7 +1662,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, xstats_ctrl->base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	stats_ctrl->imissed = 0;
 free:
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 07f31de5ae..108de96cf7 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1176,7 +1176,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		err = mlx5_glue->query_port(sh->cdev->ctx, spawn->phys_port,
 					    &port_attr);
 		if (err) {
-			DRV_LOG(ERR, "port query failed: %s", strerror(err));
+			DRV_LOG(ERR, "port query failed: %s", rte_strerror(err));
 			goto error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -1191,7 +1191,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			spawn->phys_port);
 		if (err < 0) {
 			DRV_LOG(INFO, "Failed to get netlink port state: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			err = -rte_errno;
 			goto error;
 		}
@@ -1342,7 +1342,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -1433,7 +1433,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -1479,7 +1479,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -1973,7 +1973,7 @@ mlx5_device_bond_pci_match(const char *ibdev_name,
 					   bond_info->ifname);
 		if (ret)
 			DRV_LOG(ERR, "unable to get bond info: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 		else
 			DRV_LOG(INFO, "PF device %u, bond device %u(%s)",
 				ifindex, bond_info->ifindex, bond_info->ifname);
@@ -2688,7 +2688,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,
 			" encountering an error: %s",
 			owner_pci.domain, owner_pci.bus,
 			owner_pci.devid, owner_pci.function,
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		ret = -rte_errno;
 		/* Roll back. */
 		while (i--) {
@@ -2868,13 +2868,13 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "Unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	ret = mlx5_probe_again_args_validate(cdev, mkvlist);
 	if (ret) {
 		DRV_LOG(ERR, "Probe again parameters are not compatible : %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	if (mlx5_dev_is_pci(cdev->dev))
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 6ce0e59643..cfcbd5a099 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -61,13 +61,13 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	/* Accept the connection from the client. */
 	conn_sock = accept(server_socket, NULL, NULL);
 	if (conn_sock < 0) {
-		DRV_LOG(WARNING, "connection failed: %s", strerror(errno));
+		DRV_LOG(WARNING, "connection failed: %s", rte_strerror(errno));
 		return;
 	}
 	ret = recvmsg(conn_sock, &msg, MSG_WAITALL);
 	if (ret != sizeof(struct mlx5_flow_dump_req)) {
 		DRV_LOG(WARNING, "wrong message received: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 
@@ -138,7 +138,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0)
 		DRV_LOG(WARNING, "failed to send response %s",
-			strerror(errno));
+			rte_strerror(errno));
 error:
 	if (conn_sock >= 0)
 		close(conn_sock);
@@ -167,7 +167,7 @@ mlx5_pmd_socket_init(void)
 	ret = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "Failed to open mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	server_socket = ret;
@@ -183,13 +183,13 @@ mlx5_pmd_socket_init(void)
 	ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun));
 	if (ret < 0) {
 		DRV_LOG(WARNING,
-			"cannot bind mlx5 socket: %s", strerror(errno));
+			"cannot bind mlx5 socket: %s", rte_strerror(errno));
 		goto remove;
 	}
 	ret = listen(server_socket, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "cannot listen on mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	server_intr_handle = mlx5_os_interrupt_handler_create
@@ -197,7 +197,7 @@ mlx5_pmd_socket_init(void)
 		 server_socket, mlx5_pmd_socket_handle, NULL);
 	if (server_intr_handle == NULL) {
 		DRV_LOG(WARNING, "cannot register interrupt handler for mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	return 0;
@@ -207,7 +207,7 @@ mlx5_pmd_socket_init(void)
 	claim_zero(close(server_socket));
 	server_socket = -1;
 error:
-	DRV_LOG(ERR, "Cannot initialize socket: %s", strerror(errno));
+	DRV_LOG(ERR, "Cannot initialize socket: %s", rte_strerror(errno));
 	return -errno;
 }
 
diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index b54f3ccd9a..9d41f6fbdf 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -100,7 +100,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Tx QP state to RESET %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -111,7 +111,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE | IBV_QP_PORT);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -119,7 +119,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -127,7 +127,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 2cf21a1921..7f95c0db85 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1504,7 +1504,7 @@ mlx5_shared_dev_ctx_args_config(struct mlx5_dev_ctx_shared *sh,
 					  mlx5_dev_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process device arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -1756,7 +1756,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
 	err = mlx5_shared_dev_ctx_args_config(sh, mkvlist, &sh->config);
 	if (err) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	sh->refcnt = 1;
@@ -2716,7 +2716,7 @@ mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist,
 					  mlx5_port_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process port arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -2947,7 +2947,7 @@ mlx5_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_shared_dev_ctx_args_config(sh, mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 9fa400fc48..95bed87103 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -134,7 +134,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to RESET"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -146,7 +146,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to READY"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 22a756a52b..f73b7bc394 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -100,7 +100,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 		ret = mlx5_traffic_restart(dev);
 		if (ret)
 			DRV_LOG(ERR, "port %u cannot restart traffic: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 	}
 }
 
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index f44906e1a7..fae684defb 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -44,7 +44,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_enable() rollback
@@ -77,7 +77,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_disable() rollback
@@ -117,7 +117,7 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_enable() rollback
@@ -150,7 +150,7 @@ mlx5_allmulticast_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_disable() rollback
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 88b2dc54b3..341714965b 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -488,7 +488,7 @@ mlx5_rx_queue_stop_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RDY2RST);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to RESET:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -587,7 +587,7 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RST2RDY);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to READY:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 54d410b513..59e49aa5af 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -378,7 +378,7 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
 		ret = priv->obj_ops.rxq_obj_modify(rxq, sm->state);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Rx WQ state to %u  - %s",
-					sm->state, strerror(errno));
+					sm->state, rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 615e1d073d..d2a8b8e852 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -233,7 +233,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	stats_n = mlx5_os_get_stats_n(dev);
 	if (stats_n < 0) {
 		DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
-			strerror(-stats_n));
+			rte_strerror(-stats_n));
 		return stats_n;
 	}
 	if (xstats_ctrl->stats_n != stats_n)
@@ -251,7 +251,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, counters);
 	if (ret) {
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		mlx5_free(counters);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
index 403f3a8f83..70d4d0039f 100644
--- a/drivers/net/mlx5/mlx5_testpmd.c
+++ b/drivers/net/mlx5/mlx5_testpmd.c
@@ -199,13 +199,13 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	socket_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
 	if (socket_fd < 0) {
 		TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n",
-			    strerror(errno));
+			    rte_strerror(errno));
 		return -1;
 	}
 	rte_strlcpy(un.sun_path, path, sizeof(un.sun_path));
 	if (connect(socket_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		TESTPMD_LOG(ERR, "Failed to connect %s: %s\n", un.sun_path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -216,7 +216,7 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0) {
 		TESTPMD_LOG(ERR, "Failed to send request to (%s): %s\n", path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -333,7 +333,7 @@ static void cmd_port_host_shaper_parsed(void *parsed_result,
 		ret = mlx5_test_set_port_host_shaper(res->port_num, res->fr,
 					   res->rate_num);
 	if (ret < 0)
-		printf("cmd_port_host_shaper error: (%s)\n", strerror(-ret));
+		printf("cmd_port_host_shaper error: (%s)\n", rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_port_host_shaper_mlx5 =
@@ -492,7 +492,7 @@ mlx5_cmd_map_ext_rxq_parsed(void *parsed_result,
 			res->sw_queue_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -565,7 +565,7 @@ mlx5_cmd_unmap_ext_rxq_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -648,7 +648,7 @@ mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result,
 	if (ret < 0)
 		fprintf(stderr, "Fail to set flow_engine to %s mode with flag 0x%x, error %s\n",
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag,
-			strerror(-ret));
+			rte_strerror(-ret));
 	else
 		TESTPMD_LOG(DEBUG, "Set %d ports flow_engine to %s mode with flag 0x%x\n", ret,
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag);
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 7bdb897612..eecd39d8a7 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -1190,14 +1190,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 		ret = mlx5_dev_configure_rss_reta(dev);
 		if (ret) {
 			DRV_LOG(ERR, "port %u reta config failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
 	ret = mlx5_txpp_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx packet pacing init failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_devx_obj_ops_en(priv->sh) &&
@@ -1209,7 +1209,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_txq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (priv->config.std_delay_drop || priv->config.hp_delay_drop) {
@@ -1233,7 +1233,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_rxq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Rx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/*
@@ -1243,7 +1243,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_hairpin_auto_bind(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u hairpin auto binding failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Set started flag here for the following steps like control flow. */
@@ -1296,7 +1296,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_flow_start_default(dev);
 	if (ret) {
 		DRV_LOG(DEBUG, "port %u failed to start default actions: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_dev_ctx_shared_mempool_subscribe(dev) != 0) {
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index e7161b66fe..e2914844c6 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -118,7 +118,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
 	ret = priv->obj_ops.rxq_obj_modify_vlan_strip(rxq, on);
 	if (ret) {
 		DRV_LOG(ERR, "Port %u failed to modify object stripping mode:"
-			" %s", dev->data->port_id, strerror(rte_errno));
+			" %s", dev->data->port_id, rte_strerror(rte_errno));
 		return;
 	}
 	/* Update related bits in RX queue. */
diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
index a31e1b5494..9e31ad9be7 100644
--- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
@@ -212,7 +212,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	stats_ctrl->imissed = 0;
 }
 
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index b731bdff06..9afc240b46 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -379,7 +379,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	err = mlx5_glue->devx_init_showdown_event(sh->cdev->ctx);
 	if (err) {
 		DRV_LOG(ERR, "failed to init showdown event: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	/* Allocate private eth device data. */
@@ -427,7 +427,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -437,7 +437,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -480,7 +480,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s).",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -730,7 +730,7 @@ mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return rte_errno;
 	}
 	if (!rte_is_same_ether_addr(&lmac, mac)) {
@@ -849,7 +849,7 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	spawn.eth_dev = mlx5_dev_spawn(cdev->dev, &spawn, mkvlist);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 35/43] net/qede: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (33 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 34/43] net/mlx5: " Dengdui Huang
@ 2023-11-14 11:23     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 36/43] net/sfc: " Dengdui Huang
                       ` (7 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/qede/qede_regs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_regs.c b/drivers/net/qede/qede_regs.c
index d2ea1c9108..3aa31a42c2 100644
--- a/drivers/net/qede/qede_regs.c
+++ b/drivers/net/qede/qede_regs.c
@@ -221,7 +221,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (!f) {
 		fprintf(stderr, "Can't open file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		return 1;
 	}
 	bytes = fwrite(dump, 1, len, f);
@@ -234,7 +234,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (fclose(f)) {
 		fprintf(stderr, "Can't close file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		err = 1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 36/43] net/sfc: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (34 preceding siblings ...)
  2023-11-14 11:23     ` [PATCH v2 35/43] net/qede: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 37/43] net/tap: " Dengdui Huang
                       ` (6 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/sfc/sfc_flow.c        |  2 +-
 drivers/net/sfc/sfc_flow_tunnel.c |  2 +-
 drivers/net/sfc/sfc_mae.c         | 58 +++++++++++++++----------------
 3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 1b50aefe5c..304628026d 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -1403,7 +1403,7 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa,
 		rc = item->parse(pattern, parse_ctx, error);
 		if (rc != 0) {
 			sfc_err(sa, "failed to parse item %s: %s",
-				item->name, strerror(-rc));
+				item->name, rte_strerror(-rc));
 			return rc;
 		}
 
diff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c
index 889fee569a..898d00dd6d 100644
--- a/drivers/net/sfc/sfc_flow_tunnel.c
+++ b/drivers/net/sfc/sfc_flow_tunnel.c
@@ -120,7 +120,7 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa,
 		if (rc != 0) {
 			/* The loop above might have spotted wrong actions. */
 			sfc_err(sa, "FT: TUNNEL: invalid actions: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			goto fail;
 		}
 
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index e5ec0ae49d..accde9bcb0 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -429,7 +429,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 					       &fw_rsrc->rule_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable outer_rule=%p: %s",
-				rule, strerror(rc));
+				rule, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -446,7 +446,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 			fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't match on outer rule ID: %s", strerror(rc));
+		sfc_err(sa, "can't match on outer rule ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -485,7 +485,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 						  &invalid_rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "cannot restore match on invalid outer rule ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 		return;
 	}
 
@@ -504,7 +504,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable outer_rule=%p with OR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -618,7 +618,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 					    &fw_rsrc->mac_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable mac_addr=%p: %s",
-				mac_addr, strerror(rc));
+				mac_addr, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -644,7 +644,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 		}
 
 		sfc_err(sa, "cannot fill in MAC address entry ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 
 		return rc;
 	}
@@ -687,7 +687,7 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa,
 				mac_addr, fw_rsrc->mac_id.id);
 		} else {
 			sfc_err(sa, "failed to disable mac_addr=%p with MAC_ID=0x%08x: %s",
-				mac_addr, fw_rsrc->mac_id.id, strerror(rc));
+				mac_addr, fw_rsrc->mac_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -820,7 +820,7 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa,
 						  bounce_eh->size);
 		if (ret != 0) {
 			sfc_err(sa, "failed to update encap_header=%p: %s",
-				encap_header, strerror(ret));
+				encap_header, rte_strerror(ret));
 			rte_free(buf);
 			return ret;
 		}
@@ -861,7 +861,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 						&fw_rsrc->eh_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable encap_header=%p: %s",
-				encap_header, strerror(rc));
+				encap_header, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -875,7 +875,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 			fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't fill in encap. header ID: %s", strerror(rc));
+		sfc_err(sa, "can't fill in encap. header ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -918,7 +918,7 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa,
 				encap_header, fw_rsrc->eh_id.id);
 		} else {
 			sfc_err(sa, "failed to disable encap_header=%p with EH_ID=0x%08x: %s",
-				encap_header, fw_rsrc->eh_id.id, strerror(rc));
+				encap_header, fw_rsrc->eh_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -1023,7 +1023,7 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter,
 			}
 
 			sfc_err(sa, "cannot fill in counter ID: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -1067,7 +1067,7 @@ sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter)
 				counter, counter->type, counter_id);
 		} else {
 			sfc_err(sa, "failed to disable counter=%p with COUNTER_ID=0x%x-#%u: %s",
-				counter, counter->type, counter_id, strerror(rc));
+				counter, counter->type, counter_id, rte_strerror(rc));
 		}
 
 		fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -1242,7 +1242,7 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa,
 					      &fw_rsrc->aset_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set=%p: %s",
-				action_set, strerror(rc));
+				action_set, rte_strerror(rc));
 
 			sfc_mae_encap_header_disable(sa, encap_header);
 			sfc_mae_mac_addr_disable(sa, src_mac_addr);
@@ -1290,7 +1290,7 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa,
 				action_set, fw_rsrc->aset_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_set=%p with AS_ID=0x%08x: %s",
-				action_set, fw_rsrc->aset_id.id, strerror(rc));
+				action_set, fw_rsrc->aset_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->aset_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1446,7 +1446,7 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa,
 						&fw_rsrc->aset_list_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set_list=%p: %s",
-				action_set_list, strerror(rc));
+				action_set_list, rte_strerror(rc));
 			goto fail_action_set_list_alloc;
 		}
 
@@ -1499,7 +1499,7 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa,
 		} else {
 			sfc_err(sa, "failed to disable action_set_list=%p with ASL_ID=0x%08x: %s",
 				action_set_list, fw_rsrc->aset_list_id.id,
-				strerror(rc));
+				rte_strerror(rc));
 		}
 		fw_rsrc->aset_list_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1710,7 +1710,7 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa,
 					as_idp, &fw_rsrc->rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "failed to enable action_rule=%p: %s",
-			rule, strerror(rc));
+			rule, rte_strerror(rc));
 		goto fail_action_rule_insert;
 	}
 
@@ -1761,7 +1761,7 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_rule=%p with AR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -4398,7 +4398,7 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa,
 
 	rc = efx_mae_action_set_populate_mark(spec, conf->id);
 	if (rc != 0)
-		sfc_err(sa, "failed to request action MARK: %s", strerror(rc));
+		sfc_err(sa, "failed to request action MARK: %s", rte_strerror(rc));
 
 	return rc;
 }
@@ -4570,14 +4570,14 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa,
 	if (rc != 0) {
 		sfc_err(sa, "failed to convert PF %u VF %d to m-port: %s",
 			encp->enc_pf, (vf != EFX_PCI_VF_INVALID) ? (int)vf : -1,
-			strerror(rc));
+			rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4606,14 +4606,14 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
 					     port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			port_id, strerror(rc));
+			port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4632,14 +4632,14 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa,
 					     conf->port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4658,14 +4658,14 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa,
 					     conf->port_id, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4758,7 +4758,7 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa,
 
 			if (action_name != NULL) {
 				sfc_err(sa, "action %s was rejected: %s",
-					action_name, strerror(rc));
+					action_name, rte_strerror(rc));
 			}
 		}
 		rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 37/43] net/tap: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (35 preceding siblings ...)
  2023-11-14 11:24     ` [PATCH v2 36/43] net/sfc: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 38/43] net/vhost: " Dengdui Huang
                       ` (5 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/tap/rte_eth_tap.c | 26 +++++++++++++-------------
 drivers/net/tap/tap_flow.c    | 18 +++++++++---------
 drivers/net/tap/tap_netlink.c |  5 +++--
 drivers/net/tap/tap_tcmsgs.c  |  6 ++++--
 4 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index b41fa971cb..ff290ea5bf 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -196,7 +196,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	/* Set the TUN/TAP configuration and set the name if needed */
 	if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) {
 		TAP_LOG(WARNING, "Unable to set TUNSETIFF for %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -204,7 +204,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (persistent && ioctl(fd, TUNSETPERSIST, 1) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set persist %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -224,7 +224,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		if (ioctl(fd, TUNSETQUEUE, (void *)&ifr) < 0) {
 			TAP_LOG(WARNING,
 				"Unable to detach keep-alive queue for %s: %s",
-				ifr.ifr_name, strerror(errno));
+				ifr.ifr_name, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -242,7 +242,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (fcntl(fd, F_SETFL, flags) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set %s to nonblocking: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -295,18 +295,18 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		/* Enable signal on file descriptor */
 		if (fcntl(fd, F_SETSIG, signo) < 0) {
 			TAP_LOG(WARNING, "Unable to set signo %d for fd %d: %s",
-				signo, fd, strerror(errno));
+				signo, fd, rte_strerror(errno));
 			goto error;
 		}
 		if (fcntl(fd, F_SETFL, flags | O_ASYNC) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl flags: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 
 		if (fcntl(fd, F_SETOWN, getpid()) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl owner: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -821,7 +821,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
 
 error:
 	TAP_LOG(DEBUG, "%s(%s) failed: %s(%d)", ifr->ifr_name,
-		tap_ioctl_req2str(request), strerror(errno), errno);
+		tap_ioctl_req2str(request), rte_strerror(errno), errno);
 	return -errno;
 }
 
@@ -1966,7 +1966,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 	if (pmd->ioctl_sock == -1) {
 		TAP_LOG(ERR,
 			"%s Unable to get a socket for management: %s",
-			tuntap_name, strerror(errno));
+			tuntap_name, rte_strerror(errno));
 		goto error_exit;
 	}
 
@@ -2127,7 +2127,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 
 disable_rte_flow:
 	TAP_LOG(ERR, " Disabling rte flow support: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	if (strlen(remote_iface)) {
 		TAP_LOG(ERR, "Remote feature requires flow support.");
 		goto error_exit;
@@ -2137,7 +2137,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 
 error_remote:
 	TAP_LOG(ERR, " Can't set up remote feature: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	tap_flow_implicit_flush(pmd, NULL);
 
 error_exit:
@@ -2475,7 +2475,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 			ret = rte_mp_action_register(TAP_MP_REQ_START_RXTX, tap_mp_req_start_rxtx);
 			if (ret < 0 && rte_errno != ENOTSUP) {
 				TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-					strerror(rte_errno));
+					rte_strerror(rte_errno));
 				return -1;
 			}
 		}
@@ -2535,7 +2535,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto leave;
 		}
 	}
diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index ed4d42f92f..9d6b84f5c7 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -1409,7 +1409,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 	if (err < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(error, EEXIST, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL,
 				   "overlapping rules or Kernel too old for flower support");
@@ -1454,7 +1454,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 		if (err < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule creation (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL,
@@ -1508,7 +1508,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 	if (ret < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule deletion (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"couldn't receive kernel ack to our request");
@@ -1532,7 +1532,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 		if (ret < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule deletion (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL, "Failure trying to receive nl ack");
@@ -1755,7 +1755,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd,
 			goto success;
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		goto fail;
 	}
 	LIST_INSERT_HEAD(&pmd->implicit_flows, remote_flow, next);
@@ -1871,7 +1871,7 @@ static int rss_enable(struct pmd_internals *pmd,
 	if (pmd->map_fd < 0) {
 		TAP_LOG(ERR,
 			"Failed to create BPF map (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
@@ -1946,7 +1946,7 @@ static int rss_enable(struct pmd_internals *pmd,
 		if (err < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule creation (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return err;
 		}
 		LIST_INSERT_HEAD(&pmd->rss_flows, rss_flow, next);
@@ -2111,7 +2111,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd,
 	if (err) {
 		TAP_LOG(ERR,
 			"Failed to update BPF map entry #%u (%d): %s",
-			flow->key_idx, errno, strerror(errno));
+			flow->key_idx, errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
@@ -2130,7 +2130,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd,
 	if (flow->bpf_fd[SEC_L3_L4] < 0) {
 		TAP_LOG(ERR,
 			"Failed to load BPF section %s (%d): %s",
-				sec_name[SEC_L3_L4], errno, strerror(errno));
+				sec_name[SEC_L3_L4], errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c
index 75af3404b0..354574ba29 100644
--- a/drivers/net/tap/tap_netlink.c
+++ b/drivers/net/tap/tap_netlink.c
@@ -14,6 +14,7 @@
 #include <rte_malloc.h>
 #include <tap_netlink.h>
 #include <rte_random.h>
+#include <rte_errno.h>
 
 #include "tap_log.h"
 
@@ -97,7 +98,7 @@ tap_nl_final(int nlsk_fd)
 {
 	if (close(nlsk_fd)) {
 		TAP_LOG(ERR, "Failed to close netlink socket: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return 0;
@@ -129,7 +130,7 @@ tap_nl_send(int nlsk_fd, struct nlmsghdr *nh)
 			goto retry;
 
 		TAP_LOG(ERR, "Failed to send netlink message: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return send_bytes;
diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c
index a3aae3c814..28d4809360 100644
--- a/drivers/net/tap/tap_tcmsgs.c
+++ b/drivers/net/tap/tap_tcmsgs.c
@@ -8,6 +8,8 @@
 #include <net/if.h>
 #include <string.h>
 
+#include <rte_errno.h>
+
 #include <rte_log.h>
 #include <tap_tcmsgs.h>
 #include "tap_log.h"
@@ -263,7 +265,7 @@ qdisc_create_multiq(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_multiq(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add multiq qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -289,7 +291,7 @@ qdisc_create_ingress(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_ingress(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add ingress qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 38/43] net/vhost: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (36 preceding siblings ...)
  2023-11-14 11:24     ` [PATCH v2 37/43] net/tap: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 39/43] net/virtio: " Dengdui Huang
                       ` (4 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 21bbb008e0..75b48dc31e 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -567,7 +567,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 			VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
-				vq->kickfd, rxq_idx, strerror(errno));
+				vq->kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
 				vq->kickfd, rxq_idx);
@@ -579,7 +579,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) {
 			VHOST_LOG(ERR, "Failed to register %d in rxq-%d epoll: %s\n",
-				vring.kickfd, rxq_idx, strerror(errno));
+				vring.kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			vq->kickfd = vring.kickfd;
 			VHOST_LOG(DEBUG, "Registered %d in rxq-%d epoll\n",
@@ -730,7 +730,7 @@ eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev)
 		if (vq->kickfd >= 0) {
 			if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 				VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
-					vq->kickfd, i, strerror(errno));
+					vq->kickfd, i, rte_strerror(errno));
 			} else {
 				VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
 					vq->kickfd, i);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 39/43] net/virtio: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (37 preceding siblings ...)
  2023-11-14 11:24     ` [PATCH v2 38/43] net/vhost: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 40/43] raw/ifpga: " Dengdui Huang
                       ` (3 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel.c |  8 +++---
 .../net/virtio/virtio_user/vhost_kernel_tap.c | 25 ++++++++++---------
 drivers/net/virtio/virtio_user/vhost_user.c   | 20 +++++++--------
 drivers/net/virtio/virtio_user/vhost_vdpa.c   | 12 ++++-----
 .../net/virtio/virtio_user/virtio_user_dev.c  |  8 +++---
 drivers/net/virtio/virtio_user_ethdev.c       |  6 ++---
 6 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
index e42bb35935..b1dec119fc 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -92,7 +92,7 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-kernel ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -428,7 +428,7 @@ vhost_kernel_setup(struct virtio_user_dev *dev)
 	for (i = 0; i < dev->max_queue_pairs; ++i) {
 		vhostfd = open(dev->path, O_RDWR);
 		if (vhostfd < 0) {
-			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, rte_strerror(errno));
 			goto err_tapfds;
 		}
 		data->vhostfds[i] = vhostfd;
@@ -511,14 +511,14 @@ vhost_kernel_set_backend(int vhostfd, int tapfd)
 	f.index = 0;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	f.index = 1;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index 611e2e25ec..4542ccbf04 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -13,6 +13,7 @@
 #include <limits.h>
 
 #include <rte_ether.h>
+#include <rte_errno.h>
 
 #include "vhost_kernel_tap.h"
 #include "../virtio_logs.h"
@@ -27,12 +28,12 @@ tap_support_features(unsigned int *tap_features)
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
 		PMD_DRV_LOG(ERR, "fail to open %s: %s",
-			    PATH_NET_TUN, strerror(errno));
+			    PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNGETFEATURES, tap_features) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -49,11 +50,11 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
-		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, strerror(errno));
+		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 	if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -68,12 +69,12 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 		if (multi_queue) {
 			PMD_DRV_LOG(DEBUG,
 				"TUNSETIFF failed (will retry without IFF_MULTI_QUEUE): %s",
-				strerror(errno));
+				rte_strerror(errno));
 			multi_queue = false;
 			goto retry_mono_q;
 		}
 
-		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", rte_strerror(errno));
 		close(tapfd);
 		tapfd = -1;
 	}
@@ -88,7 +89,7 @@ tap_get_name(int tapfd, char **name)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	ret = asprintf(name, "%s", ifr.ifr_name);
@@ -104,7 +105,7 @@ tap_get_flags(int tapfd, unsigned int *tap_flags)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	*tap_flags = ifr.ifr_flags;
@@ -120,7 +121,7 @@ tap_set_mac(int tapfd, uint8_t *mac)
 	ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
 	memcpy(ifr.ifr_hwaddr.sa_data, mac, RTE_ETHER_ADDR_LEN);
 	if (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -155,7 +156,7 @@ vhost_kernel_tap_set_offload(int fd, uint64_t features)
 		offload &= ~TUN_F_UFO;
 		if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
 			PMD_DRV_LOG(ERR, "TUNSETOFFLOAD ioctl() failed: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -175,12 +176,12 @@ vhost_kernel_tap_setup(int tapfd, int hdr_size, uint64_t features)
 	 * max_mem_regions, supported in newer version linux kernel
 	 */
 	if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNSETSNDBUF, &sndbuf) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 3c05ac9cc0..e079c726da 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -135,7 +135,7 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num)
 	} while (r < 0 && errno == EINTR);
 
 	if (r < 0)
-		PMD_DRV_LOG(ERR, "Failed to send msg: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to send msg: %s", rte_strerror(errno));
 
 	return r;
 }
@@ -148,7 +148,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 
 	ret = recv(fd, (void *)msg, sz_hdr, 0);
 	if (ret < 0) {
-		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", rte_strerror(errno));
 		return -1;
 	} else if (ret < sz_hdr) {
 		PMD_DRV_LOG(ERR, "Failed to recv msg hdr: %d instead of %d.",
@@ -174,7 +174,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 	if (sz_payload) {
 		ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
 		if (ret < 0) {
-			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", rte_strerror(errno));
 			return -1;
 		} else if (ret < sz_payload) {
 			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %d instead of %u.",
@@ -749,7 +749,7 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	ret = bind(fd, (struct sockaddr *)un, sizeof(*un));
 	if (ret < 0) {
 		PMD_DRV_LOG(ERR, "failed to bind to %s: %s; remove it and try again",
-			    dev->path, strerror(errno));
+			    dev->path, rte_strerror(errno));
 		return -1;
 	}
 	ret = listen(fd, MAX_VIRTIO_USER_BACKLOG);
@@ -760,13 +760,13 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	data->vhostfd = accept(fd, NULL, NULL);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to accept initial client connection (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	flag = fcntl(fd, F_GETFL);
 	if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl failed, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl failed, %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -834,15 +834,15 @@ vhost_user_setup(struct virtio_user_dev *dev)
 
 	fd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (fd < 0) {
-		PMD_DRV_LOG(ERR, "socket() error, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "socket() error, %s", rte_strerror(errno));
 		goto err_data;
 	}
 
 	flag = fcntl(fd, F_GETFD);
 	if (flag == -1)
-		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", rte_strerror(errno));
 	else if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0)
-		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", rte_strerror(errno));
 
 	memset(&un, 0, sizeof(un));
 	un.sun_family = AF_UNIX;
@@ -856,7 +856,7 @@ vhost_user_setup(struct virtio_user_dev *dev)
 		}
 	} else {
 		if (connect(fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
-			PMD_DRV_LOG(ERR, "connect error, %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "connect error, %s", rte_strerror(errno));
 			goto err_socket;
 		}
 		data->vhostfd = fd;
diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c
index 2c36b26224..ac0ef2c3f9 100644
--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
@@ -92,7 +92,7 @@ vhost_vdpa_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-vDPA ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -186,7 +186,7 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch begin (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -212,7 +212,7 @@ vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch end (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -243,7 +243,7 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -272,7 +272,7 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -530,7 +530,7 @@ vhost_vdpa_setup(struct virtio_user_dev *dev)
 	data->vhostfd = open(dev->path, O_RDWR);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to open %s: %s",
-				dev->path, strerror(errno));
+				dev->path, rte_strerror(errno));
 		free(data);
 		return -1;
 	}
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index af1f8c8237..ad7537a746 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -401,13 +401,13 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev)
 		 */
 		callfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 		if (callfd < 0) {
-			PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, rte_strerror(errno));
 			goto err;
 		}
 		kickfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 		if (kickfd < 0) {
 			close(callfd);
-			PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, rte_strerror(errno));
 			goto err;
 		}
 		dev->callfds[i] = callfd;
@@ -1043,7 +1043,7 @@ virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie)
 
 	if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
 		PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-			    strerror(errno));
+			    rte_strerror(errno));
 }
 
 int
@@ -1264,7 +1264,7 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev *dev)
 
 	if (dev->ops->get_features(dev, &dev->device_features) < 0) {
 		PMD_INIT_LOG(ERR, "get_features failed: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 3a31642899..908afde4fc 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -273,7 +273,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
 
 	if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
 		PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-			    strerror(errno));
+			    rte_strerror(errno));
 }
 
 static int
@@ -382,7 +382,7 @@ vdpa_dynamic_major_num(void)
 	fp = fopen("/proc/devices", "r");
 	if (fp == NULL) {
 		PMD_INIT_LOG(ERR, "Cannot open /proc/devices: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return UNNAMED_MAJOR;
 	}
 
@@ -409,7 +409,7 @@ virtio_user_backend_type(const char *path)
 			return VIRTIO_USER_BACKEND_VHOST_USER;
 
 		PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path,
-			     strerror(errno));
+			     rte_strerror(errno));
 		return VIRTIO_USER_BACKEND_UNKNOWN;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 40/43] raw/ifpga: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (38 preceding siblings ...)
  2023-11-14 11:24     ` [PATCH v2 39/43] net/virtio: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 41/43] vdpa/ifc: " Dengdui Huang
                       ` (2 subsequent siblings)
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/raw/ifpga/afu_pmd_n3000.c      |  5 +++--
 drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +++++++-----
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 67b3941265..d7302edc3f 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -21,6 +21,7 @@
 #include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
+#include <rte_errno.h>
 
 #include "afu_pmd_core.h"
 #include "afu_pmd_n3000.h"
@@ -693,7 +694,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 	pfd.events = POLLIN;
 	poll_ret = poll(&pfd, 1, DMA_TIMEOUT_MSEC);
 	if (poll_ret < 0) {
-		IFPGA_RAWDEV_PMD_ERR("Error %s", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Error %s", rte_strerror(errno));
 		ret = -EFAULT;
 		goto out;
 	} else if (poll_ret == 0) {
@@ -708,7 +709,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 			ret = 0;
 		} else {
 			IFPGA_RAWDEV_PMD_ERR("Failed %s", bytes_read > 0 ?
-				strerror(errno) : "zero bytes read");
+				rte_strerror(errno) : "zero bytes read");
 			ret = -EIO;
 		}
 	}
diff --git a/drivers/raw/ifpga/base/ifpga_fme_rsu.c b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
index f147aaa1e8..8e8a611f9a 100644
--- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c
+++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
@@ -7,6 +7,8 @@
 #include <unistd.h>
 #include "ifpga_sec_mgr.h"
 
+#include <rte_errno.h>
+
 static struct ifpga_sec_mgr *sec_mgr;
 
 static void set_rsu_control(struct ifpga_sec_mgr *smgr, uint32_t ctrl)
@@ -112,7 +114,7 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 
@@ -130,14 +132,14 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 			IFPGA_RSU_DATA_BLK_SIZE : length;
 		if (lseek(fd, offset, SEEK_SET) < 0) {
 			dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
 		read_size = read(fd, buf, to_transfer);
 		if (read_size < 0) {
 			dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
@@ -316,7 +318,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	len = lseek(fd, 0, SEEK_END);
@@ -325,7 +327,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (len < 0) {
 		dev_err(smgr,
 			"Failed to get file length of \'%s\' [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	if (len == 0) {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index f89bd3f9e2..56d3ec02eb 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -847,7 +847,7 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id,
 	if (file_fd < 0) {
 		IFPGA_RAWDEV_PMD_ERR("%s: open file error: %s\n",
 				__func__, file_name);
-		IFPGA_RAWDEV_PMD_ERR("Message : %s\n", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Message : %s\n", rte_strerror(errno));
 		return -EINVAL;
 	}
 	ret = stat(file_name, &file_stat);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 41/43] vdpa/ifc: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (39 preceding siblings ...)
  2023-11-14 11:24     ` [PATCH v2 40/43] raw/ifpga: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 42/43] vdpa/mlx5: " Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 43/43] vdpa/sfc: " Dengdui Huang
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index f034bd59ba..34ea450d00 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
+#include <rte_errno.h>
 
 #include "base/ifcvf.h"
 
@@ -446,7 +447,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 			fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 			if (fd < 0) {
 				DRV_LOG(ERR, "can't setup eventfd: %s",
-					strerror(errno));
+					rte_strerror(errno));
 				return -1;
 			}
 			internal->intr_fd[i] = fd;
@@ -457,7 +458,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error enabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -489,7 +490,7 @@ vdpa_disable_vfio_intr(struct ifcvf_internal *internal)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error disabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -526,7 +527,7 @@ notify_relay(void *arg)
 		rte_vhost_get_vhost_vring(internal->vid, qid, &vring);
 		ev.data.u64 = qid | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -552,7 +553,7 @@ notify_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -628,7 +629,7 @@ intr_relay(void *arg)
 	ev.data.fd = rte_intr_fd_get(internal->pdev->intr_handle);
 	if (epoll_ctl(csc_epfd, EPOLL_CTL_ADD,
 		rte_intr_fd_get(internal->pdev->intr_handle), &ev) < 0) {
-		DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+		DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 		goto out;
 	}
 
@@ -653,7 +654,7 @@ intr_relay(void *arg)
 					continue;
 				DRV_LOG(ERR, "Error reading from file descriptor %d: %s\n",
 					csc_event.data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				goto out;
 			} else if (nbytes == 0) {
 				DRV_LOG(ERR, "Read nothing from file descriptor %d\n",
@@ -947,7 +948,7 @@ vring_relay(void *arg)
 		rte_vhost_get_vhost_vring(vid, qid, &vring);
 		ev.data.u64 = qid << 1 | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -961,7 +962,7 @@ vring_relay(void *arg)
 			(uint64_t)internal->intr_fd[qid] << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, internal->intr_fd[qid], &ev)
 				< 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 		update_used_ring(internal, qid);
@@ -992,7 +993,7 @@ vring_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -1265,7 +1266,7 @@ ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret) {
 		DRV_LOG(ERR, "Get not get device region info: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 42/43] vdpa/mlx5: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (40 preceding siblings ...)
  2023-11-14 11:24     ` [PATCH v2 41/43] vdpa/ifc: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  2023-11-14 11:24     ` [PATCH v2 43/43] vdpa/sfc: " Dengdui Huang
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 607e290995..243abef588 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -44,7 +44,7 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
 			    errno == EAGAIN)
 				continue;
 			DRV_LOG(ERR,  "Failed to read kickfd of virtq %d: %s.",
-				virtq->index, strerror(errno));
+				virtq->index, rte_strerror(errno));
 		}
 		break;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v2 43/43] vdpa/sfc: use rte strerror
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
                       ` (41 preceding siblings ...)
  2023-11-14 11:24     ` [PATCH v2 42/43] vdpa/mlx5: " Dengdui Huang
@ 2023-11-14 11:24     ` Dengdui Huang
  42 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 11:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index 00f9a4b04c..56fb7f96d8 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -137,7 +137,7 @@ sfc_vdpa_enable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error enabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -165,7 +165,7 @@ sfc_vdpa_disable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error disabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -841,7 +841,7 @@ sfc_vdpa_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret != 0) {
 		sfc_vdpa_err(dev, "could not get device region info: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 00/42] replace strerror
  2023-11-14  8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
@ 2023-11-14 12:35   ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang
                       ` (41 more replies)
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
  2 siblings, 42 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This series of patches fix it. In this patchset, only the libs and
drivers are modified.

chang log:
v2->v3 drop patch "telemetry: replace strerror" due to compile fail
v1-v2 fix ci error

Dengdui Huang (42):
  devtools: forbid use of strerror
  eal: use rte strerror
  eventdev: use rte strerror
  latency: use rte strerror
  node: use rte strerror
  pdump: use rte strerror
  power: use rte strerror
  vhost: use rte strerror
  bpf: use rte strerror
  bus/cdx: use rte strerror
  bus/dpaa: use rte strerror
  bus/fslmc: use rte strerror
  bus/pci: use rte strerror
  bus/vdev: use rte strerror
  bus/vmbus: use rte strerror
  common/cnxk: use rte strerror
  common/mlx5: use rte strerror
  crypto/caam_jr: use rte strerror
  dma/idxd: use rte strerror
  net/af_packet: use rte strerror
  net/bnxt: use rte strerror
  net/af_xdp: use rte strerror
  net/bonding: use rte strerror
  net/dpaa: use rte strerror
  net/dpaa2: use rte strerror
  net/enetfec: use rte strerror
  net/failsafe: use rte strerror
  net/i40e: use rte strerror
  net/ice: use rte strerror
  net/ixgbe: use rte strerror
  net/memif: use rte strerror
  net/mlx4: use rte strerror
  net/mlx5: use rte strerror
  net/qede: use rte strerror
  net/sfc: use rte strerror
  net/tap: use rte strerror
  net/vhost: use rte strerror
  net/virtio: use rte strerror
  raw/ifpga: use rte strerror
  vdpa/ifc: use rte strerror
  vdpa/mlx5: use rte strerror
  vdpa/sfc: use rte strerror

 devtools/checkpatches.sh                      |   8 +
 drivers/bus/cdx/cdx.c                         |   2 +-
 drivers/bus/cdx/cdx_vfio.c                    |  13 +-
 drivers/bus/dpaa/base/fman/fman.c             |   2 +-
 drivers/bus/dpaa/dpaa_bus.c                   |   2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  12 +-
 drivers/bus/pci/bsd/pci.c                     |   8 +-
 drivers/bus/pci/linux/pci.c                   |   7 +-
 drivers/bus/pci/linux/pci_uio.c               |  23 +-
 drivers/bus/pci/linux/pci_vfio.c              |  23 +-
 drivers/bus/pci/pci_common_uio.c              |   3 +-
 drivers/bus/vdev/vdev.c                       |   2 +-
 drivers/bus/vmbus/linux/vmbus_bus.c           |   7 +-
 drivers/bus/vmbus/linux/vmbus_uio.c           |  21 +-
 drivers/bus/vmbus/vmbus_common.c              |   4 +-
 drivers/bus/vmbus/vmbus_common_uio.c          |   3 +-
 drivers/common/cnxk/roc_dev.c                 |   4 +-
 drivers/common/cnxk/roc_model.c               |   4 +-
 drivers/common/cnxk/roc_utils.c               |   4 +-
 drivers/common/mlx5/linux/mlx5_nl.c           |  12 +-
 drivers/common/mlx5/mlx5_common.c             |   6 +-
 drivers/common/mlx5/mlx5_devx_cmds.c          |   2 +-
 drivers/crypto/caam_jr/caam_jr_uio.c          |   5 +-
 drivers/dma/idxd/idxd_bus.c                   |  15 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  12 +-
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 drivers/net/bonding/bonding_testpmd.c         |   4 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_flow.c       |   4 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   6 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   4 +-
 drivers/net/dpaa/fmlib/fm_lib.c               |   6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/enetfec/enet_uio.c                |   2 +-
 drivers/net/failsafe/failsafe.c               |   8 +-
 drivers/net/failsafe/failsafe_args.c          |   4 +-
 drivers/net/failsafe/failsafe_eal.c           |   4 +-
 drivers/net/failsafe/failsafe_flow.c          |   4 +-
 drivers/net/failsafe/failsafe_ops.c           |   2 +-
 drivers/net/failsafe/failsafe_private.h       |   6 +-
 drivers/net/i40e/i40e_testpmd.c               |  42 +--
 drivers/net/ice/ice_testpmd.c                 |   4 +-
 drivers/net/ixgbe/ixgbe_testpmd.c             |  12 +-
 drivers/net/memif/memif_socket.c              |   4 +-
 drivers/net/memif/rte_eth_memif.c             |  20 +-
 drivers/net/mlx4/mlx4.c                       |  14 +-
 drivers/net/mlx4/mlx4_ethdev.c                |  18 +-
 drivers/net/mlx4/mlx4_rxq.c                   |  10 +-
 drivers/net/mlx4/mlx4_txq.c                   |  10 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c         |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |  20 +-
 drivers/net/mlx5/linux/mlx5_os.c              |  18 +-
 drivers/net/mlx5/linux/mlx5_socket.c          |  16 +-
 drivers/net/mlx5/linux/mlx5_verbs.c           |   8 +-
 drivers/net/mlx5/mlx5.c                       |   8 +-
 drivers/net/mlx5/mlx5_devx.c                  |   4 +-
 drivers/net/mlx5/mlx5_mac.c                   |   2 +-
 drivers/net/mlx5/mlx5_rxmode.c                |   8 +-
 drivers/net/mlx5/mlx5_rxq.c                   |   4 +-
 drivers/net/mlx5/mlx5_rxtx.c                  |   2 +-
 drivers/net/mlx5/mlx5_stats.c                 |   4 +-
 drivers/net/mlx5/mlx5_testpmd.c               |  14 +-
 drivers/net/mlx5/mlx5_trigger.c               |  12 +-
 drivers/net/mlx5/mlx5_vlan.c                  |   2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c     |   2 +-
 drivers/net/mlx5/windows/mlx5_os.c            |  12 +-
 drivers/net/qede/qede_regs.c                  |   4 +-
 drivers/net/sfc/sfc_flow.c                    |   2 +-
 drivers/net/sfc/sfc_flow_tunnel.c             |   2 +-
 drivers/net/sfc/sfc_mae.c                     |  58 ++---
 drivers/net/tap/rte_eth_tap.c                 |  26 +-
 drivers/net/tap/tap_flow.c                    |  18 +-
 drivers/net/tap/tap_netlink.c                 |   5 +-
 drivers/net/tap/tap_tcmsgs.c                  |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   6 +-
 drivers/net/virtio/virtio_user/vhost_kernel.c |   8 +-
 .../net/virtio/virtio_user/vhost_kernel_tap.c |  25 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |  20 +-
 drivers/net/virtio/virtio_user/vhost_vdpa.c   |  12 +-
 .../net/virtio/virtio_user/virtio_user_dev.c  |   8 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   6 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   5 +-
 drivers/raw/ifpga/base/ifpga_fme_rsu.c        |  12 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |  23 +-
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c           |   2 +-
 drivers/vdpa/sfc/sfc_vdpa_ops.c               |   6 +-
 lib/bpf/bpf_load_elf.c                        |   2 +-
 lib/eal/common/eal_common_fbarray.c           |   2 +-
 lib/eal/common/eal_common_options.c           |   7 +-
 lib/eal/common/eal_common_proc.c              |  12 +-
 lib/eal/common/eal_common_trace_utils.c       |   6 +-
 lib/eal/freebsd/eal.c                         |   4 +-
 lib/eal/freebsd/eal_interrupts.c              |   8 +-
 lib/eal/freebsd/eal_memory.c                  |   2 +-
 lib/eal/freebsd/eal_timer.c                   |   6 +-
 lib/eal/linux/eal.c                           |  10 +-
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/linux/eal_hugepage_info.c             |   5 +-
 lib/eal/linux/eal_interrupts.c                |  18 +-
 lib/eal/linux/eal_memalloc.c                  |  47 ++--
 lib/eal/linux/eal_memory.c                    |  43 ++--
 lib/eal/linux/eal_timer.c                     |   2 +-
 lib/eal/linux/eal_vfio.c                      |  40 +--
 lib/eal/unix/eal_filesystem.c                 |   5 +-
 lib/eal/unix/eal_unix_memory.c                |   6 +-
 lib/eal/unix/rte_thread.c                     |   6 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |   2 +-
 lib/latencystats/rte_latencystats.c           |   4 +-
 lib/node/kernel_tx.c                          |   2 +-
 lib/pdump/rte_pdump.c                         |   6 +-
 lib/power/guest_channel.c                     |   7 +-
 lib/power/power_kvm_vm.c                      |   3 +-
 lib/power/power_pstate_cpufreq.c              |   7 +-
 lib/power/rte_power_pmd_mgmt.c                |   2 +-
 lib/vhost/socket.c                            |  13 +-
 lib/vhost/vduse.c                             |  31 +--
 lib/vhost/vhost_user.c                        |  11 +-
 135 files changed, 939 insertions(+), 896 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 01/42] devtools: forbid use of strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 02/42] eal: use rte strerror Dengdui Huang
                       ` (40 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
rte_strerror() has been provided in DPDK to replace it.

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 066449d147..7fbd0df3b3 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -159,6 +159,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from using strerror() for drivers and libs
+	awk -v FOLDERS="lib drivers" \
+		-v EXPRESSIONS="\\\sstrerror\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using strerror, prefer rte_strerror' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# refrain from using RTE_LOG_REGISTER for drivers and libs
 	awk -v FOLDERS='lib drivers' \
 		-v EXPRESSIONS='\\<RTE_LOG_REGISTER\\>' \
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 02/42] eal: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 03/42] eventdev: " Dengdui Huang
                       ` (39 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_fbarray.c     |  2 +-
 lib/eal/common/eal_common_options.c     |  7 ++--
 lib/eal/common/eal_common_proc.c        | 12 +++----
 lib/eal/common/eal_common_trace_utils.c |  6 ++--
 lib/eal/freebsd/eal.c                   |  4 +--
 lib/eal/freebsd/eal_interrupts.c        |  8 ++---
 lib/eal/freebsd/eal_memory.c            |  2 +-
 lib/eal/freebsd/eal_timer.c             |  6 ++--
 lib/eal/linux/eal.c                     | 10 +++---
 lib/eal/linux/eal_dev.c                 |  2 +-
 lib/eal/linux/eal_hugepage_info.c       |  5 +--
 lib/eal/linux/eal_interrupts.c          | 18 +++++-----
 lib/eal/linux/eal_memalloc.c            | 47 +++++++++++++------------
 lib/eal/linux/eal_memory.c              | 43 +++++++++++-----------
 lib/eal/linux/eal_timer.c               |  2 +-
 lib/eal/linux/eal_vfio.c                | 40 ++++++++++-----------
 lib/eal/unix/eal_filesystem.c           |  5 +--
 lib/eal/unix/eal_unix_memory.c          |  6 ++--
 lib/eal/unix/rte_thread.c               |  6 ++--
 19 files changed, 118 insertions(+), 113 deletions(-)

diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c
index 2055bfa57d..a2936bbd91 100644
--- a/lib/eal/common/eal_common_fbarray.c
+++ b/lib/eal/common/eal_common_fbarray.c
@@ -1027,7 +1027,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		eal_get_fbarray_path(path, sizeof(path), arr->name);
 		if (unlink(path)) {
 			RTE_LOG(DEBUG, EAL, "Cannot unlink fbarray: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			/*
 			 * we're still holding an exclusive lock, so drop it to
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index a6d21f1cba..8a09fe2719 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -44,6 +44,7 @@
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include "eal_trace.h"
 #endif
+#include <rte_errno.h>
 
 #define BITS_PER_HEX 4
 #define LCORE_OPT_LST 1
@@ -391,7 +392,7 @@ eal_plugindir_init(const char *path)
 	d = opendir(path);
 	if (d == NULL) {
 		RTE_LOG(ERR, EAL, "failed to open directory %s: %s\n",
-			path, strerror(errno));
+			path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -443,7 +444,7 @@ verify_perms(const char *dirpath)
 	/* call stat to check for permissions and ensure not world writable */
 	if (stat(dirpath, &st) != 0) {
 		RTE_LOG(ERR, EAL, "Error with stat on %s, %s\n",
-				dirpath, strerror(errno));
+				dirpath, rte_strerror(errno));
 		return -1;
 	}
 	if (st.st_mode & S_IWOTH) {
@@ -471,7 +472,7 @@ eal_dlopen(const char *pathname)
 	}
 	if (realp == NULL) {
 		RTE_LOG(ERR, EAL, "Error with realpath for %s, %s\n",
-				pathname, strerror(errno));
+				pathname, rte_strerror(errno));
 		goto out;
 	}
 	if (strnlen(realp, PATH_MAX) == PATH_MAX) {
diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index 728815c4a9..2e39180d40 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -291,7 +291,7 @@ read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s)
 		if (errno == EINTR)
 			goto retry;
 
-		RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", strerror(errno));
+		RTE_LOG(ERR, EAL, "recvmsg failed, %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -583,7 +583,7 @@ open_socket_fd(void)
 
 	if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		RTE_LOG(ERR, EAL, "failed to bind %s: %s\n",
-			un.sun_path, strerror(errno));
+			un.sun_path, rte_strerror(errno));
 		close(mp_fd);
 		return -1;
 	}
@@ -631,13 +631,13 @@ rte_mp_channel_init(void)
 	dir_fd = open(mp_dir_path, O_RDONLY);
 	if (dir_fd < 0) {
 		RTE_LOG(ERR, EAL, "failed to open %s: %s\n",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		return -1;
 	}
 
 	if (flock(dir_fd, LOCK_EX)) {
 		RTE_LOG(ERR, EAL, "failed to lock %s: %s\n",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
@@ -650,7 +650,7 @@ rte_mp_channel_init(void)
 	if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg",
 			mp_handle, NULL) < 0) {
 		RTE_LOG(ERR, EAL, "failed to create mp thread: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dir_fd);
 		close(rte_atomic_exchange_explicit(&mp_fd, -1, rte_memory_order_relaxed));
 		return -1;
@@ -733,7 +733,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type)
 			return 0;
 		}
 		RTE_LOG(ERR, EAL, "failed to send to (%s) due to %s\n",
-			dst_path, strerror(errno));
+			dst_path, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c
index 8561a0e198..b74adf6589 100644
--- a/lib/eal/common/eal_common_trace_utils.c
+++ b/lib/eal/common/eal_common_trace_utils.c
@@ -244,7 +244,7 @@ eal_trace_dir_args_save(char const *val)
 	int rc;
 
 	if (asprintf(&dir_path, "%s/", val) == -1) {
-		trace_err("failed to copy directory: %s", strerror(errno));
+		trace_err("failed to copy directory: %s", rte_strerror(errno));
 		return -ENOMEM;
 	}
 
@@ -328,7 +328,7 @@ trace_mkdir(void)
 	/* Create the path if it t exist, no "mkdir -p" available here */
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0 && errno != EEXIST) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
@@ -343,7 +343,7 @@ trace_mkdir(void)
 
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 568e06e9ed..a82f3ab8d0 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -203,7 +203,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -250,7 +250,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 2b31dfb099..0672e88e4e 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -186,7 +186,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
 			else
 				RTE_LOG(ERR, EAL, "Error adding fd %d kevent, %s\n",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			ret = -errno;
 			goto fail;
 		}
@@ -323,7 +323,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,
 		if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 			RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n",
 				rte_intr_fd_get(src->intr_handle),
-				strerror(errno));
+				rte_strerror(errno));
 			/* removing non-existent even is an expected condition
 			 * in some circumstances (e.g. oneshot events).
 			 */
@@ -516,7 +516,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				RTE_LOG(ERR, EAL, "Error reading from file "
 					"descriptor %d: %s\n",
 					event_fd,
-					strerror(errno));
+					rte_strerror(errno));
 			} else if (bytes_read == 0)
 				RTE_LOG(ERR, EAL, "Read nothing from file "
 					"descriptor %d\n", event_fd);
@@ -567,7 +567,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 					RTE_LOG(ERR, EAL, "Error removing fd %d kevent, %s\n",
 						rte_intr_fd_get(src->intr_handle),
-						strerror(errno));
+						rte_strerror(errno));
 					/* removing non-existent even is an expected
 					 * condition in some circumstances
 					 * (e.g. oneshot events).
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index 5c6165c580..35e11970c6 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -85,7 +85,7 @@ rte_eal_hugepage_init(void)
 				MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 		if (addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			return -1;
 		}
 
diff --git a/lib/eal/freebsd/eal_timer.c b/lib/eal/freebsd/eal_timer.c
index beff755a47..7125e4e0e8 100644
--- a/lib/eal/freebsd/eal_timer.c
+++ b/lib/eal/freebsd/eal_timer.c
@@ -36,20 +36,20 @@ get_tsc_freq(void)
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0))
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 	else if (tmp != 1)
 		RTE_LOG(WARNING, EAL, "TSC is not safe to use in SMP mode\n");
 
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0))
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 	else if (tmp != 1)
 		RTE_LOG(WARNING, EAL, "TSC is not invariant\n");
 
 	sz = sizeof(tsc_hz);
 	if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) {
-		RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
+		RTE_LOG(WARNING, EAL, "%s\n", rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 57da058cec..0da0a000ac 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -160,7 +160,7 @@ eal_clean_runtime_dir(void)
 		closedir(dir);
 
 	RTE_LOG(ERR, EAL, "Error while clearing runtime dir: %s\n",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -288,7 +288,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -335,7 +335,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1421,7 +1421,7 @@ rte_eal_check_module(const char *module_name)
 	/* Check if there is sysfs mounted */
 	if (stat("/sys/module", &st) != 0) {
 		RTE_LOG(DEBUG, EAL, "sysfs is not mounted! error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1434,7 +1434,7 @@ rte_eal_check_module(const char *module_name)
 
 	if (stat(sysfs_mod_name, &st) != 0) {
 		RTE_LOG(DEBUG, EAL, "Module %s not found! error %i (%s)\n",
-		        sysfs_mod_name, errno, strerror(errno));
+			sysfs_mod_name, errno, rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ac76f6174d..ede68f32cf 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -73,7 +73,7 @@ static void sigbus_handler(int signum, siginfo_t *info,
 	if (ret == -1) {
 		rte_exit(EXIT_FAILURE,
 			 "Failed to handle SIGBUS for hot-unplug, "
-			 "(rte_errno: %s)!", strerror(rte_errno));
+			 "(rte_errno: %s)!", rte_strerror(rte_errno));
 	} else if (ret == 1) {
 		if (sigbus_action_old.sa_flags == SA_SIGINFO
 		    && sigbus_action_old.sa_sigaction) {
diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c
index 581d9dfc91..6286ab3efb 100644
--- a/lib/eal/linux/eal_hugepage_info.c
+++ b/lib/eal/linux/eal_hugepage_info.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_common.h>
 #include "rte_string_fns.h"
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
@@ -378,7 +379,7 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void *user_data)
 		closedir(dir);
 
 	RTE_LOG(ERR, EAL, "Error while walking hugepage dir: %s\n",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -404,7 +405,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd)
 
 	if (fstat(whd->file_fd, &st) < 0)
 		RTE_LOG(DEBUG, EAL, "%s(): stat(\"%s\") failed: %s",
-				__func__, whd->file_name, strerror(errno));
+				__func__, whd->file_name, rte_strerror(errno));
 	else
 		(*total_size) += st.st_size;
 }
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index d4919dff45..660e64dd41 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -460,7 +460,7 @@ uio_intr_disable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		RTE_LOG(ERR, EAL, "Error disabling interrupts for fd %d (%s)\n",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -474,7 +474,7 @@ uio_intr_enable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		RTE_LOG(ERR, EAL, "Error enabling interrupts for fd %d (%s)\n",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -975,7 +975,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 				RTE_LOG(ERR, EAL, "Error reading from file "
 					"descriptor %d: %s\n",
 					events[n].data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				/*
 				 * The device is unplugged or buggy, remove
 				 * it as an interrupt source and return to
@@ -1130,7 +1130,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 		if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
 						&pipe_event) < 0) {
 			rte_panic("Error adding fd to %d epoll_ctl, %s\n",
-					intr_pipe.readfd, strerror(errno));
+					intr_pipe.readfd, rte_strerror(errno));
 		}
 		numfds++;
 
@@ -1153,7 +1153,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 					rte_intr_fd_get(src->intr_handle), &ev) < 0) {
 				rte_panic("Error adding fd %d epoll_ctl, %s\n",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			}
 			else
 				numfds++;
@@ -1244,7 +1244,7 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
 				continue;
 			RTE_LOG(ERR, EAL,
 				"Error reading from fd %d: %s\n",
-				fd, strerror(errno));
+				fd, rte_strerror(errno));
 		} else if (nbytes == 0)
 			RTE_LOG(ERR, EAL, "Read nothing from fd %d\n", fd);
 		return;
@@ -1343,7 +1343,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events,
 			}
 			/* epoll_wait fail */
 			RTE_LOG(ERR, EAL, "epoll_wait returns with fail %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			rc = -1;
 			break;
 		} else {
@@ -1412,7 +1412,7 @@ rte_epoll_ctl(int epfd, int op, int fd,
 	ev.events = event->epdata.event;
 	if (epoll_ctl(epfd, op, fd, &ev) < 0) {
 		RTE_LOG(ERR, EAL, "Error op %d fd %d epoll_ctl, %s\n",
-			op, fd, strerror(errno));
+			op, fd, rte_strerror(errno));
 		if (op == EPOLL_CTL_ADD)
 			/* rollback status when CTL_ADD fail */
 			rte_atomic_store_explicit(&event->status, RTE_EPOLL_INVALID,
@@ -1525,7 +1525,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
 			if (fd < 0) {
 				RTE_LOG(ERR, EAL,
 					"can't setup eventfd, error %i (%s)\n",
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 				return -errno;
 			}
 
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index 9853ec78a2..53a7e5dd3b 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -31,6 +31,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "eal_internal_cfg.h"
@@ -161,7 +162,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id)
 			  oldmask->size + 1, 0, 0) < 0) {
 		RTE_LOG(ERR, EAL,
 			"Failed to get current mempolicy: %s. "
-			"Assuming MPOL_DEFAULT.\n", strerror(errno));
+			"Assuming MPOL_DEFAULT.\n", rte_strerror(errno));
 		*oldpolicy = MPOL_DEFAULT;
 	}
 	RTE_LOG(DEBUG, EAL,
@@ -180,7 +181,7 @@ restore_numa(int *oldpolicy, struct bitmask *oldmask)
 	} else if (set_mempolicy(*oldpolicy, oldmask->maskp,
 				 oldmask->size + 1) < 0) {
 		RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		numa_set_localalloc();
 	}
 	numa_free_cpumask(oldmask);
@@ -224,7 +225,7 @@ static int lock(int fd, int type)
 		return 0;
 	} else if (ret) {
 		RTE_LOG(ERR, EAL, "%s(): error calling flock(): %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 	/* lock was successful */
@@ -252,7 +253,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].memseg_list_fd = fd;
@@ -266,7 +267,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): memfd create failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].fds[seg_idx] = fd;
@@ -317,7 +318,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	ret = stat(path, &st);
 	if (ret < 0 && errno != ENOENT) {
 		RTE_LOG(DEBUG, EAL, "%s(): stat() for '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	if (!internal_conf->hugepage_file.unlink_existing && ret == 0 &&
@@ -343,7 +344,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 		/* coverity[toctou] */
 		if (unlink(path) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): could not remove '%s': %s\n",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -352,13 +353,13 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	fd = open(path, O_CREAT | O_RDWR, 0600);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "%s(): open '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	/* take out a read lock */
 	if (lock(fd, LOCK_SH) < 0) {
 		RTE_LOG(ERR, EAL, "%s(): lock '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -380,7 +381,7 @@ resize_hugefile_in_memory(int fd, uint64_t fa_offset,
 	if (ret < 0) {
 		RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n",
 				__func__,
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -415,7 +416,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 			if (new_size > cur_size &&
 					ftruncate(fd, new_size) < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 		} else {
@@ -451,7 +452,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 				} else {
 					RTE_LOG(DEBUG, EAL, "%s(): fallocate() failed: %s\n",
 						__func__,
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			} else {
@@ -484,7 +485,7 @@ close_hugefile(int fd, char *path, int list_idx)
 			rte_eal_process_type() == RTE_PROC_PRIMARY &&
 			unlink(path))
 		RTE_LOG(ERR, EAL, "%s(): unlinking '%s' failed: %s\n",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 
 	close(fd);
 	fd_list[list_idx].memseg_list_fd = -1;
@@ -585,14 +586,14 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 			map_offset = 0;
 			if (ftruncate(fd, alloc_sz) < 0) {
 				RTE_LOG(DEBUG, EAL, "%s(): ftruncate() failed: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				goto resized;
 			}
 			if (internal_conf->hugepage_file.unlink_before_mapping &&
 					!internal_conf->in_memory) {
 				if (unlink(path)) {
 					RTE_LOG(DEBUG, EAL, "%s(): unlink() failed: %s\n",
-						__func__, strerror(errno));
+						__func__, rte_strerror(errno));
 					goto resized;
 				}
 			}
@@ -611,7 +612,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 
 	if (va == MAP_FAILED) {
 		RTE_LOG(DEBUG, EAL, "%s(): mmap() failed: %s\n", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		/* mmap failed, but the previous region might have been
 		 * unmapped anyway. try to remap it
 		 */
@@ -662,7 +663,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 					MPOL_F_NODE | MPOL_F_ADDR);
 		if (ret < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mapped;
 		} else if (cur_socket_id != socket_id) {
 			RTE_LOG(DEBUG, EAL,
@@ -874,13 +875,13 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -981,13 +982,13 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -1345,13 +1346,13 @@ sync_existing(struct rte_memseg_list *primary_msl,
 	dir_fd = open(hi->hugedir, O_RDONLY);
 	if (dir_fd < 0) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot open '%s': %s\n", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		return -1;
 	}
 	/* blocking writelock */
 	if (flock(dir_fd, LOCK_EX)) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot lock '%s': %s\n", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 9b6f08fba8..db92d1a602 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -105,7 +105,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	fd = open("/proc/self/pagemap", O_RDONLY);
 	if (fd < 0) {
 		RTE_LOG(INFO, EAL, "%s(): cannot open /proc/self/pagemap: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	}
 
@@ -113,7 +113,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	offset = sizeof(uint64_t) * virt_pfn;
 	if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
 		RTE_LOG(INFO, EAL, "%s(): seek error in /proc/self/pagemap: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		close(fd);
 		return RTE_BAD_IOVA;
 	}
@@ -122,7 +122,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	close(fd);
 	if (retval < 0) {
 		RTE_LOG(INFO, EAL, "%s(): cannot read /proc/self/pagemap: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	} else if (retval != PFN_MASK_SIZE) {
 		RTE_LOG(INFO, EAL, "%s(): read %d bytes from /proc/self/pagemap "
@@ -237,7 +237,7 @@ static int huge_wrap_sigsetjmp(void)
 /* Callback for numa library. */
 void numa_error(char *where)
 {
-	RTE_LOG(ERR, EAL, "%s failed: %s\n", where, strerror(errno));
+	RTE_LOG(ERR, EAL, "%s failed: %s\n", where, rte_strerror(errno));
 }
 #endif
 
@@ -278,7 +278,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				  oldmask->size + 1, 0, 0) < 0) {
 			RTE_LOG(ERR, EAL,
 				"Failed to get current mempolicy: %s. "
-				"Assuming MPOL_DEFAULT.\n", strerror(errno));
+				"Assuming MPOL_DEFAULT.\n", rte_strerror(errno));
 			oldpolicy = MPOL_DEFAULT;
 		}
 		for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
@@ -333,7 +333,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		fd = open(hf->filepath, O_CREAT | O_RDWR, 0600);
 		if (fd < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): open failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			goto out;
 		}
 
@@ -346,7 +346,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				MAP_SHARED | MAP_POPULATE, fd, 0);
 		if (virtaddr == MAP_FAILED) {
 			RTE_LOG(DEBUG, EAL, "%s(): mmap failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -379,7 +379,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): Locking file failed:%s \n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -397,7 +397,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		} else if (set_mempolicy(oldpolicy, oldmask->maskp,
 					 oldmask->size + 1) < 0) {
 			RTE_LOG(ERR, EAL, "Failed to restore mempolicy: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 			numa_set_localalloc();
 		}
 	}
@@ -590,7 +590,7 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl,
 
 		if (hp->orig_va != NULL && unlink(hp->filepath)) {
 			RTE_LOG(WARNING, EAL, "%s(): Removing %s failed: %s\n",
-				__func__, hp->filepath, strerror(errno));
+				__func__, hp->filepath, rte_strerror(errno));
 		}
 	}
 	return 0;
@@ -640,7 +640,8 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl,
 						hp->orig_va = NULL;
 						if (unlink(hp->filepath) == -1) {
 							RTE_LOG(ERR, EAL, "%s(): Removing %s failed: %s\n",
-									__func__, hp->filepath, strerror(errno));
+								__func__, hp->filepath,
+								rte_strerror(errno));
 							return -1;
 						}
 					} else {
@@ -736,13 +737,13 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 		fd = open(hfile->filepath, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Could not open '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			return -1;
 		}
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "Could not lock '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -756,7 +757,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 				MAP_SHARED | MAP_POPULATE | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "Couldn't remap '%s': %s\n",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -1178,13 +1179,13 @@ eal_legacy_hugepage_init(void)
 		memfd = memfd_create("nohuge", 0);
 		if (memfd < 0) {
 			RTE_LOG(DEBUG, EAL, "Cannot create memfd: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 			RTE_LOG(DEBUG, EAL, "Falling back to anonymous map\n");
 		} else {
 			/* we got an fd - now resize it */
 			if (ftruncate(memfd, internal_conf->memory) < 0) {
 				RTE_LOG(ERR, EAL, "Cannot resize memfd: %s\n",
-						strerror(errno));
+						rte_strerror(errno));
 				RTE_LOG(ERR, EAL, "Falling back to anonymous map\n");
 				close(memfd);
 			} else {
@@ -1212,7 +1213,7 @@ eal_legacy_hugepage_init(void)
 				flags | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED || addr != prealloc_addr) {
 			RTE_LOG(ERR, EAL, "%s: mmap() failed: %s\n", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			munmap(prealloc_addr, mem_sz);
 			return -1;
 		}
@@ -1571,7 +1572,7 @@ eal_legacy_hugepage_attach(void)
 		fd = open(hf->filepath, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Could not open %s: %s\n",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto error;
 		}
 
@@ -1579,14 +1580,14 @@ eal_legacy_hugepage_attach(void)
 				MAP_SHARED | MAP_FIXED, fd, 0);
 		if (map_addr == MAP_FAILED) {
 			RTE_LOG(ERR, EAL, "Could not map %s: %s\n",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto fd_error;
 		}
 
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			RTE_LOG(DEBUG, EAL, "%s(): Locking file failed: %s\n",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mmap_error;
 		}
 
@@ -1931,7 +1932,7 @@ rte_eal_memseg_init(void)
 
 		if (setrlimit(RLIMIT_NOFILE, &lim) < 0) {
 			RTE_LOG(DEBUG, EAL, "Setting maximum number of open files failed: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 		} else {
 			RTE_LOG(DEBUG, EAL, "Setting maximum number of open files to %"
 					PRIu64 "\n",
diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c
index 3a30284e3a..c80e87309c 100644
--- a/lib/eal/linux/eal_timer.c
+++ b/lib/eal/linux/eal_timer.c
@@ -146,7 +146,7 @@ rte_eal_hpet_init(int make_default)
 	fd = open(DEV_HPET, O_RDONLY);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "ERROR: Cannot open "DEV_HPET": %s!\n",
-			strerror(errno));
+			rte_strerror(errno));
 		internal_conf->no_hpet = 1;
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index ad3c1654b2..c18d4ee8ab 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -368,7 +368,7 @@ vfio_open_group_fd(int iommu_group_num)
 			/* if file not found, it's not an error */
 			if (errno != ENOENT) {
 				RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 				return -1;
 			}
 
@@ -381,7 +381,7 @@ vfio_open_group_fd(int iommu_group_num)
 				if (errno != ENOENT) {
 					RTE_LOG(ERR, EAL,
 						"Cannot open %s: %s\n",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 					return -1;
 				}
 				return -ENOENT;
@@ -791,7 +791,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status);
 	if (ret) {
 		RTE_LOG(ERR, EAL, "%s cannot get VFIO group status, "
-			"error %i (%s)\n", dev_addr, errno, strerror(errno));
+			"error %i (%s)\n", dev_addr, errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -819,7 +819,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"%s cannot add VFIO group to container, error "
-				"%i (%s)\n", dev_addr, errno, strerror(errno));
+				"%i (%s)\n", dev_addr, errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			rte_vfio_clear_group(vfio_group_fd);
 			return -1;
@@ -860,7 +860,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 				RTE_LOG(ERR, EAL,
 					"%s DMA remapping failed, error "
 					"%i (%s)\n",
-					dev_addr, errno, strerror(errno));
+					dev_addr, errno, rte_strerror(errno));
 				close(vfio_group_fd);
 				rte_vfio_clear_group(vfio_group_fd);
 				rte_mcfg_mem_read_unlock();
@@ -978,7 +978,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		RTE_LOG(ERR, EAL, "%s cannot get device info, "
 				"error %i (%s)\n", dev_addr, errno,
-				strerror(errno));
+				rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
@@ -1216,7 +1216,7 @@ vfio_set_iommu_type(int vfio_container_fd)
 		/* not an error, there may be more supported IOMMU types */
 		RTE_LOG(DEBUG, EAL, "Set IOMMU type %d (%s) failed, error "
 				"%i (%s)\n", t->type_id, t->name, errno,
-				strerror(errno));
+				rte_strerror(errno));
 	}
 	/* if we didn't find a suitable IOMMU type, fail */
 	return NULL;
@@ -1234,7 +1234,7 @@ vfio_has_supported_extensions(int vfio_container_fd)
 				t->type_id);
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL, "Could not get IOMMU type, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			close(vfio_container_fd);
 			return -1;
 		} else if (ret == 1) {
@@ -1274,7 +1274,7 @@ rte_vfio_get_container_fd(void)
 			RTE_LOG(ERR, EAL,
 					"Cannot open VFIO container %s, error "
 					"%i (%s)\n", VFIO_CONTAINER_PATH,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1284,7 +1284,7 @@ rte_vfio_get_container_fd(void)
 			if (ret < 0)
 				RTE_LOG(ERR, EAL,
 					"Could not get VFIO API version, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			else
 				RTE_LOG(ERR, EAL, "Unsupported VFIO API version!\n");
 			close(vfio_container_fd);
@@ -1416,7 +1416,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 			} else {
 				RTE_LOG(ERR, EAL,
 					"Cannot set up DMA remapping, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 				return -1;
 			}
 		}
@@ -1430,7 +1430,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot clear DMA remapping, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		} else if (dma_unmap.size != len) {
 			RTE_LOG(ERR, EAL, "Unexpected size %"PRIu64
@@ -1479,7 +1479,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"Cannot register vaddr for IOMMU, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1494,7 +1494,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot map vaddr for IOMMU, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1510,7 +1510,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			RTE_LOG(ERR, EAL, "Cannot unmap vaddr for IOMMU, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1519,7 +1519,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			RTE_LOG(ERR, EAL,
 				"Cannot unregister vaddr for IOMMU, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -1704,7 +1704,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 	ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
 	if (ret) {
 		RTE_LOG(ERR, EAL, "Cannot get IOMMU info, error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1745,7 +1745,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */
 	if (ret) {
 		RTE_LOG(ERR, EAL, "Cannot create new DMA window, error "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 		RTE_LOG(ERR, EAL,
 			"Consider using a larger hugepage size if supported by the system\n");
 		return -1;
@@ -2006,7 +2006,7 @@ rte_vfio_noiommu_is_enabled(void)
 	if (fd < 0) {
 		if (errno != ENOENT) {
 			RTE_LOG(ERR, EAL, "Cannot open VFIO noiommu file "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 		/*
@@ -2020,7 +2020,7 @@ rte_vfio_noiommu_is_enabled(void)
 	close(fd);
 	if (cnt != 1) {
 		RTE_LOG(ERR, EAL, "Unable to read from VFIO noiommu file "
-				"%i (%s)\n", errno, strerror(errno));
+				"%i (%s)\n", errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c
index afbab9368a..51b4d513f2 100644
--- a/lib/eal/unix/eal_filesystem.c
+++ b/lib/eal/unix/eal_filesystem.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_filesystem.h"
@@ -59,14 +60,14 @@ int eal_create_runtime_dir(void)
 	ret = mkdir(tmp, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
-			tmp, strerror(errno));
+			tmp, rte_strerror(errno));
 		return -1;
 	}
 
 	ret = mkdir(run_dir, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		RTE_LOG(ERR, EAL, "Error creating '%s': %s\n",
-			run_dir, strerror(errno));
+			run_dir, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index 68ae93bd6e..d9652496df 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -32,7 +32,7 @@ mem_map(void *requested_addr, size_t size, int prot, int flags,
 		RTE_LOG(DEBUG, EAL,
 		    "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s\n",
 		    requested_addr, size, prot, flags, fd, offset,
-		    strerror(errno));
+		    rte_strerror(errno));
 		rte_errno = errno;
 		return NULL;
 	}
@@ -45,7 +45,7 @@ mem_unmap(void *virt, size_t size)
 	int ret = munmap(virt, size);
 	if (ret < 0) {
 		RTE_LOG(DEBUG, EAL, "Cannot munmap(%p, 0x%zx): %s\n",
-			virt, size, strerror(errno));
+			virt, size, rte_strerror(errno));
 		rte_errno = errno;
 	}
 	return ret;
@@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump)
 	int ret = madvise(virt, size, flags);
 	if (ret) {
 		RTE_LOG(DEBUG, EAL, "madvise(%p, %#zx, %d) failed: %s\n",
-				virt, size, flags, strerror(rte_errno));
+				virt, size, flags, rte_strerror(rte_errno));
 		rte_errno = errno;
 	}
 	return ret;
diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c
index 36a21ab2f9..486fd72277 100644
--- a/lib/eal/unix/rte_thread.c
+++ b/lib/eal/unix/rte_thread.c
@@ -302,7 +302,7 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *))
 	err = pthread_key_create(&((*key)->thread_index), destructor);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_key_create failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		free(*key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -323,7 +323,7 @@ rte_thread_key_delete(rte_thread_key key)
 	err = pthread_key_delete(key->thread_index);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_key_delete failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		free(key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -345,7 +345,7 @@ rte_thread_value_set(rte_thread_key key, const void *value)
 	err = pthread_setspecific(key->thread_index, value);
 	if (err) {
 		RTE_LOG(DEBUG, EAL, "pthread_setspecific failed: %s\n",
-			strerror(err));
+			rte_strerror(err));
 		rte_errno = ENOEXEC;
 		return -1;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 03/42] eventdev: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 02/42] eal: use rte strerror Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 04/42] latency: " Dengdui Huang
                       ` (38 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 6db03adf04..d45c2c899e 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1106,7 +1106,7 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data)
 		 */
 		if (err)
 			RTE_EDEV_LOG_ERR("Failed to enqueue interrupt"
-				" to ring: %s", strerror(-err));
+				" to ring: %s", rte_strerror(-err));
 		else
 			rte_eth_dev_rx_intr_disable(port_id, queue);
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 04/42] latency: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (2 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 03/42] eventdev: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 05/42] node: " Dengdui Huang
                       ` (37 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/latencystats/rte_latencystats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 8985a377db..a395f9b3bc 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -265,7 +265,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
 		if (ret != 0) {
 			RTE_LOG(INFO, LATENCY_STATS,
 				"Error during getting device (port %u) info: %s\n",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
@@ -309,7 +309,7 @@ rte_latencystats_uninit(void)
 		if (ret != 0) {
 			RTE_LOG(INFO, LATENCY_STATS,
 				"Error during getting device (port %u) info: %s\n",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 05/42] node: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (3 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 04/42] latency: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 06/42] pdump: " Dengdui Huang
                       ` (36 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/node/kernel_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/node/kernel_tx.c b/lib/node/kernel_tx.c
index 27d1808c71..ab92f22cb9 100644
--- a/lib/node/kernel_tx.c
+++ b/lib/node/kernel_tx.c
@@ -36,7 +36,7 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t
 		sin.sin_addr.s_addr = ip4->dst_addr;
 
 		if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0)
-			node_err("kernel_tx", "Unable to send packets: %s\n", strerror(errno));
+			node_err("kernel_tx", "Unable to send packets: %s\n", rte_strerror(errno));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 06/42] pdump: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (4 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 05/42] node: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 07/42] power: " Dengdui Huang
                       ` (35 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/pdump/rte_pdump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 80b90c6f7d..7b7b87bbd1 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -340,7 +340,7 @@ set_pdump_rxtx_cbs(const struct pdump_request *p)
 		if (ret != 0) {
 			PDUMP_LOG(ERR,
 				"Error during getting device (port %u) info: %s\n",
-				port, strerror(-ret));
+				port, rte_strerror(-ret));
 			return ret;
 		}
 
@@ -410,7 +410,7 @@ pdump_server(const struct rte_mp_msg *mp_msg, const void *peer)
 	mp_resp.num_fds = 0;
 	if (rte_mp_reply(&mp_resp, peer) < 0) {
 		PDUMP_LOG(ERR, "failed to send to client:%s\n",
-			  strerror(rte_errno));
+			  rte_strerror(rte_errno));
 		return -1;
 	}
 
@@ -741,7 +741,7 @@ rte_pdump_stats(uint16_t port, struct rte_pdump_stats *stats)
 	if (ret != 0) {
 		PDUMP_LOG(ERR,
 			  "Error during getting device (port %u) info: %s\n",
-			  port, strerror(-ret));
+			  port, rte_strerror(-ret));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 07/42] power: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (5 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 06/42] pdump: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 08/42] vhost: " Dengdui Huang
                       ` (34 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/power/guest_channel.c        | 7 ++++---
 lib/power/power_kvm_vm.c         | 3 ++-
 lib/power/power_pstate_cpufreq.c | 7 ++++---
 lib/power/rte_power_pmd_mgmt.c   | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index 7b2ae0b650..1484b384df 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -14,6 +14,7 @@
 
 #include <rte_log.h>
 #include <rte_power.h>
+#include <rte_errno.h>
 
 #include "guest_channel.h"
 
@@ -75,7 +76,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	fd = open(fd_path, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Unable to connect to '%s' with error "
-				"%s\n", fd_path, strerror(errno));
+				"%s\n", fd_path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -104,7 +105,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	if (ret != 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL,
 				"Error on channel '%s' communications test: %s\n",
-				fd_path, ret > 0 ? strerror(ret) :
+				fd_path, ret > 0 ? rte_strerror(ret) :
 				"channel not connected");
 		goto error;
 	}
@@ -184,7 +185,7 @@ int power_guest_channel_read_msg(void *pkt,
 		return -1;
 	} else if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Error occurred during poll function: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index 6a8109d449..bb9c9b95fe 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -5,6 +5,7 @@
 #include <string.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
@@ -82,7 +83,7 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 	if (ret == 0)
 		return 1;
 	RTE_LOG(DEBUG, POWER, "Error sending message: %s\n",
-			ret > 0 ? strerror(ret) : "channel not connected");
+			ret > 0 ? rte_strerror(ret) : "channel not connected");
 	return -1;
 }
 
diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 5ca5f60bcd..eeb0f3831b 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -13,6 +13,7 @@
 
 #include <rte_memcpy.h>
 #include <rte_stdatomic.h>
+#include <rte_errno.h>
 
 #include "rte_power_pmd_mgmt.h"
 #include "power_pstate_cpufreq.h"
@@ -83,7 +84,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (fd < 0) {
 		RTE_LOG(ERR, POWER, "Error opening '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		return fd;
 	}
 
@@ -91,7 +92,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (ret < 0) {
 		RTE_LOG(ERR, POWER, "Error reading '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		goto out;
 	}
 
@@ -99,7 +100,7 @@ power_read_turbo_pct(uint64_t *outVal)
 	*outVal = (uint64_t) strtol(val, &endptr, 10);
 	if (errno != 0 || (*endptr != 0 && *endptr != '\n')) {
 		RTE_LOG(ERR, POWER, "Error converting str to digits, read from %s: %s\n",
-				 POWER_SYSFILE_TURBO_PCT, strerror(errno));
+				 POWER_SYSFILE_TURBO_PCT, rte_strerror(errno));
 		ret = -1;
 		goto out;
 	}
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index 38f8384085..a61a5c8f98 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -574,7 +574,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
 	ret = queue_list_add(lcore_cfg, &qdata);
 	if (ret < 0) {
 		RTE_LOG(DEBUG, POWER, "Failed to add queue to list: %s\n",
-				strerror(-ret));
+				rte_strerror(-ret));
 		goto end;
 	}
 	/* new queue is always added last */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 08/42] vhost: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (6 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 07/42] power: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 09/42] bpf: " Dengdui Huang
                       ` (33 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/vhost/socket.c     | 13 +++++++------
 lib/vhost/vduse.c      | 31 ++++++++++++++++---------------
 lib/vhost/vhost_user.c | 11 ++++++-----
 3 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 5882e44176..0b030222d6 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -16,6 +16,7 @@
 
 #include <rte_thread.h>
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 #include "vduse.h"
@@ -129,7 +130,7 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m
 	if (ret <= 0) {
 		if (ret)
 			VHOST_LOG_CONFIG(ifname, ERR, "recvmsg failed on fd %d (%s)\n",
-				sockfd, strerror(errno));
+				sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -200,7 +201,7 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f
 
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(ifname, ERR, "sendmsg error on fd %d (%s)\n",
-			sockfd, strerror(errno));
+			sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -358,7 +359,7 @@ create_unix_socket(struct vhost_user_socket *vsocket)
 	if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) {
 		VHOST_LOG_CONFIG(vsocket->path, ERR,
 			"vhost-user: can't set nonblocking mode for socket, fd: %d (%s)\n",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -392,7 +393,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket)
 	ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(path, ERR, "failed to bind: %s; remove it and try again\n",
-			strerror(errno));
+			rte_strerror(errno));
 		goto err;
 	}
 	VHOST_LOG_CONFIG(path, INFO, "binding succeeded\n");
@@ -445,7 +446,7 @@ vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz)
 	flags = fcntl(fd, F_GETFL, 0);
 	if (flags < 0) {
 		VHOST_LOG_CONFIG(path, ERR, "can't get flags for connfd %d (%s)\n",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		return -2;
 	}
 	if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) {
@@ -539,7 +540,7 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
 		return 0;
 	}
 
-	VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", strerror(errno));
+	VHOST_LOG_CONFIG(path, WARNING, "failed to connect: %s\n", rte_strerror(errno));
 
 	if (ret == -2 || !vsocket->reconnect) {
 		close(fd);
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index 080b58f7de..e2e056754c 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -17,6 +17,7 @@
 
 #include <rte_common.h>
 #include <rte_thread.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 #include "iotlb.h"
@@ -135,7 +136,7 @@ vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &buf, sizeof(buf));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read control queue event: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -157,7 +158,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_GET_INFO, &vq_info);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get VQ %u info: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		return;
 	}
 
@@ -183,7 +184,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	vq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (vq->kickfd < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to init kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		vq->kickfd = VIRTIO_INVALID_EVENTFD;
 		return;
 	}
@@ -213,7 +214,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to setup kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		close(vq->kickfd);
 		vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
 		return;
@@ -224,7 +225,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index)
 		if (ret) {
 			VHOST_LOG_CONFIG(dev->ifname, ERR,
 					"Failed to setup kickfd handler for VQ %u: %s\n",
-					index, strerror(errno));
+					index, rte_strerror(errno));
 			vq_efd.fd = VDUSE_EVENTFD_DEASSIGN;
 			ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 			close(vq->kickfd);
@@ -254,7 +255,7 @@ vduse_vring_cleanup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret)
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s\n",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 
 	close(vq->kickfd);
 	vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
@@ -291,7 +292,7 @@ vduse_device_start(struct virtio_net *dev)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_DEV_GET_FEATURES, &dev->features);
 	if (ret) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to get features: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -358,7 +359,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &req, sizeof(req));
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to read request: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	} else if (ret < (int)sizeof(req)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Incomplete to read request %d\n", ret);
@@ -400,7 +401,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = write(dev->vduse_dev_fd, &resp, sizeof(resp));
 	if (ret != sizeof(resp)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR, "Failed to write response %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -453,13 +454,13 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	control_fd = open(VDUSE_CTRL_PATH, O_RDWR);
 	if (control_fd < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to open %s: %s\n",
-				VDUSE_CTRL_PATH, strerror(errno));
+				VDUSE_CTRL_PATH, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(control_fd, VDUSE_SET_API_VERSION, &ver)) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to set API version: %" PRIu64 ": %s\n",
-				ver, strerror(errno));
+				ver, rte_strerror(errno));
 		ret = -1;
 		goto out_ctrl_close;
 	}
@@ -507,14 +508,14 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	ret = ioctl(control_fd, VDUSE_CREATE_DEV, dev_config);
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to create VDUSE device: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		goto out_free;
 	}
 
 	dev_fd = open(path, O_RDWR);
 	if (dev_fd < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to open device %s: %s\n",
-				path, strerror(errno));
+				path, rte_strerror(errno));
 		ret = -1;
 		goto out_dev_close;
 	}
@@ -522,7 +523,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	ret = fcntl(dev_fd, F_SETFL, O_NONBLOCK);
 	if (ret < 0) {
 		VHOST_LOG_CONFIG(name, ERR, "Failed to set chardev as non-blocking: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		goto out_dev_close;
 	}
 
@@ -625,7 +626,7 @@ vduse_device_destroy(const char *path)
 		ret = ioctl(dev->vduse_ctrl_fd, VDUSE_DESTROY_DEV, name);
 		if (ret)
 			VHOST_LOG_CONFIG(name, ERR, "Failed to destroy VDUSE device: %s\n",
-					strerror(errno));
+					rte_strerror(errno));
 		close(dev->vduse_ctrl_fd);
 		dev->vduse_ctrl_fd = -1;
 	}
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index e36312181a..ebf5afe45d 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -772,7 +772,8 @@ mem_set_dump(void *ptr, size_t size, bool enable, uint64_t pagesz)
 
 	if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) {
 		rte_log(RTE_LOG_INFO, vhost_config_log_level,
-			"VHOST_CONFIG: could not set coredump preference (%s).\n", strerror(errno));
+			"VHOST_CONFIG: could not set coredump preference (%s).\n",
+			rte_strerror(errno));
 	}
 #endif
 }
@@ -1138,7 +1139,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev,
 			(uint64_t)reg_struct.range.start +
 			(uint64_t)reg_struct.range.len - 1,
 			dev->postcopy_ufd,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -1267,7 +1268,7 @@ vhost_user_mmap_region(struct virtio_net *dev,
 			MAP_SHARED | populate, region->fd, 0);
 
 	if (mmap_addr == MAP_FAILED) {
-		VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", strerror(errno));
+		VHOST_LOG_CONFIG(dev->ifname, ERR, "mmap failed (%s).\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -2698,7 +2699,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (dev->postcopy_ufd == -1) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR,
 			"userfaultfd not available: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		return RTE_VHOST_MSG_RESULT_ERR;
 	}
 	api_struct.api = UFFD_API;
@@ -2706,7 +2707,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) {
 		VHOST_LOG_CONFIG(dev->ifname, ERR,
 			"UFFDIO_API ioctl failure: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dev->postcopy_ufd);
 		dev->postcopy_ufd = -1;
 		return RTE_VHOST_MSG_RESULT_ERR;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 09/42] bpf: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (7 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 08/42] vhost: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 10/42] bus/cdx: " Dengdui Huang
                       ` (32 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/bpf/bpf_load_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bpf/bpf_load_elf.c b/lib/bpf/bpf_load_elf.c
index 02a5d8ba0d..6fc7018ddf 100644
--- a/lib/bpf/bpf_load_elf.c
+++ b/lib/bpf/bpf_load_elf.c
@@ -310,7 +310,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	if (fd < 0) {
 		rc = errno;
 		RTE_BPF_LOG(ERR, "%s(%s) error code: %d(%s)\n",
-			__func__, fname, rc, strerror(rc));
+			__func__, fname, rc, rte_strerror(rc));
 		rte_errno = EINVAL;
 		return NULL;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 10/42] bus/cdx: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (8 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 09/42] bpf: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 11/42] bus/dpaa: " Dengdui Huang
                       ` (31 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/cdx/cdx.c      |  2 +-
 drivers/bus/cdx/cdx_vfio.c | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 541aae76c3..a3161f8ee4 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -271,7 +271,7 @@ cdx_scan(void)
 	dir = opendir(RTE_CDX_BUS_DEVICES_PATH);
 	if (dir == NULL) {
 		CDX_BUS_INFO("%s(): opendir failed: %s", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 8a3ac0b995..6fb38abfac 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -20,6 +20,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "bus_cdx_driver.h"
 #include "cdx_logs.h"
@@ -198,7 +199,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			CDX_BUS_ERR("Cannot get VFIO IRQ info, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -216,7 +217,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			CDX_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -252,7 +253,7 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd,
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		CDX_BUS_ERR("Unable to reset device! Error: %d (%s)", errno,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -410,7 +411,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s cannot get device region info error %i (%s)",
-				dev_name, errno, strerror(errno));
+				dev_name, errno, rte_strerror(errno));
 			goto err_vfio_res;
 		}
 
@@ -438,7 +439,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, 0);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping region %i failed: %s",
-				cdx_addr, i, strerror(errno));
+				cdx_addr, i, rte_strerror(errno));
 			free(reg);
 			goto err_vfio_res;
 		}
@@ -506,7 +507,7 @@ cdx_vfio_map_resource_secondary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping MMIO region %i failed: %s",
-				dev_name, i, strerror(errno));
+				dev_name, i, rte_strerror(errno));
 			goto err_vfio_dev_fd;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 11/42] bus/dpaa: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (9 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 10/42] bus/cdx: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 12/42] bus/fslmc: " Dengdui Huang
                       ` (30 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 2 +-
 drivers/bus/dpaa/dpaa_bus.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 1814372a40..fe694e447c 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -725,7 +725,7 @@ fman_finish(void)
 		if (unlikely(_errno < 0))
 			fprintf(stderr, "%s:%d:%s(): munmap() = %d (%s)\n",
 				__FILE__, __LINE__, __func__,
-				-errno, strerror(errno));
+				-errno, rte_strerror(errno));
 		printf("Tearing down %s\n", __if->node_path);
 		list_del(&__if->__if.node);
 		rte_free(__if);
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index e57159f5d8..ea80168b7c 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -605,7 +605,7 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		DPAA_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return errno;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 12/42] bus/fslmc: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (10 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 11/42] bus/dpaa: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 13/42] bus/pci: " Dengdui Huang
                       ` (29 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 5966776a85..1cbbcf9019 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -481,7 +481,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get group status, "
 				"error %i (%s)\n", dev_addr,
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -504,7 +504,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			DPAA2_BUS_ERR("  %s cannot add VFIO group to container, "
 					"error %i (%s)\n", dev_addr,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			close(vfio_container_fd);
 			rte_vfio_clear_group(vfio_group_fd);
@@ -551,7 +551,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info);
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get device info, error %i (%s)",
-				dev_addr, errno, strerror(errno));
+				dev_addr, errno, rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		close(vfio_container_fd);
@@ -617,7 +617,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index)
 	if (ret) {
 		DPAA2_BUS_ERR("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)",
 			      rte_intr_fd_get(intr_handle), errno,
-			      strerror(errno));
+			      rte_strerror(errno));
 		return ret;
 	}
 
@@ -667,7 +667,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info);
 		if (ret < 0) {
 			DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)",
-				      i, errno, strerror(errno));
+				      i, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -682,7 +682,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				      errno, strerror(errno));
+				      errno, rte_strerror(errno));
 			return -1;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 13/42] bus/pci: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (11 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 12/42] bus/fslmc: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 14/42] bus/vdev: " Dengdui Huang
                       ` (28 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/pci/bsd/pci.c        |  8 ++++----
 drivers/bus/pci/linux/pci.c      |  7 ++++---
 drivers/bus/pci/linux/pci_uio.c  | 23 ++++++++++++-----------
 drivers/bus/pci/linux/pci_vfio.c | 23 ++++++++++++-----------
 drivers/bus/pci/pci_common_uio.c |  3 ++-
 5 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 27f12590d4..ce08372931 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -125,7 +125,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
 	if (rte_intr_fd_get(dev->intr_handle) < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -169,7 +169,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
 	if (maps[map_idx].path == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -179,7 +179,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+				devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -353,7 +353,7 @@ rte_pci_scan(void)
 		unsigned i;
 		if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
 			RTE_LOG(ERR, EAL, "%s(): error with ioctl on /dev/pci: %s\n",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 			goto error;
 		}
 
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 3d237398d9..7d870b43d2 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -12,6 +12,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -455,7 +456,7 @@ rte_pci_scan(void)
 	dir = opendir(rte_pci_get_sysfs_path());
 	if (dir == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -506,7 +507,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev)
 			return true;
 
 		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return false;
 	}
 
@@ -557,7 +558,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
 
 	if (fp == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return ret;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 97d740dfe5..2ee0179ea2 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -21,6 +21,7 @@
 #include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
@@ -111,7 +112,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
 	ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);
 	if (ret != 0) {
 		RTE_LOG(ERR, EAL, "%s(): mknod() failed %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -241,7 +242,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -254,7 +255,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	uio_cfg_fd = open(cfgname, O_RDWR);
 	if (uio_cfg_fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-			cfgname, strerror(errno));
+			cfgname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -314,7 +315,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0);
 	if (maps[map_idx].path == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -348,7 +349,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 		fd = open(devname, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				devname, strerror(errno));
+				devname, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -404,7 +405,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		RTE_LOG(ERR, EAL, "%s(): Cannot open sysfs resource: %s\n",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -446,7 +447,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
 		if (uio_num < 0) {
 			RTE_LOG(ERR, EAL, "cannot open %s: %s\n",
-				dirname, strerror(errno));
+				dirname, rte_strerror(errno));
 			goto error;
 		}
 
@@ -454,7 +455,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		fd = open(filename, O_RDWR);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-				filename, strerror(errno));
+				filename, rte_strerror(errno));
 			goto error;
 		}
 		if (rte_intr_fd_set(dev->intr_handle, fd))
@@ -494,7 +495,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		RTE_LOG(ERR, EAL, "Cannot open sysfs resource: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 	for (i = 0; i < bar + 1; i++) {
@@ -518,7 +519,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	fd = open(filename, O_RDWR);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", filename,
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE,
@@ -526,7 +527,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	close(fd);
 	if (addr == MAP_FAILED) {
 		RTE_LOG(ERR, EAL, "Cannot mmap IO port resource: %s\n",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 3f3201daf2..671b0f36bc 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -21,6 +21,7 @@
 #include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -225,7 +226,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL, "Cannot get VFIO IRQ info, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -252,7 +253,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			RTE_LOG(ERR, EAL, "Cannot set up eventfd, error "
-					"%i (%s)\n", errno, strerror(errno));
+					"%i (%s)\n", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -336,7 +337,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		RTE_LOG(ERR, EAL, "Cannot set up eventfd, error %i (%s)\n",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -460,7 +461,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		RTE_LOG(ERR, EAL, "Unable to reset device! Error: %d (%s)\n",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -742,7 +743,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd,
 		ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			RTE_LOG(DEBUG, EAL, "%s cannot get device region info error %i (%s)\n",
-				dev->name, errno, strerror(errno));
+				dev->name, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -811,7 +812,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		VFIO_PCI_CONFIG_REGION_INDEX);
 	if (ret < 0) {
 		RTE_LOG(ERR, EAL, "%s cannot get device region info error %i (%s)\n",
-			dev->name, errno, strerror(errno));
+			dev->name, errno, rte_strerror(errno));
 		goto err_vfio_res;
 	}
 	pdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size;
@@ -851,7 +852,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		if (ret < 0) {
 			RTE_LOG(ERR, EAL,
 				"%s cannot get device region info error "
-				"%i (%s)\n", pci_addr, errno, strerror(errno));
+				"%i (%s)\n", pci_addr, errno, rte_strerror(errno));
 			goto err_map;
 		}
 
@@ -914,7 +915,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -922,7 +923,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -1019,14 +1020,14 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s sparse mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		} else {
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				RTE_LOG(ERR, EAL, "%s mapping BAR%i failed: %s\n",
-						pci_addr, i, strerror(errno));
+						pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		}
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index 76c661f054..5d59a90b33 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -15,6 +15,7 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -44,7 +45,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 			fd = open(uio_res->maps[i].path, O_RDWR);
 			if (fd < 0) {
 				RTE_LOG(ERR, EAL, "Cannot open %s: %s\n",
-					uio_res->maps[i].path, strerror(errno));
+					uio_res->maps[i].path, rte_strerror(errno));
 				return -1;
 			}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 14/42] bus/vdev: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (12 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 13/42] bus/pci: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 15/42] bus/vmbus: " Dengdui Huang
                       ` (27 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/vdev/vdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index 7974b27295..bdb5fa8fce 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -432,7 +432,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 			strlcpy(ou->name, devname, RTE_DEV_NAME_MAX_LEN);
 			if (rte_mp_sendmsg(&mp_resp) < 0)
 				VDEV_LOG(ERR, "send vdev, %s, failed, %s",
-					 devname, strerror(rte_errno));
+					 devname, rte_strerror(rte_errno));
 			num++;
 		}
 		rte_spinlock_recursive_unlock(&vdev_device_list_lock);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 15/42] bus/vmbus: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (13 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 14/42] bus/vdev: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 16/42] common/cnxk: " Dengdui Huang
                       ` (26 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/bus/vmbus/linux/vmbus_bus.c  |  7 ++++---
 drivers/bus/vmbus/linux/vmbus_uio.c  | 21 +++++++++++----------
 drivers/bus/vmbus/vmbus_common.c     |  4 ++--
 drivers/bus/vmbus/vmbus_common_uio.c |  3 ++-
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 01d8111b85..0c92c1d4dd 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -18,6 +18,7 @@
 #include <rte_memory.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "private.h"
@@ -50,7 +51,7 @@ parse_sysfs_uuid(const char *filename, rte_uuid_t uu)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s: %s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -92,7 +93,7 @@ get_sysfs_string(const char *filename, char *buf, size_t buflen)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s:%s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -350,7 +351,7 @@ rte_vmbus_scan(void)
 			return 0;
 
 		VMBUS_LOG(ERR, "opendir %s failed: %s",
-			  SYSFS_VMBUS_DEVICES, strerror(errno));
+			  SYSFS_VMBUS_DEVICES, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 26edef342d..5fce68d880 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -18,6 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
 #include <rte_string_fns.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -34,7 +35,7 @@ void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff)
 		  sizeof(onoff)) < 0) {
 		VMBUS_LOG(ERR, "cannot write to %d:%s",
 			  rte_intr_fd_get(dev->intr_handle),
-			  strerror(errno));
+			  rte_strerror(errno));
 	}
 }
 
@@ -51,7 +52,7 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev)
 	if (cc < (int)sizeof(count)) {
 		if (cc < 0) {
 			VMBUS_LOG(ERR, "IRQ read failed %s",
-				  strerror(errno));
+				  rte_strerror(errno));
 			return -errno;
 		}
 		VMBUS_LOG(ERR, "can't read IRQ count");
@@ -91,7 +92,7 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -158,7 +159,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -256,13 +257,13 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
 	fd = open(ring_path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		return -errno;
 	}
 
 	if (fstat(fd, &sb) < 0) {
 		VMBUS_LOG(ERR, "Cannot state %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		close(fd);
 		return -errno;
 	}
@@ -342,7 +343,7 @@ static int vmbus_uio_sysfs_read(const char *dir, const char *name,
 	f = fopen(path, "r");
 	if (!f) {
 		VMBUS_LOG(ERR, "can't open %s:%s",
-			  path, strerror(errno));
+			  path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -404,7 +405,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 	chan_dir = opendir(chan_path);
 	if (!chan_dir) {
 		VMBUS_LOG(ERR, "cannot open %s: %s",
-			  chan_path, strerror(errno));
+			  chan_path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -441,7 +442,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &subid, UINT16_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no subchannel_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
@@ -452,7 +453,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &monid, UINT8_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no monitor_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index b9139c6e6c..e1a80c9587 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -38,7 +38,7 @@ vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 		VMBUS_LOG(ERR,
 			  "mmap(%d, %p, %zu, %ld) failed: %s",
 			  fd, requested_addr, size, (long)offset,
-			  strerror(errno));
+			  rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory mapped at %p",
 			  mapaddr);
@@ -57,7 +57,7 @@ vmbus_unmap_resource(void *requested_addr, size_t size)
 	if (munmap(requested_addr, size)) {
 		VMBUS_LOG(ERR, "munmap(%p, 0x%lx) failed: %s",
 			requested_addr, (unsigned long)size,
-			strerror(errno));
+			rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory unmapped at %p",
 			  requested_addr);
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 4d4613513c..54c1187026 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -14,6 +14,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -56,7 +57,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 16/42] common/cnxk: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (14 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 15/42] bus/vmbus: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 17/42] common/mlx5: " Dengdui Huang
                       ` (25 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/common/cnxk/roc_dev.c   | 4 +++-
 drivers/common/cnxk/roc_model.c | 4 +++-
 drivers/common/cnxk/roc_utils.c | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index e7e89bf3d6..812e6890f0 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -8,6 +8,8 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -1313,7 +1315,7 @@ dev_lmt_setup(struct dev *dev)
 	mz = plt_lmt_region_reserve_aligned(name, LMT_REGION_SIZE,
 					    LMT_REGION_SIZE);
 	if (!mz) {
-		plt_err("Memory alloc failed: %s", strerror(errno));
+		plt_err("Memory alloc failed: %s", rte_strerror(errno));
 		goto fail;
 	}
 
diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index 6dc2afe7f0..647af4b7ab 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -6,6 +6,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -154,7 +156,7 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass)
 	dir = opendir(SYSFS_PCI_DEVICES);
 	if (dir == NULL) {
 		plt_err("%s(): opendir failed: %s\n", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return -errno;
 	}
 
diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c
index 9af2ae9b69..418cd6b477 100644
--- a/drivers/common/cnxk/roc_utils.c
+++ b/drivers/common/cnxk/roc_utils.c
@@ -2,6 +2,8 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -245,7 +247,7 @@ roc_error_msg_get(int errorcode)
 		 * Handle general error (as defined in linux errno.h)
 		 */
 		if (abs(errorcode) < 300)
-			err_msg = strerror(abs(errorcode));
+			err_msg = rte_strerror(abs(errorcode));
 		else
 			err_msg = "Unknown error code";
 		break;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 17/42] common/mlx5: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (15 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 16/42] common/cnxk: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 18/42] crypto/caam_jr: " Dengdui Huang
                       ` (24 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/common/mlx5/linux/mlx5_nl.c  | 12 ++++++------
 drivers/common/mlx5/mlx5_common.c    |  6 +++---
 drivers/common/mlx5/mlx5_devx_cmds.c |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index 28a1f56dba..1de867089f 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -547,7 +547,7 @@ mlx5_nl_mac_addr_list(int nlsk_fd, unsigned int iface_idx,
 	return 0;
 error:
 	DRV_LOG(DEBUG, "Interface %u cannot retrieve MAC address list %s",
-		iface_idx, strerror(rte_errno));
+		iface_idx, rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -617,7 +617,7 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s MAC address %s %s",
 			iface_idx,
-			add ? "add" : "remove", m, strerror(rte_errno));
+			add ? "add" : "remove", m, rte_strerror(rte_errno));
 	}
 #endif
 	return -rte_errno;
@@ -704,7 +704,7 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		RTE_ETHER_ADDR_PRT_FMT " : %s",
 		vf_index,
 		RTE_ETHER_ADDR_BYTES(mac),
-		strerror(rte_errno));
+		rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -929,7 +929,7 @@ mlx5_nl_promisc(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s promisc mode: Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -956,7 +956,7 @@ mlx5_nl_allmulti(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s allmulti : Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -1934,7 +1934,7 @@ mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg)
 			if (errno == EINTR)
 				continue;
 			DRV_LOG(DEBUG, "Failed to receive netlink message: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return -rte_errno;
 		}
diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index ca8543e36e..7aafd0083d 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -762,7 +762,7 @@ mlx5_common_dev_create(struct rte_device *eal_dev, uint32_t classes,
 	ret = mlx5_common_config_get(mkvlist, &cdev->config);
 	if (ret < 0) {
 		DRV_LOG(ERR, "Failed to process device arguments: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		rte_free(cdev);
 		return NULL;
 	}
@@ -837,7 +837,7 @@ mlx5_common_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_common_config_get(mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
@@ -1011,7 +1011,7 @@ mlx5_common_dev_probe(struct rte_device *eal_dev)
 		if (ret) {
 			DRV_LOG(ERR,
 				"Probe again parameters aren't compatible : %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto class_err;
 		}
 	}
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 4d8818924a..b33b5d3044 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -640,7 +640,7 @@ mlx5_devx_cmd_match_sample_info_query(void *ctx, uint32_t sample_field_id,
 	rc = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out, sizeof(out));
 	if (rc) {
 		DRV_LOG(ERR, "Failed to query match sample info using DevX: %s",
-			strerror(rc));
+			rte_strerror(rc));
 		rte_errno = rc;
 		return -rc;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 18/42] crypto/caam_jr: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (16 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 17/42] common/mlx5: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 19/42] dma/idxd: " Dengdui Huang
                       ` (23 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 583ba3b523..b612407c41 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -17,6 +17,7 @@
 #include <rte_malloc.h>
 #include <rte_crypto.h>
 #include <rte_security.h>
+#include <rte_errno.h>
 
 #include <caam_jr_config.h>
 #include <caam_jr_hw_specific.h>
@@ -355,7 +356,7 @@ free_job_ring(int uio_fd)
 	if (munmap(job_ring->register_base_addr, job_ring->map_size)) {
 		CAAM_JR_INFO("cannot munmap(%p, 0x%lx): %s",
 			job_ring->register_base_addr,
-			(unsigned long)job_ring->map_size, strerror(errno));
+			(unsigned long)job_ring->map_size, rte_strerror(errno));
 	} else
 		CAAM_JR_DEBUG("JR UIO memory is unmapped");
 
@@ -419,7 +420,7 @@ sec_configure(void)
 	d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		printf("\nError opening directory '%s': %s\n",
-			SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 19/42] dma/idxd: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (17 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 18/42] crypto/caam_jr: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 20/42] net/af_packet: " Dengdui Huang
                       ` (22 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/dma/idxd/idxd_bus.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 3b2d4c2b65..d0919504af 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -16,6 +16,7 @@
 #include <rte_log.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_string_fns.h>
+#include <rte_errno.h>
 
 #include "idxd_internal.h"
 
@@ -145,7 +146,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	fd = open(sysfs_node, O_RDONLY);
 	if (fd < 0) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
@@ -153,7 +154,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	close(fd);
 	if (len < 0) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 	value[len] = '\0';
@@ -173,13 +174,13 @@ read_wq_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -200,13 +201,13 @@ read_device_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -317,7 +318,7 @@ dsa_scan(void)
 		if (errno == ENOENT)
 			return 0; /* no bus, return without error */
 		IDXD_PMD_ERR("%s(): opendir '%s' failed: %s",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 20/42] net/af_packet: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (18 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 19/42] dma/idxd: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 21/42] net/bnxt: " Dengdui Huang
                       ` (21 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 397a32db58..2f884d4b7f 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -108,7 +108,7 @@ RTE_LOG_REGISTER_DEFAULT(af_packet_logtype, NOTICE);
 
 #define PMD_LOG_ERRNO(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
-		"%s(): " fmt ":%s\n", __func__, ##args, strerror(errno))
+		"%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno))
 
 static uint16_t
 eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 21/42] net/bnxt: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (19 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 20/42] net/af_packet: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 22/42] net/af_xdp: " Dengdui Huang
                       ` (20 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 17 files changed, 360 insertions(+), 360 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 0e25207fc3..4212065b32 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -942,7 +942,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 	ret = bnxt_hwrm_port_clr_stats(bp);
 	if (ret != 0)
 		PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n",
-			    strerror(-ret));
+			    rte_strerror(-ret));
 
 	bnxt_clear_prev_stat(bp);
 
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index 964a5aeb05..558085ec0c 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -149,7 +149,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -191,7 +191,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -249,7 +249,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -308,7 +308,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -365,7 +365,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -409,7 +409,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -600,7 +600,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -636,7 +636,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -670,7 +670,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -705,7 +705,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -744,7 +744,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -827,7 +827,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -871,7 +871,7 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG(ERR,
 			"Error during getting device (port %u) info: %s\n",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 3a812bee3a..2c7ee09888 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -205,7 +205,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -215,7 +215,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -232,7 +232,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM insert failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -261,7 +261,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -271,7 +271,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -285,7 +285,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM delete failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -313,7 +313,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -323,7 +323,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -338,7 +338,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -347,7 +347,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -375,7 +375,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -385,7 +385,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -400,7 +400,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -409,7 +409,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -437,7 +437,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -456,7 +456,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -468,7 +468,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -497,7 +497,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -507,7 +507,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -516,7 +516,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -529,7 +529,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -566,7 +566,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -575,7 +575,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -589,7 +589,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier search failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -615,7 +615,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -625,7 +625,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -634,7 +634,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -656,7 +656,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -688,7 +688,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -707,7 +707,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -720,7 +720,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -748,7 +748,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -758,7 +758,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -768,7 +768,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -786,7 +786,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	TFP_DRV_LOG(DEBUG,
@@ -816,7 +816,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -826,7 +826,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -835,7 +835,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -853,7 +853,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_sz_in_bits = gparms.key_size * 8;
@@ -881,7 +881,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -891,7 +891,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -900,7 +900,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -935,7 +935,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -945,7 +945,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -954,7 +954,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -963,7 +963,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries move failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -986,7 +986,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -996,7 +996,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1005,7 +1005,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1014,7 +1014,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries clear failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1042,7 +1042,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1052,7 +1052,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1067,7 +1067,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1076,7 +1076,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: External table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1085,7 +1085,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1094,7 +1094,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1124,7 +1124,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1134,7 +1134,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1149,7 +1149,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1158,7 +1158,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1167,7 +1167,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1177,7 +1177,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1204,7 +1204,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1214,7 +1214,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1231,7 +1231,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1240,7 +1240,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}  else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1249,7 +1249,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1258,7 +1258,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1267,7 +1267,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1295,7 +1295,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1305,7 +1305,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	gparms.dir = parms->dir;
@@ -1320,7 +1320,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1329,7 +1329,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1338,7 +1338,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1366,7 +1366,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1376,7 +1376,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1393,7 +1393,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s, External table type not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 
 		return rc;
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1402,7 +1402,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table bulk get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		}
 		return rc;
 	}
@@ -1412,7 +1412,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1421,7 +1421,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Table get bulk failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -1442,7 +1442,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1452,7 +1452,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1463,7 +1463,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1472,7 +1472,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Get table increment not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1494,7 +1494,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1503,7 +1503,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1532,7 +1532,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1541,7 +1541,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1571,7 +1571,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1580,7 +1580,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1612,7 +1612,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1622,7 +1622,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1631,7 +1631,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1646,7 +1646,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1670,7 +1670,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1680,7 +1680,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1689,7 +1689,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1704,7 +1704,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1725,7 +1725,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1734,7 +1734,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1744,7 +1744,7 @@ int tf_get_session_info(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1752,14 +1752,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Ident get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tbl_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1767,14 +1767,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Tbl get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tcam_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1782,14 +1782,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "TCAM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_em_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1797,7 +1797,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -1861,7 +1861,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1870,7 +1870,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1901,7 +1901,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1911,7 +1911,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1943,7 +1943,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1952,7 +1952,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1984,7 +1984,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1993,7 +1993,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c
index c518150d1f..162bc275b9 100644
--- a/drivers/net/bnxt/tf_core/tf_em_common.c
+++ b/drivers/net/bnxt/tf_core/tf_em_common.c
@@ -51,7 +51,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (tfp_calloc(&parms) != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: external pool failure %s\n",
-			    tf_dir_2_str(dir), strerror(ENOMEM));
+			    tf_dir_2_str(dir), rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -61,7 +61,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (rc != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: stack init failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -78,7 +78,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 		rc = stack_push(pool, j);
 		if (rc != 0) {
 			TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-				    tf_dir_2_str(dir), strerror(-rc));
+				    tf_dir_2_str(dir), rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -93,7 +93,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 	if (!stack_is_full(pool)) {
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 	return 0;
@@ -921,7 +921,7 @@ tf_em_ext_common_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_ext_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -980,7 +980,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -989,7 +989,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -997,7 +997,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1157,7 +1157,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Map table scope operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1167,14 +1167,14 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 	data = aparms.mem_va;
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		rc = -ENOMEM;
 		goto clean;
 	}
@@ -1188,7 +1188,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map table scope config failure, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleaner;
 	}
 
@@ -1203,7 +1203,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map tbl scope, set failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 cleaner:
 	tfp_free(mask);
diff --git a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
index d72ac83295..fe9c710f26 100644
--- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
@@ -130,7 +130,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -165,7 +165,7 @@ tf_em_move_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c
index 9efffe4ee5..55d27b88a2 100644
--- a/drivers/net/bnxt/tf_core/tf_em_host.c
+++ b/drivers/net/bnxt/tf_core/tf_em_host.c
@@ -182,7 +182,7 @@ tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl)
 			TFP_DRV_LOG(WARNING,
 				"Failed to allocate page table: lvl: %d, rc:%s\n",
 				i,
-				strerror(-rc));
+				rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -379,7 +379,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -387,7 +387,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
@@ -396,7 +396,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EEM: PF query error rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -420,7 +420,7 @@ tf_em_ext_alloc(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			"Failed to allocate session table scope, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -436,7 +436,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to query for EEM capability,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 	}
@@ -456,7 +456,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to register for EEM ctx,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 
@@ -473,7 +473,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "TBL: Unable to configure EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -485,7 +485,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to enable EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -501,7 +501,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s TBL: Unable to allocate idx pools %s\n",
 				    tf_dir_2_str(dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 	}
@@ -547,7 +547,7 @@ tf_em_ext_free(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -555,7 +555,7 @@ tf_em_ext_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
index 46de63a9da..21cf19c45e 100644
--- a/drivers/net/bnxt/tf_core/tf_em_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
@@ -49,7 +49,7 @@ tf_em_insert_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -113,7 +113,7 @@ tf_em_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -153,7 +153,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -163,7 +163,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -202,7 +202,7 @@ tf_em_int_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -232,7 +232,7 @@ tf_em_int_bind(struct tf *tfp,
 				    "%s, EM Allocation must be in blocks of %d, failure %s\n",
 				    tf_dir_2_str(i),
 				    TF_SESSION_EM_ENTRY_SIZE,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 			return rc;
 		}
@@ -278,7 +278,7 @@ tf_em_int_bind(struct tf *tfp,
 				TFP_DRV_LOG(ERR,
 					 "%s, EM stack allocation failure %s\n",
 					 tf_dir_2_str(i),
-					 strerror(-rc));
+					 rte_strerror(-rc));
 				return rc;
 			}
 
diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c
index 3a8030a2fb..ba748fdc23 100644
--- a/drivers/net/bnxt/tf_core/tf_global_cfg.c
+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c
@@ -83,7 +83,7 @@ tf_global_cfg_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -141,7 +141,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -151,7 +151,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -185,7 +185,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -196,7 +196,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c
index 7d9d9595dd..21e60a8ad5 100644
--- a/drivers/net/bnxt/tf_core/tf_identifier.c
+++ b/drivers/net/bnxt/tf_core/tf_identifier.c
@@ -39,7 +39,7 @@ tf_ident_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "ident_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -124,7 +124,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -164,7 +164,7 @@ tf_ident_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -222,7 +222,7 @@ tf_ident_search(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c
index 578d361417..4d85b77b4e 100644
--- a/drivers/net/bnxt/tf_core/tf_if_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c
@@ -65,7 +65,7 @@ tf_if_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_if_tbl_set(struct tf *tfp,
 			    "%s, If Tbl set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -187,7 +187,7 @@ tf_if_tbl_get(struct tf *tfp,
 			    "%s, If Tbl get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c
index 1c66c7e01a..5e180813d8 100644
--- a/drivers/net/bnxt/tf_core/tf_msg.c
+++ b/drivers/net/bnxt/tf_core/tf_msg.c
@@ -216,7 +216,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -224,7 +224,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -291,7 +291,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -299,7 +299,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -361,7 +361,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -370,7 +370,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -378,7 +378,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(WARNING,
 			    "%s: QCAPS message size error, rc:%s, request %d vs response %d\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL),
+			    rte_strerror(EINVAL),
 			    size,
 			    resp.size);
 	}
@@ -498,7 +498,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -509,7 +509,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -559,7 +559,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -605,7 +605,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -616,7 +616,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -666,7 +666,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -712,7 +712,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -722,7 +722,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -731,7 +731,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -797,7 +797,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -807,7 +807,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -816,7 +816,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -830,7 +830,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -893,7 +893,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -903,7 +903,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -927,7 +927,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Record size to large, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -982,7 +982,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -992,7 +992,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1001,7 +1001,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1050,7 +1050,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1060,7 +1060,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1069,7 +1069,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1129,7 +1129,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1149,7 +1149,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 		rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n",
-				strerror(-rc));
+				rte_strerror(-rc));
 			return rc;
 		}
 
@@ -1180,7 +1180,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1189,7 +1189,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1231,7 +1231,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1240,7 +1240,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1284,7 +1284,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1293,7 +1293,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1334,7 +1334,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1345,7 +1345,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1401,7 +1401,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1411,7 +1411,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1465,7 +1465,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1475,7 +1475,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1534,7 +1534,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1544,7 +1544,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1585,7 +1585,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1594,7 +1594,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1664,7 +1664,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1673,7 +1673,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1705,7 +1705,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    parms->key_size,
 			    resp.key_size,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_size = resp.key_size;
@@ -1734,7 +1734,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1743,7 +1743,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(in_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1793,7 +1793,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1803,7 +1803,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1812,7 +1812,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1877,7 +1877,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1887,7 +1887,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1896,7 +1896,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -1964,7 +1964,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1974,7 +1974,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1983,7 +1983,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2043,7 +2043,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2053,7 +2053,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2062,7 +2062,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2082,7 +2082,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2140,7 +2140,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2150,7 +2150,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2159,7 +2159,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -2217,7 +2217,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2227,7 +2227,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2278,7 +2278,7 @@ tf_msg_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2366,7 +2366,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2375,7 +2375,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2383,7 +2383,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2421,7 +2421,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2430,7 +2430,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2438,7 +2438,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c
index 9b85f5397d..05d05befaa 100644
--- a/drivers/net/bnxt/tf_core/tf_rm.c
+++ b/drivers/net/bnxt/tf_core/tf_rm.c
@@ -1059,7 +1059,7 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db,
 			    "%s: Invalid pool for this type:%d, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
 			    tmp_subtype,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	*new_subtype = tmp_subtype;
@@ -1106,7 +1106,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Allocation failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc adjust of base index failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
index 253d716572..a1f9848aed 100644
--- a/drivers/net/bnxt/tf_core/tf_session.c
+++ b/drivers/net/bnxt/tf_core/tf_session.c
@@ -78,11 +78,11 @@ tf_session_create(struct tf *tfp,
 		if (rc == -EEXIST)
 			TFP_DRV_LOG(ERR,
 				    "Session is already open, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		else
 			TFP_DRV_LOG(ERR,
 				    "Open message send failed, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 		parms->open_cfg->session_id.id = TF_FW_SESSION_ID_INVALID;
 		return rc;
@@ -97,7 +97,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session info, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session = (struct tf_session_info *)cparms.mem_va;
@@ -111,7 +111,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session->core_data = cparms.mem_va;
@@ -154,7 +154,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -226,7 +226,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	if (tfp->session) {
 		tfp_free(tfp->session->core_data);
@@ -268,7 +268,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -289,7 +289,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to create client on session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -303,7 +303,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -320,7 +320,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session Firmware id lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -373,7 +373,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -405,7 +405,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Client destroy on FW Failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	ll_delete(&tfs->client_ll, &client->ll_entry);
@@ -435,7 +435,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to create session, ctrl_chan_name:%s, rc:%s\n",
 				    parms->open_cfg->ctrl_chan_name,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -457,7 +457,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 			      "Failed to create client on session 0x%x, rc:%s\n",
 			      parms->open_cfg->session_id.id,
-			      strerror(-rc));
+			      rte_strerror(-rc));
 			return rc;
 		}
 
@@ -480,7 +480,7 @@ tf_session_attach_session(struct tf *tfp __rte_unused,
 
 	TFP_DRV_LOG(ERR,
 		    "Attach not yet supported, rc:%s\n",
-		    strerror(-rc));
+		    rte_strerror(-rc));
 	return rc;
 }
 
@@ -503,7 +503,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -511,7 +511,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid session id, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -531,7 +531,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Client not part of the session, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_session_close_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to unregister Client %d, rc:%s\n",
 				    client->session_client_id.id,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -576,7 +576,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Device lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -586,7 +586,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -596,7 +596,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Device unbind failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	rc = tf_msg_session_close(tfp, fw_session_id, mailbox);
@@ -604,7 +604,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	/* Final cleanup as we're last user of the session thus we
@@ -658,7 +658,7 @@ tf_session_get_session_internal(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -689,7 +689,7 @@ tf_session_get_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Internal FID lookup\n, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_session_get_session(struct tf *tfp,
 		TFP_DRV_LOG
 			(ERR,
 			"Ctrl channel not registered with session\n, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -810,7 +810,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -818,7 +818,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -842,7 +842,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -850,7 +850,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1152,7 +1152,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1160,7 +1160,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to set state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1169,7 +1169,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Set session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
@@ -1186,7 +1186,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1194,7 +1194,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to get state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1203,7 +1203,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Get session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_sram_mgr.c b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
index 87e8882fed..afbc3a3e46 100644
--- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c
+++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
@@ -494,7 +494,7 @@ static struct tf_sram_block
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate block, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return NULL;
 	}
 	block = (struct tf_sram_block *)cparms.mem_va;
@@ -588,7 +588,7 @@ tf_sram_mgr_bind(void **sram_handle)
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate SRAM mgmt data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	sram = (struct tf_sram *)cparms.mem_va;
@@ -628,7 +628,7 @@ tf_sram_mgr_unbind(void *sram_handle)
 					/* Log error */
 					TFP_DRV_LOG(ERR,
 						  "No SRAM slice list, rc:%s\n",
-						  strerror(-rc));
+						  rte_strerror(-rc));
 					return rc;
 				}
 				if (tf_sram_get_block_cnt(slice_list))
@@ -670,7 +670,7 @@ int tf_sram_mgr_alloc(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -759,7 +759,7 @@ tf_sram_mgr_free(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -781,7 +781,7 @@ tf_sram_mgr_free(void *sram_handle,
 	rc = tf_sram_free_slice(parms->slice_size, slice_offset,
 				block, &block_is_empty);
 	if (rc) {
-		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", strerror(-rc));
+		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", rte_strerror(-rc));
 		return rc;
 	}
 #if (STATS_CLEAR_ON_READ_SUPPORT == 0)
@@ -805,7 +805,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -821,7 +821,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -836,14 +836,14 @@ tf_sram_mgr_free(void *sram_handle,
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n",
-				    block_id, strerror(-rc));
+				    block_id, rte_strerror(-rc));
 		}
 		fparms.index = block_id + 1;
 		rc = tf_rm_free(&fparms);
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free next block_id(%d) failed error(%s)\n",
-				    block_id + 1, strerror(-rc));
+				    block_id + 1, rte_strerror(-rc));
 		}
 		/* Free local entry regardless */
 		tf_sram_free_block(slice_list, block);
@@ -937,7 +937,7 @@ int tf_sram_mgr_is_allocated(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
index f5f3889934..0fbcba6c76 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl.c
@@ -45,7 +45,7 @@ tf_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -195,7 +195,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -234,7 +234,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -250,7 +250,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -302,7 +302,7 @@ tf_tbl_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -341,7 +341,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -356,7 +356,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -393,7 +393,7 @@ tf_tbl_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -432,7 +432,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -449,7 +449,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -485,7 +485,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -517,7 +517,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_tbl_sram.c b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
index 3a6f1c68c7..39dbe11610 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
@@ -114,7 +114,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get hcapi_type %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->bank_id = tf_tbl_sram_hcapi_2_bank[hcapi_type];
@@ -129,7 +129,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get slice cnt %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (slices)
@@ -168,7 +168,7 @@ tf_tbl_sram_unbind(struct tf *tfp __rte_unused)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (sram_handle)
@@ -204,7 +204,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -214,7 +214,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -290,7 +290,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -299,7 +299,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -345,7 +345,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -417,7 +417,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -426,7 +426,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -489,7 +489,7 @@ tf_tbl_sram_set(struct tf *tfp,
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
 				    parms->idx,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			rc = -ENOMEM;
 			return rc;
 		}
@@ -504,7 +504,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -519,7 +519,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -553,7 +553,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -562,7 +562,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -592,7 +592,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -607,7 +607,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (parms->type == TF_TBL_TYPE_ACT_STATS_64)
@@ -626,7 +626,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -661,7 +661,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -670,7 +670,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -703,7 +703,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->starting_idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -716,7 +716,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -730,7 +730,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -751,7 +751,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	return rc;
 }
diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c
index 9e0671d47b..5924c5e6c1 100644
--- a/drivers/net/bnxt/tf_core/tf_tcam.c
+++ b/drivers/net/bnxt/tf_core/tf_tcam.c
@@ -57,7 +57,7 @@ tf_tcam_bind(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -91,7 +91,7 @@ tf_tcam_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tcam_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -301,7 +301,7 @@ tf_tcam_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -320,7 +320,7 @@ tf_tcam_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tcam_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -385,7 +385,7 @@ tf_tcam_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -417,7 +417,7 @@ tf_tcam_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -477,7 +477,7 @@ tf_tcam_free(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -515,7 +515,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -579,7 +579,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return 0;
@@ -618,7 +618,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -662,7 +662,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 22/42] net/af_xdp: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (20 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 21/42] net/bnxt: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 23/42] net/bonding: " Dengdui Huang
                       ` (19 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 353c8688ec..087b6e33db 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1165,7 +1165,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
 				&rxq->fq, &rxq->cq, &usr_config);
 		if (ret) {
 			AF_XDP_LOG(ERR, "Failed to create umem [%d]: [%s]\n",
-				   errno, strerror(errno));
+				   errno, rte_strerror(errno));
 			goto err;
 		}
 		umem->buffer = base_addr;
@@ -1367,7 +1367,7 @@ init_uds_sock(struct sockaddr_un *server)
 	if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) < 0) {
 		close(sock);
 		AF_XDP_LOG(ERR, "Error connecting stream socket errno = [%d]: [%s]\n",
-			   errno, strerror(errno));
+			   errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1451,7 +1451,7 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd)
 		return 0;
 
 	if (msglen < 0) {
-		AF_XDP_LOG(ERR, "recvmsg failed, %s\n", strerror(errno));
+		AF_XDP_LOG(ERR, "recvmsg failed, %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -1486,7 +1486,7 @@ make_request_cni(int sock, struct sockaddr_un *server, char *request,
 		rval = send_msg(sock, request, req_fd);
 
 	if (rval < 0) {
-		AF_XDP_LOG(ERR, "Write error %s\n", strerror(errno));
+		AF_XDP_LOG(ERR, "Write error %s\n", rte_strerror(errno));
 		return -1;
 	}
 
@@ -1970,7 +1970,7 @@ parse_prog_arg(const char *key __rte_unused,
 
 	if (access(value, F_OK) != 0) {
 		AF_XDP_LOG(ERR, "Error accessing %s: %s\n",
-			   value, strerror(errno));
+			   value, rte_strerror(errno));
 		return -EINVAL;
 	}
 
@@ -2421,7 +2421,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(ETH_AF_XDP_MP_KEY, afxdp_mp_send_fds);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			AF_XDP_LOG(ERR, "%s: Failed to register multi-process IPC callback: %s\n",
-				   name, strerror(rte_errno));
+				   name, rte_strerror(rte_errno));
 			return -1;
 		}
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 23/42] net/bonding: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (21 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 22/42] net/af_xdp: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 24/42] net/dpaa: " Dengdui Huang
                       ` (18 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/bonding/bonding_testpmd.c   | 4 ++--
 drivers/net/bonding/rte_eth_bond_api.c  | 2 +-
 drivers/net/bonding/rte_eth_bond_flow.c | 4 ++--
 drivers/net/bonding/rte_eth_bond_pmd.c  | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..111f9de0e7 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -551,7 +551,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mac_addr_set =
@@ -604,7 +604,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 99e496556a..1d20d421bc 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -483,7 +483,7 @@ __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s\n",
-			__func__, member_port_id, strerror(-ret));
+			__func__, member_port_id, rte_strerror(-ret));
 
 		return ret;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 71a91675f7..b7e966f393 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -31,7 +31,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -45,7 +45,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c40d18d128..fdf152a51a 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -192,7 +192,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s\n",
-			__func__, member_port, strerror(-ret));
+			__func__, member_port, rte_strerror(-ret));
 
 		return ret;
 	}
@@ -223,7 +223,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
 			RTE_BOND_LOG(ERR,
 				"%s: Error during getting device (port %u) info: %s\n",
 				__func__, bond_dev->data->port_id,
-				strerror(-ret));
+				rte_strerror(-ret));
 
 			return ret;
 		}
@@ -2292,7 +2292,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 					"%s: Error during getting device (port %u) info: %s\n",
 					__func__,
 					member.port_id,
-					strerror(-ret));
+					rte_strerror(-ret));
 
 				return ret;
 			}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 24/42] net/dpaa: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (22 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 23/42] net/bonding: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 25/42] net/dpaa2: " Dengdui Huang
                       ` (17 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/dpaa/dpaa_ethdev.c  | 4 ++--
 drivers/net/dpaa/fmlib/fm_lib.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index ef4c06db6a..214627986f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1080,7 +1080,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		ret = qman_init_fq(rxq, flags, &opts);
 		if (ret) {
 			DPAA_PMD_ERR("Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 			return ret;
 		}
 		if (dpaa_svr_family == SVR_LS1043A_FAMILY) {
@@ -1210,7 +1210,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev,
 	ret = qman_init_fq(rxq, flags, &opts);
 	if (ret) {
 		DPAA_PMD_ERR("Ev-Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 		return ret;
 	}
 
diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c
index 1d6816050c..d4382d7065 100644
--- a/drivers/net/dpaa/fmlib/fm_lib.c
+++ b/drivers/net/dpaa/fmlib/fm_lib.c
@@ -103,7 +103,7 @@ fm_get_api_version(t_handle h_fm, ioc_fm_api_version_t *p_version)
 	ret = ioctl(p_dev->fd, FM_IOC_GET_API_VERSION, p_version);
 	if (ret) {
 		DPAA_PMD_ERR("cannot get API version, error %i (%s)\n",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 	_fml_dbg("Finishing.\n");
@@ -276,7 +276,7 @@ fm_pcd_kg_scheme_set(t_handle h_fm_pcd,
 	ret = ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_SET, params);
 	if (ret) {
 		DPAA_PMD_ERR("  cannot set kg scheme, error %i (%s)\n",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return NULL;
 	}
 
@@ -310,7 +310,7 @@ fm_pcd_kg_scheme_delete(t_handle h_scheme)
 
 	if (ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_DELETE, &id)) {
 		DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)\n",
-			      errno, strerror(errno));
+			      errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 25/42] net/dpaa2: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (23 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 24/42] net/dpaa: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 26/42] net/enetfec: " Dengdui Huang
                       ` (16 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8e610b6bba..48f1a2fafb 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1166,7 +1166,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				irq_index, mask);
 	if (err < 0) {
 		DPAA2_PMD_ERR("Error: dpni_set_irq_mask():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 		return err;
 	}
 
@@ -1174,7 +1174,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				  irq_index, enable);
 	if (err < 0)
 		DPAA2_PMD_ERR("Error: dpni_set_irq_enable():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 
 	return err;
 }
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 26/42] net/enetfec: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (24 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 25/42] net/dpaa2: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 27/42] net/failsafe: " Dengdui Huang
                       ` (15 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/enetfec/enet_uio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/enetfec/enet_uio.c b/drivers/net/enetfec/enet_uio.c
index 6539cbb354..93520e9760 100644
--- a/drivers/net/enetfec/enet_uio.c
+++ b/drivers/net/enetfec/enet_uio.c
@@ -231,7 +231,7 @@ enetfec_configure(void)
 	d = opendir(FEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		ENETFEC_PMD_ERR("\nError opening directory '%s': %s\n",
-			FEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			FEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 27/42] net/failsafe: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (25 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 26/42] net/enetfec: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 28/42] net/i40e: " Dengdui Huang
                       ` (14 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/failsafe/failsafe.c         | 8 ++++----
 drivers/net/failsafe/failsafe_args.c    | 4 ++--
 drivers/net/failsafe/failsafe_eal.c     | 4 ++--
 drivers/net/failsafe/failsafe_flow.c    | 4 ++--
 drivers/net/failsafe/failsafe_ops.c     | 2 +-
 drivers/net/failsafe/failsafe_private.h | 6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 32811403b4..f89c946ce4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -92,7 +92,7 @@ failsafe_hotplug_alarm_cancel(struct rte_eth_dev *dev)
 	rte_eal_alarm_cancel(fs_hotplug_alarm, dev);
 	if (rte_errno) {
 		ERROR("rte_eal_alarm_cancel failed (errno: %s)",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		ret = -rte_errno;
 	} else {
 		PRIV(dev)->pending_alarm = 0;
@@ -138,18 +138,18 @@ fs_mutex_init(struct fs_priv *priv)
 
 	ret = pthread_mutexattr_init(&attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex attributes - %s", strerror(ret));
+		ERROR("Cannot initiate mutex attributes - %s", rte_strerror(ret));
 		return ret;
 	}
 	/* Allow mutex relocks for the thread holding the mutex. */
 	ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 	if (ret) {
-		ERROR("Cannot set mutex type - %s", strerror(ret));
+		ERROR("Cannot set mutex type - %s", rte_strerror(ret));
 		return ret;
 	}
 	ret = pthread_mutex_init(&priv->hotplug_mutex, &attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex - %s", strerror(ret));
+		ERROR("Cannot initiate mutex - %s", rte_strerror(ret));
 		return ret;
 	}
 	return 0;
diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c
index b203e02d9a..77169b7bbe 100644
--- a/drivers/net/failsafe/failsafe_args.c
+++ b/drivers/net/failsafe/failsafe_args.c
@@ -112,7 +112,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 	fp = popen(sdev->cmdline, "r");
 	if (fp == NULL) {
 		ret = -errno;
-		ERROR("popen: %s", strerror(errno));
+		ERROR("popen: %s", rte_strerror(errno));
 		return ret;
 	}
 	/* We only read one line */
@@ -131,7 +131,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 		ERROR("Parsing device '%s' failed", output);
 ret_pclose:
 	if (pclose(fp) == -1)
-		ERROR("pclose: %s", strerror(errno));
+		ERROR("pclose: %s", rte_strerror(errno));
 	return ret;
 }
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index d71b512f81..b06579692a 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -52,7 +52,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			if (ret < 0) {
 				ERROR("sub_device %d probe failed %s%s%s", i,
 				      rte_errno ? "(" : "",
-				      rte_errno ? strerror(rte_errno) : "",
+				      rte_errno ? rte_strerror(rte_errno) : "",
 				      rte_errno ? ")" : "");
 				continue;
 			}
@@ -100,7 +100,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner);
 			if (ret < 0) {
 				INFO("sub_device %d owner set failed (%s), "
-				     "will try again later", i, strerror(-ret));
+				     "will try again later", i, rte_strerror(-ret));
 				continue;
 			} else if (strncmp(rte_eth_devices[pid].device->name,
 				   da->name, strlen(da->name)) != 0) {
diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c
index 707e6c63b5..5d17182cc5 100644
--- a/drivers/net/failsafe/failsafe_flow.c
+++ b/drivers/net/failsafe/failsafe_flow.c
@@ -33,7 +33,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Unable to process flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -47,7 +47,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Failed to copy flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 35649b6244..40bea1d6bf 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -452,7 +452,7 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,
 #ifdef RTE_EXEC_ENV_LINUX
 	rxq->event_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (rxq->event_fd < 0) {
-		ERROR("Failed to create an eventfd: %s", strerror(errno));
+		ERROR("Failed to create an eventfd: %s", rte_strerror(errno));
 		fs_unlock(dev, 0);
 		return -errno;
 	}
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 53a451c1b1..5961222400 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -410,14 +410,14 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm)
 		ret = pthread_mutex_trylock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
 			DEBUG("Hot-plug mutex lock trying failed(%s), will try"
-			      " again later...", strerror(ret));
+			      " again later...", rte_strerror(ret));
 			return ret;
 		}
 		PRIV(dev)->alarm_lock = 1;
 	} else {
 		ret = pthread_mutex_lock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
-			ERROR("Cannot lock mutex(%s)", strerror(ret));
+			ERROR("Cannot lock mutex(%s)", rte_strerror(ret));
 			return ret;
 		}
 	}
@@ -439,7 +439,7 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm)
 	}
 	ret = pthread_mutex_unlock(&PRIV(dev)->hotplug_mutex);
 	if (ret)
-		ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret));
+		ERROR("Cannot unlock hot-plug mutex(%s)", rte_strerror(ret));
 }
 
 /*
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 28/42] net/i40e: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (26 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 27/42] net/failsafe: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 29/42] net/ice: " Dengdui Huang
                       ` (13 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/i40e/i40e_testpmd.c | 42 ++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index b6ef5d6e42..d0995531bc 100644
--- a/drivers/net/i40e/i40e_testpmd.c
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -53,7 +53,7 @@ cmd_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -148,7 +148,7 @@ cmd_region_flowtype_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "region flowtype config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -233,7 +233,7 @@ cmd_user_priority_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "user_priority region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -320,7 +320,7 @@ cmd_flush_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config flush error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -433,7 +433,7 @@ cmd_show_queue_region_info_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config info show error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -536,7 +536,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 							add);
 	if (ret < 0)
 		fprintf(stderr, "flow director config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	close_file(conf.input.packet);
 }
 
@@ -666,7 +666,7 @@ cmd_set_vf_promisc_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -745,7 +745,7 @@ cmd_set_vf_allmulti_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -825,7 +825,7 @@ cmd_set_vf_broadcast_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -908,7 +908,7 @@ cmd_set_vf_vlan_tag_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1013,7 +1013,7 @@ cmd_vf_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1108,7 +1108,7 @@ cmd_vf_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1158,7 +1158,7 @@ cmd_vf_tc_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1207,7 +1207,7 @@ cmd_strict_link_prio_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1928,7 +1928,7 @@ cmd_pctype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2000,7 +2000,7 @@ cmd_pctype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		return;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 		return;
 	}
 
@@ -2111,7 +2111,7 @@ cmd_pctype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2191,7 +2191,7 @@ cmd_ptype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 
 	if (!ret) {
@@ -2280,7 +2280,7 @@ cmd_ptype_mapping_replace_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2347,7 +2347,7 @@ cmd_ptype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2427,7 +2427,7 @@ cmd_ptype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 29/42] net/ice: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (27 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 28/42] net/i40e: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 30/42] net/ixgbe: " Dengdui Huang
                       ` (12 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/ice/ice_testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_testpmd.c b/drivers/net/ice/ice_testpmd.c
index a7a8d0c53c..e1392059e0 100644
--- a/drivers/net/ice/ice_testpmd.c
+++ b/drivers/net/ice/ice_testpmd.c
@@ -60,7 +60,7 @@ cmd_ddp_dump_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
@@ -127,7 +127,7 @@ cmd_ddp_dump_switch_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP switch runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 30/42] net/ixgbe: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (28 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 29/42] net/ice: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 31/42] net/memif: " Dengdui Huang
                       ` (11 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/ixgbe/ixgbe_testpmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_testpmd.c b/drivers/net/ixgbe/ixgbe_testpmd.c
index e0d161eafe..3c6d648844 100644
--- a/drivers/net/ixgbe/ixgbe_testpmd.c
+++ b/drivers/net/ixgbe/ixgbe_testpmd.c
@@ -141,7 +141,7 @@ cmd_set_vf_split_drop_en_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -243,7 +243,7 @@ cmd_set_macsec_offload_on_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -327,7 +327,7 @@ cmd_set_macsec_offload_off_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -402,7 +402,7 @@ cmd_set_macsec_sc_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -510,7 +510,7 @@ cmd_set_macsec_sa_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -599,7 +599,7 @@ cmd_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 31/42] net/memif: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (29 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 30/42] net/ixgbe: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 32/42] net/mlx4: " Dengdui Huang
                       ` (10 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/memif/memif_socket.c  |  4 ++--
 drivers/net/memif/rte_eth_memif.c | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 649f8d0e61..592b71979a 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -71,7 +71,7 @@ memif_msg_send_from_queue(struct memif_control_channel *cc)
 	size = memif_msg_send(rte_intr_fd_get(cc->intr_handle), &e->msg,
 			      e->fd);
 	if (size != sizeof(memif_msg_t)) {
-		MIF_LOG(ERR, "sendmsg fail: %s.", strerror(errno));
+		MIF_LOG(ERR, "sendmsg fail: %s.", rte_strerror(errno));
 		ret = -1;
 	} else {
 		MIF_LOG(DEBUG, "Sent msg type %u.", e->msg.type);
@@ -975,7 +975,7 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract, uid_t owner_u
 	return sock;
 
  error:
-	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, strerror(errno));
+	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, rte_strerror(errno));
 	if (sock != NULL) {
 		rte_intr_instance_free(sock->intr_handle);
 		rte_free(sock);
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 7cc8c0da91..f7697394f1 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -805,7 +805,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			     sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -960,7 +960,7 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 				     &a, sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -1082,27 +1082,27 @@ memif_region_init_shm(struct rte_eth_dev *dev, uint8_t has_buffers)
 
 	r->fd = memfd_create(shm_name, MFD_ALLOW_SEALING);
 	if (r->fd < 0) {
-		MIF_LOG(ERR, "Failed to create shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to create shm file: %s.", rte_strerror(errno));
 		ret = -1;
 		goto error;
 	}
 
 	ret = fcntl(r->fd, F_ADD_SEALS, F_SEAL_SHRINK);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	ret = ftruncate(r->fd, r->region_size);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to truncate shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to truncate shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	r->addr = mmap(NULL, r->region_size, PROT_READ |
 		       PROT_WRITE, MAP_SHARED, r->fd, 0);
 	if (r->addr == MAP_FAILED) {
-		MIF_LOG(ERR, "Failed to mmap shm region: %s.", strerror(ret));
+		MIF_LOG(ERR, "Failed to mmap shm region: %s.", rte_strerror(ret));
 		ret = -1;
 		goto error;
 	}
@@ -1223,7 +1223,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for tx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1247,7 +1247,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for rx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1299,7 +1299,7 @@ memif_connect(struct rte_eth_dev *dev)
 						MAP_SHARED, mr->fd, 0);
 				if (mr->addr == MAP_FAILED) {
 					MIF_LOG(ERR, "mmap failed: %s\n",
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			}
@@ -1983,7 +1983,7 @@ rte_pmd_memif_probe(struct rte_vdev_device *vdev)
 	 */
 	if (ret < 0 && rte_errno != EEXIST)
 		MIF_LOG(WARNING, "Failed to register mp action callback: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 
 	/* use abstract address by default */
 	flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 32/42] net/mlx4: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (30 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 31/42] net/memif: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 33/42] net/mlx5: " Dengdui Huang
                       ` (9 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/mlx4/mlx4.c        | 14 +++++++-------
 drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++---------
 drivers/net/mlx4/mlx4_rxq.c    | 10 +++++-----
 drivers/net/mlx4/mlx4_txq.c    | 10 +++++-----
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index a1a7e93288..f06a6fee6e 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -255,7 +255,7 @@ mlx4_dev_configure(struct rte_eth_dev *dev)
 	if (ret) {
 		ERROR("cannot set up internal flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto exit;
 	}
@@ -302,7 +302,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 	ret = mlx4_rss_init(priv);
 	if (ret) {
 		ERROR("%p: cannot initialize RSS resources: %s",
-		      (void *)dev, strerror(-ret));
+		      (void *)dev, rte_strerror(-ret));
 		goto err;
 	}
 #ifdef RTE_LIBRTE_MLX4_DEBUG
@@ -319,7 +319,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 		ERROR("%p: cannot attach flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
 		      (void *)dev,
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto err;
 	}
@@ -793,7 +793,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	err = mlx4_init_once();
 	if (err) {
 		ERROR("unable to init PMD global data: %s",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	MLX4_ASSERT(pci_drv == &mlx4_driver);
@@ -946,7 +946,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_glue->query_port(ctx, port, &port_attr);
 		if (err) {
 			err = ENODEV;
-			ERROR("port query failed: %s", strerror(err));
+			ERROR("port query failed: %s", rte_strerror(err));
 			goto port_error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -963,7 +963,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_fd_set_non_blocking(ctx->async_fd);
 		if (err) {
 			ERROR("cannot make asynchronous FD non-blocking: %s",
-			      strerror(err));
+			      rte_strerror(err));
 			goto port_error;
 		}
 		/* Allocate protection domain. */
@@ -1024,7 +1024,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_get_mac(priv, &mac.addr_bytes);
 		if (err) {
 			ERROR("cannot get MAC address, is mlx4_en loaded?"
-			      " (error: %s)", strerror(err));
+			      " (error: %s)", rte_strerror(err));
 			goto port_error;
 		}
 		INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index bb1dd33e7c..a1cd345aae 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -373,7 +373,7 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 
 	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      mode, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -462,7 +462,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 	ERROR("failed to synchronize flow rules after removing MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 }
 
@@ -501,7 +501,7 @@ mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	ERROR("failed to synchronize flow rules after adding MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -558,7 +558,7 @@ mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list,
 		return 0;
 	ERROR("failed to synchronize flow rules after modifying MC list,"
 	      " (code %d, \"%s\"), flow error type %d, cause %p, message: %s",
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -600,7 +600,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	      " (code %d, \"%s\"), "
 	      " flow error type %d, cause %p, message: %s",
 	      on ? "enabling" : "disabling", vlan_id,
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -807,7 +807,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	}
 	(void)wait_to_complete;
 	if (mlx4_ifreq(priv, SIOCGIFFLAGS, &ifr)) {
-		WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno));
+		WARN("ioctl(SIOCGIFFLAGS) failed: %s", rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	memset(&dev_link, 0, sizeof(dev_link));
@@ -816,7 +816,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	ifr.ifr_data = (void *)&edata;
 	if (mlx4_ifreq(priv, SIOCETHTOOL, &ifr)) {
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	link_speed = ethtool_cmd_speed(&edata);
@@ -858,7 +858,7 @@ mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -913,7 +913,7 @@ mlx4_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	ret = 0;
diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c
index 781ee256df..d0ec84201e 100644
--- a/drivers/net/mlx4/mlx4_rxq.c
+++ b/drivers/net/mlx4/mlx4_rxq.c
@@ -353,7 +353,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	if (ret) {
 		ERROR("cannot set up range size for RSS context to %u"
 		      " (for %u Rx queues), error: %s",
-		      1 << log2_range, dev->data->nb_rx_queues, strerror(ret));
+		      1 << log2_range, dev->data->nb_rx_queues, rte_strerror(ret));
 		rte_errno = ret;
 		return -ret;
 	}
@@ -431,7 +431,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	return 0;
 error:
 	ERROR("cannot initialize common RSS resources (queue %u): %s: %s",
-	      i, msg, strerror(ret));
+	      i, msg, rte_strerror(ret));
 	while (i--) {
 		struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i];
 
@@ -631,7 +631,7 @@ mlx4_rxq_attach(struct rxq *rxq)
 	--rxq->usecnt;
 	rte_errno = ret;
 	ERROR("error while attaching Rx queue %p: %s: %s",
-	      (void *)rxq, msg, strerror(ret));
+	      (void *)rxq, msg, rte_strerror(ret));
 	priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE;
 	return -ret;
 }
@@ -882,13 +882,13 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 			rte_errno = ENOMEM;
 			ERROR("%p: Rx interrupt completion channel creation"
 			      " failure: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 		if (mlx4_fd_set_non_blocking(rxq->channel->fd) < 0) {
 			ERROR("%p: unable to make Rx interrupt completion"
 			      " channel non-blocking: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 	}
diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c
index 0db2e55bef..f08c152d5e 100644
--- a/drivers/net/mlx4/mlx4_txq.c
+++ b/drivers/net/mlx4/mlx4_txq.c
@@ -411,7 +411,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->cq) {
 		rte_errno = ENOMEM;
 		ERROR("%p: CQ creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	qp_init_attr = (struct ibv_qp_init_attr){
@@ -431,7 +431,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->qp) {
 		rte_errno = errno ? errno : EINVAL;
 		ERROR("%p: QP creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	txq->max_inline = qp_init_attr.cap.max_inline_data;
@@ -445,7 +445,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_INIT failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -457,7 +457,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTR failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -469,7 +469,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTS failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Retrieve device queue information. */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 33/42] net/mlx5: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (31 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 32/42] net/mlx4: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 34/42] net/qede: " Dengdui Huang
                       ` (8 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c     |  2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c   | 20 ++++++++++----------
 drivers/net/mlx5/linux/mlx5_os.c          | 18 +++++++++---------
 drivers/net/mlx5/linux/mlx5_socket.c      | 16 ++++++++--------
 drivers/net/mlx5/linux/mlx5_verbs.c       |  8 ++++----
 drivers/net/mlx5/mlx5.c                   |  8 ++++----
 drivers/net/mlx5/mlx5_devx.c              |  4 ++--
 drivers/net/mlx5/mlx5_mac.c               |  2 +-
 drivers/net/mlx5/mlx5_rxmode.c            |  8 ++++----
 drivers/net/mlx5/mlx5_rxq.c               |  4 ++--
 drivers/net/mlx5/mlx5_rxtx.c              |  2 +-
 drivers/net/mlx5/mlx5_stats.c             |  4 ++--
 drivers/net/mlx5/mlx5_testpmd.c           | 14 +++++++-------
 drivers/net/mlx5/mlx5_trigger.c           | 12 ++++++------
 drivers/net/mlx5/mlx5_vlan.c              |  2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c |  2 +-
 drivers/net/mlx5/windows/mlx5_os.c        | 12 ++++++------
 17 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 4ea161eae6..e5247c1295 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -1421,7 +1421,7 @@ mlx5dr_match_template_create(const struct rte_flow_item items[],
 	if (ret <= 0) {
 		DR_LOG(ERR, "Unable to process items (%s): %s",
 		       error.message ? error.message : "unspecified",
-		       strerror(rte_errno));
+		       rte_strerror(rte_errno));
 		goto free_template;
 	}
 
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index dd5a0c546d..f2364ff44e 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -398,7 +398,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -435,7 +435,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 			DRV_LOG(WARNING,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GSET) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -490,7 +490,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -525,7 +525,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 			DRV_LOG(DEBUG,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GLINKSETTINGS) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -543,7 +543,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 		DRV_LOG(DEBUG,
 			"port %u ioctl(SIOCETHTOOL,"
 			"ETHTOOL_GLINKSETTINGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link.link_speed = (ecmd->speed == UINT32_MAX) ?
@@ -674,7 +674,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(WARNING,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:"
 			" %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -727,7 +727,7 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(WARNING,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 			" failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	return 0;
@@ -1209,7 +1209,7 @@ mlx5_get_module_info(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	modinfo->type = info.type;
@@ -1258,7 +1258,7 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret)
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	else
 		rte_memcpy(info->data, eeprom->data, info->length);
 	mlx5_free(eeprom);
@@ -1662,7 +1662,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, xstats_ctrl->base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	stats_ctrl->imissed = 0;
 free:
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 07f31de5ae..108de96cf7 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1176,7 +1176,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		err = mlx5_glue->query_port(sh->cdev->ctx, spawn->phys_port,
 					    &port_attr);
 		if (err) {
-			DRV_LOG(ERR, "port query failed: %s", strerror(err));
+			DRV_LOG(ERR, "port query failed: %s", rte_strerror(err));
 			goto error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -1191,7 +1191,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			spawn->phys_port);
 		if (err < 0) {
 			DRV_LOG(INFO, "Failed to get netlink port state: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			err = -rte_errno;
 			goto error;
 		}
@@ -1342,7 +1342,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -1433,7 +1433,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -1479,7 +1479,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -1973,7 +1973,7 @@ mlx5_device_bond_pci_match(const char *ibdev_name,
 					   bond_info->ifname);
 		if (ret)
 			DRV_LOG(ERR, "unable to get bond info: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 		else
 			DRV_LOG(INFO, "PF device %u, bond device %u(%s)",
 				ifindex, bond_info->ifindex, bond_info->ifname);
@@ -2688,7 +2688,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,
 			" encountering an error: %s",
 			owner_pci.domain, owner_pci.bus,
 			owner_pci.devid, owner_pci.function,
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		ret = -rte_errno;
 		/* Roll back. */
 		while (i--) {
@@ -2868,13 +2868,13 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "Unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	ret = mlx5_probe_again_args_validate(cdev, mkvlist);
 	if (ret) {
 		DRV_LOG(ERR, "Probe again parameters are not compatible : %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	if (mlx5_dev_is_pci(cdev->dev))
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 6ce0e59643..cfcbd5a099 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -61,13 +61,13 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	/* Accept the connection from the client. */
 	conn_sock = accept(server_socket, NULL, NULL);
 	if (conn_sock < 0) {
-		DRV_LOG(WARNING, "connection failed: %s", strerror(errno));
+		DRV_LOG(WARNING, "connection failed: %s", rte_strerror(errno));
 		return;
 	}
 	ret = recvmsg(conn_sock, &msg, MSG_WAITALL);
 	if (ret != sizeof(struct mlx5_flow_dump_req)) {
 		DRV_LOG(WARNING, "wrong message received: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 
@@ -138,7 +138,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0)
 		DRV_LOG(WARNING, "failed to send response %s",
-			strerror(errno));
+			rte_strerror(errno));
 error:
 	if (conn_sock >= 0)
 		close(conn_sock);
@@ -167,7 +167,7 @@ mlx5_pmd_socket_init(void)
 	ret = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "Failed to open mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	server_socket = ret;
@@ -183,13 +183,13 @@ mlx5_pmd_socket_init(void)
 	ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun));
 	if (ret < 0) {
 		DRV_LOG(WARNING,
-			"cannot bind mlx5 socket: %s", strerror(errno));
+			"cannot bind mlx5 socket: %s", rte_strerror(errno));
 		goto remove;
 	}
 	ret = listen(server_socket, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "cannot listen on mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	server_intr_handle = mlx5_os_interrupt_handler_create
@@ -197,7 +197,7 @@ mlx5_pmd_socket_init(void)
 		 server_socket, mlx5_pmd_socket_handle, NULL);
 	if (server_intr_handle == NULL) {
 		DRV_LOG(WARNING, "cannot register interrupt handler for mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	return 0;
@@ -207,7 +207,7 @@ mlx5_pmd_socket_init(void)
 	claim_zero(close(server_socket));
 	server_socket = -1;
 error:
-	DRV_LOG(ERR, "Cannot initialize socket: %s", strerror(errno));
+	DRV_LOG(ERR, "Cannot initialize socket: %s", rte_strerror(errno));
 	return -errno;
 }
 
diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index b54f3ccd9a..9d41f6fbdf 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -100,7 +100,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Tx QP state to RESET %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -111,7 +111,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE | IBV_QP_PORT);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -119,7 +119,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -127,7 +127,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 2cf21a1921..7f95c0db85 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1504,7 +1504,7 @@ mlx5_shared_dev_ctx_args_config(struct mlx5_dev_ctx_shared *sh,
 					  mlx5_dev_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process device arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -1756,7 +1756,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
 	err = mlx5_shared_dev_ctx_args_config(sh, mkvlist, &sh->config);
 	if (err) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	sh->refcnt = 1;
@@ -2716,7 +2716,7 @@ mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist,
 					  mlx5_port_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process port arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -2947,7 +2947,7 @@ mlx5_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_shared_dev_ctx_args_config(sh, mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 9fa400fc48..95bed87103 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -134,7 +134,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to RESET"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -146,7 +146,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to READY"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 22a756a52b..f73b7bc394 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -100,7 +100,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 		ret = mlx5_traffic_restart(dev);
 		if (ret)
 			DRV_LOG(ERR, "port %u cannot restart traffic: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 	}
 }
 
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index f44906e1a7..fae684defb 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -44,7 +44,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_enable() rollback
@@ -77,7 +77,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_disable() rollback
@@ -117,7 +117,7 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_enable() rollback
@@ -150,7 +150,7 @@ mlx5_allmulticast_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_disable() rollback
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 88b2dc54b3..341714965b 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -488,7 +488,7 @@ mlx5_rx_queue_stop_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RDY2RST);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to RESET:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -587,7 +587,7 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RST2RDY);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to READY:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 54d410b513..59e49aa5af 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -378,7 +378,7 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
 		ret = priv->obj_ops.rxq_obj_modify(rxq, sm->state);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Rx WQ state to %u  - %s",
-					sm->state, strerror(errno));
+					sm->state, rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 615e1d073d..d2a8b8e852 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -233,7 +233,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	stats_n = mlx5_os_get_stats_n(dev);
 	if (stats_n < 0) {
 		DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
-			strerror(-stats_n));
+			rte_strerror(-stats_n));
 		return stats_n;
 	}
 	if (xstats_ctrl->stats_n != stats_n)
@@ -251,7 +251,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, counters);
 	if (ret) {
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		mlx5_free(counters);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
index 403f3a8f83..70d4d0039f 100644
--- a/drivers/net/mlx5/mlx5_testpmd.c
+++ b/drivers/net/mlx5/mlx5_testpmd.c
@@ -199,13 +199,13 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	socket_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
 	if (socket_fd < 0) {
 		TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n",
-			    strerror(errno));
+			    rte_strerror(errno));
 		return -1;
 	}
 	rte_strlcpy(un.sun_path, path, sizeof(un.sun_path));
 	if (connect(socket_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		TESTPMD_LOG(ERR, "Failed to connect %s: %s\n", un.sun_path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -216,7 +216,7 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0) {
 		TESTPMD_LOG(ERR, "Failed to send request to (%s): %s\n", path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -333,7 +333,7 @@ static void cmd_port_host_shaper_parsed(void *parsed_result,
 		ret = mlx5_test_set_port_host_shaper(res->port_num, res->fr,
 					   res->rate_num);
 	if (ret < 0)
-		printf("cmd_port_host_shaper error: (%s)\n", strerror(-ret));
+		printf("cmd_port_host_shaper error: (%s)\n", rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_port_host_shaper_mlx5 =
@@ -492,7 +492,7 @@ mlx5_cmd_map_ext_rxq_parsed(void *parsed_result,
 			res->sw_queue_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -565,7 +565,7 @@ mlx5_cmd_unmap_ext_rxq_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -648,7 +648,7 @@ mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result,
 	if (ret < 0)
 		fprintf(stderr, "Fail to set flow_engine to %s mode with flag 0x%x, error %s\n",
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag,
-			strerror(-ret));
+			rte_strerror(-ret));
 	else
 		TESTPMD_LOG(DEBUG, "Set %d ports flow_engine to %s mode with flag 0x%x\n", ret,
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag);
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 7bdb897612..eecd39d8a7 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -1190,14 +1190,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 		ret = mlx5_dev_configure_rss_reta(dev);
 		if (ret) {
 			DRV_LOG(ERR, "port %u reta config failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
 	ret = mlx5_txpp_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx packet pacing init failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_devx_obj_ops_en(priv->sh) &&
@@ -1209,7 +1209,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_txq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (priv->config.std_delay_drop || priv->config.hp_delay_drop) {
@@ -1233,7 +1233,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_rxq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Rx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/*
@@ -1243,7 +1243,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_hairpin_auto_bind(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u hairpin auto binding failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Set started flag here for the following steps like control flow. */
@@ -1296,7 +1296,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_flow_start_default(dev);
 	if (ret) {
 		DRV_LOG(DEBUG, "port %u failed to start default actions: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_dev_ctx_shared_mempool_subscribe(dev) != 0) {
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index e7161b66fe..e2914844c6 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -118,7 +118,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
 	ret = priv->obj_ops.rxq_obj_modify_vlan_strip(rxq, on);
 	if (ret) {
 		DRV_LOG(ERR, "Port %u failed to modify object stripping mode:"
-			" %s", dev->data->port_id, strerror(rte_errno));
+			" %s", dev->data->port_id, rte_strerror(rte_errno));
 		return;
 	}
 	/* Update related bits in RX queue. */
diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
index a31e1b5494..9e31ad9be7 100644
--- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
@@ -212,7 +212,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	stats_ctrl->imissed = 0;
 }
 
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index b731bdff06..9afc240b46 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -379,7 +379,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	err = mlx5_glue->devx_init_showdown_event(sh->cdev->ctx);
 	if (err) {
 		DRV_LOG(ERR, "failed to init showdown event: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	/* Allocate private eth device data. */
@@ -427,7 +427,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -437,7 +437,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -480,7 +480,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s).",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -730,7 +730,7 @@ mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return rte_errno;
 	}
 	if (!rte_is_same_ether_addr(&lmac, mac)) {
@@ -849,7 +849,7 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	spawn.eth_dev = mlx5_dev_spawn(cdev->dev, &spawn, mkvlist);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 34/42] net/qede: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (32 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 33/42] net/mlx5: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 35/42] net/sfc: " Dengdui Huang
                       ` (7 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/qede/qede_regs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_regs.c b/drivers/net/qede/qede_regs.c
index d2ea1c9108..3aa31a42c2 100644
--- a/drivers/net/qede/qede_regs.c
+++ b/drivers/net/qede/qede_regs.c
@@ -221,7 +221,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (!f) {
 		fprintf(stderr, "Can't open file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		return 1;
 	}
 	bytes = fwrite(dump, 1, len, f);
@@ -234,7 +234,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (fclose(f)) {
 		fprintf(stderr, "Can't close file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		err = 1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 35/42] net/sfc: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (33 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 34/42] net/qede: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 36/42] net/tap: " Dengdui Huang
                       ` (6 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/sfc/sfc_flow.c        |  2 +-
 drivers/net/sfc/sfc_flow_tunnel.c |  2 +-
 drivers/net/sfc/sfc_mae.c         | 58 +++++++++++++++----------------
 3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 1b50aefe5c..304628026d 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -1403,7 +1403,7 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa,
 		rc = item->parse(pattern, parse_ctx, error);
 		if (rc != 0) {
 			sfc_err(sa, "failed to parse item %s: %s",
-				item->name, strerror(-rc));
+				item->name, rte_strerror(-rc));
 			return rc;
 		}
 
diff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c
index 889fee569a..898d00dd6d 100644
--- a/drivers/net/sfc/sfc_flow_tunnel.c
+++ b/drivers/net/sfc/sfc_flow_tunnel.c
@@ -120,7 +120,7 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa,
 		if (rc != 0) {
 			/* The loop above might have spotted wrong actions. */
 			sfc_err(sa, "FT: TUNNEL: invalid actions: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			goto fail;
 		}
 
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index e5ec0ae49d..accde9bcb0 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -429,7 +429,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 					       &fw_rsrc->rule_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable outer_rule=%p: %s",
-				rule, strerror(rc));
+				rule, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -446,7 +446,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 			fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't match on outer rule ID: %s", strerror(rc));
+		sfc_err(sa, "can't match on outer rule ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -485,7 +485,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 						  &invalid_rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "cannot restore match on invalid outer rule ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 		return;
 	}
 
@@ -504,7 +504,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable outer_rule=%p with OR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -618,7 +618,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 					    &fw_rsrc->mac_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable mac_addr=%p: %s",
-				mac_addr, strerror(rc));
+				mac_addr, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -644,7 +644,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 		}
 
 		sfc_err(sa, "cannot fill in MAC address entry ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 
 		return rc;
 	}
@@ -687,7 +687,7 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa,
 				mac_addr, fw_rsrc->mac_id.id);
 		} else {
 			sfc_err(sa, "failed to disable mac_addr=%p with MAC_ID=0x%08x: %s",
-				mac_addr, fw_rsrc->mac_id.id, strerror(rc));
+				mac_addr, fw_rsrc->mac_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -820,7 +820,7 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa,
 						  bounce_eh->size);
 		if (ret != 0) {
 			sfc_err(sa, "failed to update encap_header=%p: %s",
-				encap_header, strerror(ret));
+				encap_header, rte_strerror(ret));
 			rte_free(buf);
 			return ret;
 		}
@@ -861,7 +861,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 						&fw_rsrc->eh_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable encap_header=%p: %s",
-				encap_header, strerror(rc));
+				encap_header, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -875,7 +875,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 			fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't fill in encap. header ID: %s", strerror(rc));
+		sfc_err(sa, "can't fill in encap. header ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -918,7 +918,7 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa,
 				encap_header, fw_rsrc->eh_id.id);
 		} else {
 			sfc_err(sa, "failed to disable encap_header=%p with EH_ID=0x%08x: %s",
-				encap_header, fw_rsrc->eh_id.id, strerror(rc));
+				encap_header, fw_rsrc->eh_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -1023,7 +1023,7 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter,
 			}
 
 			sfc_err(sa, "cannot fill in counter ID: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -1067,7 +1067,7 @@ sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter)
 				counter, counter->type, counter_id);
 		} else {
 			sfc_err(sa, "failed to disable counter=%p with COUNTER_ID=0x%x-#%u: %s",
-				counter, counter->type, counter_id, strerror(rc));
+				counter, counter->type, counter_id, rte_strerror(rc));
 		}
 
 		fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -1242,7 +1242,7 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa,
 					      &fw_rsrc->aset_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set=%p: %s",
-				action_set, strerror(rc));
+				action_set, rte_strerror(rc));
 
 			sfc_mae_encap_header_disable(sa, encap_header);
 			sfc_mae_mac_addr_disable(sa, src_mac_addr);
@@ -1290,7 +1290,7 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa,
 				action_set, fw_rsrc->aset_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_set=%p with AS_ID=0x%08x: %s",
-				action_set, fw_rsrc->aset_id.id, strerror(rc));
+				action_set, fw_rsrc->aset_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->aset_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1446,7 +1446,7 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa,
 						&fw_rsrc->aset_list_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set_list=%p: %s",
-				action_set_list, strerror(rc));
+				action_set_list, rte_strerror(rc));
 			goto fail_action_set_list_alloc;
 		}
 
@@ -1499,7 +1499,7 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa,
 		} else {
 			sfc_err(sa, "failed to disable action_set_list=%p with ASL_ID=0x%08x: %s",
 				action_set_list, fw_rsrc->aset_list_id.id,
-				strerror(rc));
+				rte_strerror(rc));
 		}
 		fw_rsrc->aset_list_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1710,7 +1710,7 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa,
 					as_idp, &fw_rsrc->rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "failed to enable action_rule=%p: %s",
-			rule, strerror(rc));
+			rule, rte_strerror(rc));
 		goto fail_action_rule_insert;
 	}
 
@@ -1761,7 +1761,7 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_rule=%p with AR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -4398,7 +4398,7 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa,
 
 	rc = efx_mae_action_set_populate_mark(spec, conf->id);
 	if (rc != 0)
-		sfc_err(sa, "failed to request action MARK: %s", strerror(rc));
+		sfc_err(sa, "failed to request action MARK: %s", rte_strerror(rc));
 
 	return rc;
 }
@@ -4570,14 +4570,14 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa,
 	if (rc != 0) {
 		sfc_err(sa, "failed to convert PF %u VF %d to m-port: %s",
 			encp->enc_pf, (vf != EFX_PCI_VF_INVALID) ? (int)vf : -1,
-			strerror(rc));
+			rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4606,14 +4606,14 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
 					     port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			port_id, strerror(rc));
+			port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4632,14 +4632,14 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa,
 					     conf->port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4658,14 +4658,14 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa,
 					     conf->port_id, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4758,7 +4758,7 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa,
 
 			if (action_name != NULL) {
 				sfc_err(sa, "action %s was rejected: %s",
-					action_name, strerror(rc));
+					action_name, rte_strerror(rc));
 			}
 		}
 		rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 36/42] net/tap: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (34 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 35/42] net/sfc: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 37/42] net/vhost: " Dengdui Huang
                       ` (5 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/tap/rte_eth_tap.c | 26 +++++++++++++-------------
 drivers/net/tap/tap_flow.c    | 18 +++++++++---------
 drivers/net/tap/tap_netlink.c |  5 +++--
 drivers/net/tap/tap_tcmsgs.c  |  6 ++++--
 4 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index b41fa971cb..ff290ea5bf 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -196,7 +196,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	/* Set the TUN/TAP configuration and set the name if needed */
 	if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) {
 		TAP_LOG(WARNING, "Unable to set TUNSETIFF for %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -204,7 +204,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (persistent && ioctl(fd, TUNSETPERSIST, 1) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set persist %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -224,7 +224,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		if (ioctl(fd, TUNSETQUEUE, (void *)&ifr) < 0) {
 			TAP_LOG(WARNING,
 				"Unable to detach keep-alive queue for %s: %s",
-				ifr.ifr_name, strerror(errno));
+				ifr.ifr_name, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -242,7 +242,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (fcntl(fd, F_SETFL, flags) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set %s to nonblocking: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -295,18 +295,18 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		/* Enable signal on file descriptor */
 		if (fcntl(fd, F_SETSIG, signo) < 0) {
 			TAP_LOG(WARNING, "Unable to set signo %d for fd %d: %s",
-				signo, fd, strerror(errno));
+				signo, fd, rte_strerror(errno));
 			goto error;
 		}
 		if (fcntl(fd, F_SETFL, flags | O_ASYNC) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl flags: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 
 		if (fcntl(fd, F_SETOWN, getpid()) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl owner: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -821,7 +821,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
 
 error:
 	TAP_LOG(DEBUG, "%s(%s) failed: %s(%d)", ifr->ifr_name,
-		tap_ioctl_req2str(request), strerror(errno), errno);
+		tap_ioctl_req2str(request), rte_strerror(errno), errno);
 	return -errno;
 }
 
@@ -1966,7 +1966,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 	if (pmd->ioctl_sock == -1) {
 		TAP_LOG(ERR,
 			"%s Unable to get a socket for management: %s",
-			tuntap_name, strerror(errno));
+			tuntap_name, rte_strerror(errno));
 		goto error_exit;
 	}
 
@@ -2127,7 +2127,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 
 disable_rte_flow:
 	TAP_LOG(ERR, " Disabling rte flow support: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	if (strlen(remote_iface)) {
 		TAP_LOG(ERR, "Remote feature requires flow support.");
 		goto error_exit;
@@ -2137,7 +2137,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 
 error_remote:
 	TAP_LOG(ERR, " Can't set up remote feature: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	tap_flow_implicit_flush(pmd, NULL);
 
 error_exit:
@@ -2475,7 +2475,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 			ret = rte_mp_action_register(TAP_MP_REQ_START_RXTX, tap_mp_req_start_rxtx);
 			if (ret < 0 && rte_errno != ENOTSUP) {
 				TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-					strerror(rte_errno));
+					rte_strerror(rte_errno));
 				return -1;
 			}
 		}
@@ -2535,7 +2535,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto leave;
 		}
 	}
diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index ed4d42f92f..9d6b84f5c7 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -1409,7 +1409,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 	if (err < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(error, EEXIST, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL,
 				   "overlapping rules or Kernel too old for flower support");
@@ -1454,7 +1454,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 		if (err < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule creation (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL,
@@ -1508,7 +1508,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 	if (ret < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule deletion (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"couldn't receive kernel ack to our request");
@@ -1532,7 +1532,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 		if (ret < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule deletion (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL, "Failure trying to receive nl ack");
@@ -1755,7 +1755,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd,
 			goto success;
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		goto fail;
 	}
 	LIST_INSERT_HEAD(&pmd->implicit_flows, remote_flow, next);
@@ -1871,7 +1871,7 @@ static int rss_enable(struct pmd_internals *pmd,
 	if (pmd->map_fd < 0) {
 		TAP_LOG(ERR,
 			"Failed to create BPF map (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
@@ -1946,7 +1946,7 @@ static int rss_enable(struct pmd_internals *pmd,
 		if (err < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule creation (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return err;
 		}
 		LIST_INSERT_HEAD(&pmd->rss_flows, rss_flow, next);
@@ -2111,7 +2111,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd,
 	if (err) {
 		TAP_LOG(ERR,
 			"Failed to update BPF map entry #%u (%d): %s",
-			flow->key_idx, errno, strerror(errno));
+			flow->key_idx, errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
@@ -2130,7 +2130,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd,
 	if (flow->bpf_fd[SEC_L3_L4] < 0) {
 		TAP_LOG(ERR,
 			"Failed to load BPF section %s (%d): %s",
-				sec_name[SEC_L3_L4], errno, strerror(errno));
+				sec_name[SEC_L3_L4], errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c
index 75af3404b0..354574ba29 100644
--- a/drivers/net/tap/tap_netlink.c
+++ b/drivers/net/tap/tap_netlink.c
@@ -14,6 +14,7 @@
 #include <rte_malloc.h>
 #include <tap_netlink.h>
 #include <rte_random.h>
+#include <rte_errno.h>
 
 #include "tap_log.h"
 
@@ -97,7 +98,7 @@ tap_nl_final(int nlsk_fd)
 {
 	if (close(nlsk_fd)) {
 		TAP_LOG(ERR, "Failed to close netlink socket: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return 0;
@@ -129,7 +130,7 @@ tap_nl_send(int nlsk_fd, struct nlmsghdr *nh)
 			goto retry;
 
 		TAP_LOG(ERR, "Failed to send netlink message: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return send_bytes;
diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c
index a3aae3c814..28d4809360 100644
--- a/drivers/net/tap/tap_tcmsgs.c
+++ b/drivers/net/tap/tap_tcmsgs.c
@@ -8,6 +8,8 @@
 #include <net/if.h>
 #include <string.h>
 
+#include <rte_errno.h>
+
 #include <rte_log.h>
 #include <tap_tcmsgs.h>
 #include "tap_log.h"
@@ -263,7 +265,7 @@ qdisc_create_multiq(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_multiq(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add multiq qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -289,7 +291,7 @@ qdisc_create_ingress(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_ingress(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add ingress qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 37/42] net/vhost: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (35 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 36/42] net/tap: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 38/42] net/virtio: " Dengdui Huang
                       ` (4 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 21bbb008e0..75b48dc31e 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -567,7 +567,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 			VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
-				vq->kickfd, rxq_idx, strerror(errno));
+				vq->kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
 				vq->kickfd, rxq_idx);
@@ -579,7 +579,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) {
 			VHOST_LOG(ERR, "Failed to register %d in rxq-%d epoll: %s\n",
-				vring.kickfd, rxq_idx, strerror(errno));
+				vring.kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			vq->kickfd = vring.kickfd;
 			VHOST_LOG(DEBUG, "Registered %d in rxq-%d epoll\n",
@@ -730,7 +730,7 @@ eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev)
 		if (vq->kickfd >= 0) {
 			if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 				VHOST_LOG(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s\n",
-					vq->kickfd, i, strerror(errno));
+					vq->kickfd, i, rte_strerror(errno));
 			} else {
 				VHOST_LOG(DEBUG, "Unregistered %d from rxq-%d epoll\n",
 					vq->kickfd, i);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 38/42] net/virtio: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (36 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 37/42] net/vhost: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 39/42] raw/ifpga: " Dengdui Huang
                       ` (3 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel.c |  8 +++---
 .../net/virtio/virtio_user/vhost_kernel_tap.c | 25 ++++++++++---------
 drivers/net/virtio/virtio_user/vhost_user.c   | 20 +++++++--------
 drivers/net/virtio/virtio_user/vhost_vdpa.c   | 12 ++++-----
 .../net/virtio/virtio_user/virtio_user_dev.c  |  8 +++---
 drivers/net/virtio/virtio_user_ethdev.c       |  6 ++---
 6 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
index e42bb35935..b1dec119fc 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -92,7 +92,7 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-kernel ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -428,7 +428,7 @@ vhost_kernel_setup(struct virtio_user_dev *dev)
 	for (i = 0; i < dev->max_queue_pairs; ++i) {
 		vhostfd = open(dev->path, O_RDWR);
 		if (vhostfd < 0) {
-			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, rte_strerror(errno));
 			goto err_tapfds;
 		}
 		data->vhostfds[i] = vhostfd;
@@ -511,14 +511,14 @@ vhost_kernel_set_backend(int vhostfd, int tapfd)
 	f.index = 0;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	f.index = 1;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index 611e2e25ec..4542ccbf04 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -13,6 +13,7 @@
 #include <limits.h>
 
 #include <rte_ether.h>
+#include <rte_errno.h>
 
 #include "vhost_kernel_tap.h"
 #include "../virtio_logs.h"
@@ -27,12 +28,12 @@ tap_support_features(unsigned int *tap_features)
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
 		PMD_DRV_LOG(ERR, "fail to open %s: %s",
-			    PATH_NET_TUN, strerror(errno));
+			    PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNGETFEATURES, tap_features) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -49,11 +50,11 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
-		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, strerror(errno));
+		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 	if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -68,12 +69,12 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 		if (multi_queue) {
 			PMD_DRV_LOG(DEBUG,
 				"TUNSETIFF failed (will retry without IFF_MULTI_QUEUE): %s",
-				strerror(errno));
+				rte_strerror(errno));
 			multi_queue = false;
 			goto retry_mono_q;
 		}
 
-		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", rte_strerror(errno));
 		close(tapfd);
 		tapfd = -1;
 	}
@@ -88,7 +89,7 @@ tap_get_name(int tapfd, char **name)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	ret = asprintf(name, "%s", ifr.ifr_name);
@@ -104,7 +105,7 @@ tap_get_flags(int tapfd, unsigned int *tap_flags)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	*tap_flags = ifr.ifr_flags;
@@ -120,7 +121,7 @@ tap_set_mac(int tapfd, uint8_t *mac)
 	ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
 	memcpy(ifr.ifr_hwaddr.sa_data, mac, RTE_ETHER_ADDR_LEN);
 	if (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -155,7 +156,7 @@ vhost_kernel_tap_set_offload(int fd, uint64_t features)
 		offload &= ~TUN_F_UFO;
 		if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
 			PMD_DRV_LOG(ERR, "TUNSETOFFLOAD ioctl() failed: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -175,12 +176,12 @@ vhost_kernel_tap_setup(int tapfd, int hdr_size, uint64_t features)
 	 * max_mem_regions, supported in newer version linux kernel
 	 */
 	if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNSETSNDBUF, &sndbuf) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index 3c05ac9cc0..e079c726da 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -135,7 +135,7 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num)
 	} while (r < 0 && errno == EINTR);
 
 	if (r < 0)
-		PMD_DRV_LOG(ERR, "Failed to send msg: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to send msg: %s", rte_strerror(errno));
 
 	return r;
 }
@@ -148,7 +148,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 
 	ret = recv(fd, (void *)msg, sz_hdr, 0);
 	if (ret < 0) {
-		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", rte_strerror(errno));
 		return -1;
 	} else if (ret < sz_hdr) {
 		PMD_DRV_LOG(ERR, "Failed to recv msg hdr: %d instead of %d.",
@@ -174,7 +174,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 	if (sz_payload) {
 		ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
 		if (ret < 0) {
-			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", rte_strerror(errno));
 			return -1;
 		} else if (ret < sz_payload) {
 			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %d instead of %u.",
@@ -749,7 +749,7 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	ret = bind(fd, (struct sockaddr *)un, sizeof(*un));
 	if (ret < 0) {
 		PMD_DRV_LOG(ERR, "failed to bind to %s: %s; remove it and try again",
-			    dev->path, strerror(errno));
+			    dev->path, rte_strerror(errno));
 		return -1;
 	}
 	ret = listen(fd, MAX_VIRTIO_USER_BACKLOG);
@@ -760,13 +760,13 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	data->vhostfd = accept(fd, NULL, NULL);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to accept initial client connection (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	flag = fcntl(fd, F_GETFL);
 	if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl failed, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl failed, %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -834,15 +834,15 @@ vhost_user_setup(struct virtio_user_dev *dev)
 
 	fd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (fd < 0) {
-		PMD_DRV_LOG(ERR, "socket() error, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "socket() error, %s", rte_strerror(errno));
 		goto err_data;
 	}
 
 	flag = fcntl(fd, F_GETFD);
 	if (flag == -1)
-		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", rte_strerror(errno));
 	else if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0)
-		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", rte_strerror(errno));
 
 	memset(&un, 0, sizeof(un));
 	un.sun_family = AF_UNIX;
@@ -856,7 +856,7 @@ vhost_user_setup(struct virtio_user_dev *dev)
 		}
 	} else {
 		if (connect(fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
-			PMD_DRV_LOG(ERR, "connect error, %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "connect error, %s", rte_strerror(errno));
 			goto err_socket;
 		}
 		data->vhostfd = fd;
diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c
index 2c36b26224..ac0ef2c3f9 100644
--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
@@ -92,7 +92,7 @@ vhost_vdpa_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-vDPA ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -186,7 +186,7 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch begin (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -212,7 +212,7 @@ vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch end (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -243,7 +243,7 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -272,7 +272,7 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -530,7 +530,7 @@ vhost_vdpa_setup(struct virtio_user_dev *dev)
 	data->vhostfd = open(dev->path, O_RDWR);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to open %s: %s",
-				dev->path, strerror(errno));
+				dev->path, rte_strerror(errno));
 		free(data);
 		return -1;
 	}
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index af1f8c8237..ad7537a746 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -401,13 +401,13 @@ virtio_user_dev_init_notify(struct virtio_user_dev *dev)
 		 */
 		callfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 		if (callfd < 0) {
-			PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "(%s) callfd error, %s", dev->path, rte_strerror(errno));
 			goto err;
 		}
 		kickfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 		if (kickfd < 0) {
 			close(callfd);
-			PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "(%s) kickfd error, %s", dev->path, rte_strerror(errno));
 			goto err;
 		}
 		dev->callfds[i] = callfd;
@@ -1043,7 +1043,7 @@ virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie)
 
 	if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
 		PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-			    strerror(errno));
+			    rte_strerror(errno));
 }
 
 int
@@ -1264,7 +1264,7 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev *dev)
 
 	if (dev->ops->get_features(dev, &dev->device_features) < 0) {
 		PMD_INIT_LOG(ERR, "get_features failed: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 3a31642899..908afde4fc 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -273,7 +273,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
 
 	if (write(dev->kickfds[vq->vq_queue_index], &buf, sizeof(buf)) < 0)
 		PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-			    strerror(errno));
+			    rte_strerror(errno));
 }
 
 static int
@@ -382,7 +382,7 @@ vdpa_dynamic_major_num(void)
 	fp = fopen("/proc/devices", "r");
 	if (fp == NULL) {
 		PMD_INIT_LOG(ERR, "Cannot open /proc/devices: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return UNNAMED_MAJOR;
 	}
 
@@ -409,7 +409,7 @@ virtio_user_backend_type(const char *path)
 			return VIRTIO_USER_BACKEND_VHOST_USER;
 
 		PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path,
-			     strerror(errno));
+			     rte_strerror(errno));
 		return VIRTIO_USER_BACKEND_UNKNOWN;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 39/42] raw/ifpga: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (37 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 38/42] net/virtio: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 40/42] vdpa/ifc: " Dengdui Huang
                       ` (2 subsequent siblings)
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/raw/ifpga/afu_pmd_n3000.c      |  5 +++--
 drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +++++++-----
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 67b3941265..d7302edc3f 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -21,6 +21,7 @@
 #include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
+#include <rte_errno.h>
 
 #include "afu_pmd_core.h"
 #include "afu_pmd_n3000.h"
@@ -693,7 +694,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 	pfd.events = POLLIN;
 	poll_ret = poll(&pfd, 1, DMA_TIMEOUT_MSEC);
 	if (poll_ret < 0) {
-		IFPGA_RAWDEV_PMD_ERR("Error %s", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Error %s", rte_strerror(errno));
 		ret = -EFAULT;
 		goto out;
 	} else if (poll_ret == 0) {
@@ -708,7 +709,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 			ret = 0;
 		} else {
 			IFPGA_RAWDEV_PMD_ERR("Failed %s", bytes_read > 0 ?
-				strerror(errno) : "zero bytes read");
+				rte_strerror(errno) : "zero bytes read");
 			ret = -EIO;
 		}
 	}
diff --git a/drivers/raw/ifpga/base/ifpga_fme_rsu.c b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
index f147aaa1e8..8e8a611f9a 100644
--- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c
+++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
@@ -7,6 +7,8 @@
 #include <unistd.h>
 #include "ifpga_sec_mgr.h"
 
+#include <rte_errno.h>
+
 static struct ifpga_sec_mgr *sec_mgr;
 
 static void set_rsu_control(struct ifpga_sec_mgr *smgr, uint32_t ctrl)
@@ -112,7 +114,7 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 
@@ -130,14 +132,14 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 			IFPGA_RSU_DATA_BLK_SIZE : length;
 		if (lseek(fd, offset, SEEK_SET) < 0) {
 			dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
 		read_size = read(fd, buf, to_transfer);
 		if (read_size < 0) {
 			dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
@@ -316,7 +318,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	len = lseek(fd, 0, SEEK_END);
@@ -325,7 +327,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (len < 0) {
 		dev_err(smgr,
 			"Failed to get file length of \'%s\' [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	if (len == 0) {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index f89bd3f9e2..56d3ec02eb 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -847,7 +847,7 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id,
 	if (file_fd < 0) {
 		IFPGA_RAWDEV_PMD_ERR("%s: open file error: %s\n",
 				__func__, file_name);
-		IFPGA_RAWDEV_PMD_ERR("Message : %s\n", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Message : %s\n", rte_strerror(errno));
 		return -EINVAL;
 	}
 	ret = stat(file_name, &file_stat);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 40/42] vdpa/ifc: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (38 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 39/42] raw/ifpga: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 41/42] vdpa/mlx5: " Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 42/42] vdpa/sfc: " Dengdui Huang
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index f034bd59ba..34ea450d00 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
+#include <rte_errno.h>
 
 #include "base/ifcvf.h"
 
@@ -446,7 +447,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 			fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 			if (fd < 0) {
 				DRV_LOG(ERR, "can't setup eventfd: %s",
-					strerror(errno));
+					rte_strerror(errno));
 				return -1;
 			}
 			internal->intr_fd[i] = fd;
@@ -457,7 +458,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error enabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -489,7 +490,7 @@ vdpa_disable_vfio_intr(struct ifcvf_internal *internal)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error disabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -526,7 +527,7 @@ notify_relay(void *arg)
 		rte_vhost_get_vhost_vring(internal->vid, qid, &vring);
 		ev.data.u64 = qid | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -552,7 +553,7 @@ notify_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -628,7 +629,7 @@ intr_relay(void *arg)
 	ev.data.fd = rte_intr_fd_get(internal->pdev->intr_handle);
 	if (epoll_ctl(csc_epfd, EPOLL_CTL_ADD,
 		rte_intr_fd_get(internal->pdev->intr_handle), &ev) < 0) {
-		DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+		DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 		goto out;
 	}
 
@@ -653,7 +654,7 @@ intr_relay(void *arg)
 					continue;
 				DRV_LOG(ERR, "Error reading from file descriptor %d: %s\n",
 					csc_event.data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				goto out;
 			} else if (nbytes == 0) {
 				DRV_LOG(ERR, "Read nothing from file descriptor %d\n",
@@ -947,7 +948,7 @@ vring_relay(void *arg)
 		rte_vhost_get_vhost_vring(vid, qid, &vring);
 		ev.data.u64 = qid << 1 | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -961,7 +962,7 @@ vring_relay(void *arg)
 			(uint64_t)internal->intr_fd[qid] << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, internal->intr_fd[qid], &ev)
 				< 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 		update_used_ring(internal, qid);
@@ -992,7 +993,7 @@ vring_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -1265,7 +1266,7 @@ ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret) {
 		DRV_LOG(ERR, "Get not get device region info: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 41/42] vdpa/mlx5: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (39 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 40/42] vdpa/ifc: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  2023-11-14 12:35     ` [PATCH v3 42/42] vdpa/sfc: " Dengdui Huang
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 607e290995..243abef588 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -44,7 +44,7 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
 			    errno == EAGAIN)
 				continue;
 			DRV_LOG(ERR,  "Failed to read kickfd of virtq %d: %s.",
-				virtq->index, strerror(errno));
+				virtq->index, rte_strerror(errno));
 		}
 		break;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v3 42/42] vdpa/sfc: use rte strerror
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
                       ` (40 preceding siblings ...)
  2023-11-14 12:35     ` [PATCH v3 41/42] vdpa/mlx5: " Dengdui Huang
@ 2023-11-14 12:35     ` Dengdui Huang
  41 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2023-11-14 12:35 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, lihuisong, fengchengwen, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index 00f9a4b04c..56fb7f96d8 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -137,7 +137,7 @@ sfc_vdpa_enable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error enabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -165,7 +165,7 @@ sfc_vdpa_disable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error disabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -841,7 +841,7 @@ sfc_vdpa_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret != 0) {
 		sfc_vdpa_err(dev, "could not get device region info: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH 00/43] replace strerror
  2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
                   ` (42 preceding siblings ...)
  2023-11-14  8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang
@ 2023-11-15  0:16 ` Stephen Hemminger
  2024-02-01 11:03   ` David Marchand
  2024-10-22 10:48   ` Morten Brørup
  43 siblings, 2 replies; 190+ messages in thread
From: Stephen Hemminger @ 2023-11-15  0:16 UTC (permalink / raw)
  To: Dengdui Huang; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

On Tue, 14 Nov 2023 16:24:56 +0800
Dengdui Huang <huangdengdui@huawei.com> wrote:

> The function strerror() is insecure in a multi-thread environment.
> This series of patches fix it. In this patchset, only the libs and
> drivers are modified.

Doing such a global replace seems like a lot of changes for many
cases that are not multi-threaded.

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH 02/43] eal: use rte strerror
  2023-11-14  8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang
@ 2023-11-15  0:18   ` Stephen Hemminger
  2023-11-15 11:16     ` Morten Brørup
  2023-11-15  0:22   ` Stephen Hemminger
  1 sibling, 1 reply; 190+ messages in thread
From: Stephen Hemminger @ 2023-11-15  0:18 UTC (permalink / raw)
  To: Dengdui Huang; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

On Tue, 14 Nov 2023 16:24:58 +0800
Dengdui Huang <huangdengdui@huawei.com> wrote:

> The function strerror() is insecure in a multi-thread environment.
> This patch uses rte_strerror() to replace it.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>

NAK.
rte_strerror() is no more thrad safe than strerror() and only
is appropriate for rte_errno, ie errors from DPDK.
It is not originally designed as strerror() replacement.

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH 02/43] eal: use rte strerror
  2023-11-14  8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang
  2023-11-15  0:18   ` Stephen Hemminger
@ 2023-11-15  0:22   ` Stephen Hemminger
  2023-11-15 11:23     ` Morten Brørup
  1 sibling, 1 reply; 190+ messages in thread
From: Stephen Hemminger @ 2023-11-15  0:22 UTC (permalink / raw)
  To: Dengdui Huang; +Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

On Tue, 14 Nov 2023 16:24:58 +0800
Dengdui Huang <huangdengdui@huawei.com> wrote:

> The function strerror() is insecure in a multi-thread environment.
> This patch uses rte_strerror() to replace it.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> ---

Look at implementation of rte_strerror(), it still has issues if
used from non-DPDK registered threads.

^ permalink raw reply	[flat|nested] 190+ messages in thread

* RE: [PATCH 02/43] eal: use rte strerror
  2023-11-15  0:18   ` Stephen Hemminger
@ 2023-11-15 11:16     ` Morten Brørup
  2024-02-01 21:49       ` Stephen Hemminger
  0 siblings, 1 reply; 190+ messages in thread
From: Morten Brørup @ 2023-11-15 11:16 UTC (permalink / raw)
  To: Stephen Hemminger, Dengdui Huang
  Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Wednesday, 15 November 2023 01.18
> 
> On Tue, 14 Nov 2023 16:24:58 +0800
> Dengdui Huang <huangdengdui@huawei.com> wrote:
> 
> > The function strerror() is insecure in a multi-thread environment.
> > This patch uses rte_strerror() to replace it.
> >
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> > Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> 
> NAK.
> rte_strerror() is no more thrad safe than strerror()

It is thread safe:
https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L31

> and only
> is appropriate for rte_errno, ie errors from DPDK.
> It is not originally designed as strerror() replacement.

I can buy this argument.

However, if we ensure that DPDK specific error numbers don't overlap POSIX (and Windows specific, if any) error numbers, I would consider rte_strerror() an excellent alternative to strerror().

We could then consider deeming strerror() unsafe, and add it to checkpatches to recommend rte_strerror() as the general replacement.


^ permalink raw reply	[flat|nested] 190+ messages in thread

* RE: [PATCH 02/43] eal: use rte strerror
  2023-11-15  0:22   ` Stephen Hemminger
@ 2023-11-15 11:23     ` Morten Brørup
  2023-11-15 15:06       ` Stephen Hemminger
  0 siblings, 1 reply; 190+ messages in thread
From: Morten Brørup @ 2023-11-15 11:23 UTC (permalink / raw)
  To: Stephen Hemminger, Dengdui Huang
  Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Wednesday, 15 November 2023 01.23
> 
> On Tue, 14 Nov 2023 16:24:58 +0800
> Dengdui Huang <huangdengdui@huawei.com> wrote:
> 
> > The function strerror() is insecure in a multi-thread environment.
> > This patch uses rte_strerror() to replace it.
> >
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> > Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> > ---
> 
> Look at implementation of rte_strerror(), it still has issues if
> used from non-DPDK registered threads.

The macro names RTE_DEFINE_PER_LCORE() and RTE_PER_LCORE() strongly indicate that the variables are instantiated per lcore.

But they are not; they are instantiated per thread [1]:

#define RTE_DEFINE_PER_LCORE(type, name)			\
	__thread __typeof__(type) per_lcore_##name


[1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH 02/43] eal: use rte strerror
  2023-11-15 11:23     ` Morten Brørup
@ 2023-11-15 15:06       ` Stephen Hemminger
  0 siblings, 0 replies; 190+ messages in thread
From: Stephen Hemminger @ 2023-11-15 15:06 UTC (permalink / raw)
  To: Morten Brørup
  Cc: Dengdui Huang, dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

On Wed, 15 Nov 2023 12:23:13 +0100
Morten Brørup <mb@smartsharesystems.com> wrote:

> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Wednesday, 15 November 2023 01.23
> > 
> > On Tue, 14 Nov 2023 16:24:58 +0800
> > Dengdui Huang <huangdengdui@huawei.com> wrote:
> >   
> > > The function strerror() is insecure in a multi-thread environment.
> > > This patch uses rte_strerror() to replace it.
> > >
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> > > Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> > > ---  
> > 
> > Look at implementation of rte_strerror(), it still has issues if
> > used from non-DPDK registered threads.  
> 
> The macro names RTE_DEFINE_PER_LCORE() and RTE_PER_LCORE() strongly indicate that the variables are instantiated per lcore.
> 
> But they are not; they are instantiated per thread [1]:

So rte_strerror() is thread safe (good).
It make sense to use it, take back my original negative comments.
We could improve documentation of rte_strerror() to help.

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH 00/43] replace strerror
  2023-11-15  0:16 ` [PATCH 00/43] " Stephen Hemminger
@ 2024-02-01 11:03   ` David Marchand
  2024-10-22 10:48   ` Morten Brørup
  1 sibling, 0 replies; 190+ messages in thread
From: David Marchand @ 2024-02-01 11:03 UTC (permalink / raw)
  To: Stephen Hemminger, Dengdui Huang
  Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

On Wed, Nov 15, 2023 at 1:17 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> On Tue, 14 Nov 2023 16:24:56 +0800
> Dengdui Huang <huangdengdui@huawei.com> wrote:
>
> > The function strerror() is insecure in a multi-thread environment.
> > This series of patches fix it. In this patchset, only the libs and
> > drivers are modified.
>
> Doing such a global replace seems like a lot of changes for many
> cases that are not multi-threaded.
>

Is there an actual fix mixed somewhere in this series?
If so, it should be clearly identified for backports.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH 02/43] eal: use rte strerror
  2023-11-15 11:16     ` Morten Brørup
@ 2024-02-01 21:49       ` Stephen Hemminger
  0 siblings, 0 replies; 190+ messages in thread
From: Stephen Hemminger @ 2024-02-01 21:49 UTC (permalink / raw)
  To: Morten Brørup
  Cc: Dengdui Huang, dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

On Wed, 15 Nov 2023 12:16:18 +0100
Morten Brørup <mb@smartsharesystems.com> wrote:

> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Wednesday, 15 November 2023 01.18
> > 
> > On Tue, 14 Nov 2023 16:24:58 +0800
> > Dengdui Huang <huangdengdui@huawei.com> wrote:
> >   
> > > The function strerror() is insecure in a multi-thread environment.
> > > This patch uses rte_strerror() to replace it.
> > >
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> > > Acked-by: Chengwen Feng <fengchengwen@huawei.com>  
> > 
> > NAK.
> > rte_strerror() is no more thrad safe than strerror()  
> 
> It is thread safe:
> https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L31

Thread safe, but not signal safe.
 a per-core buffer is not safe against preemption in an interrupt.

^ permalink raw reply	[flat|nested] 190+ messages in thread

* RE: [PATCH 00/43] replace strerror
  2023-11-15  0:16 ` [PATCH 00/43] " Stephen Hemminger
  2024-02-01 11:03   ` David Marchand
@ 2024-10-22 10:48   ` Morten Brørup
  1 sibling, 0 replies; 190+ messages in thread
From: Morten Brørup @ 2024-10-22 10:48 UTC (permalink / raw)
  To: Stephen Hemminger, Dengdui Huang
  Cc: dev, ferruh.yigit, lihuisong, fengchengwen, liuyonglong

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Wednesday, 15 November 2023 01.17
> 
> On Tue, 14 Nov 2023 16:24:56 +0800
> Dengdui Huang <huangdengdui@huawei.com> wrote:
> 
> > The function strerror() is insecure in a multi-thread environment.
> > This series of patches fix it. In this patchset, only the libs and
> > drivers are modified.
> 
> Doing such a global replace seems like a lot of changes for many
> cases that are not multi-threaded.

+1 to doing this, also in functions that are supposed to be single threaded; because it allows the addition to checkpatches.

Acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 00/42] replace strerror
  2023-11-14  8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang
  2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
  2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
@ 2024-10-23  8:28   ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang
                       ` (43 more replies)
  2 siblings, 44 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
It is better to use rte_strerror() instead of strerror().
In this patchset, only the libs and drivers are modified.

chang log:
v3->v4 fix ci error
v2->v3 drop patch "telemetry: replace strerror" due to compile fail
v1-v2 fix ci error

Dengdui Huang (42):
  devtools: forbid use of strerror
  eal: use rte strerror
  eventdev: use rte strerror
  latency: use rte strerror
  node: use rte strerror
  pdump: use rte strerror
  power: use rte strerror
  vhost: use rte strerror
  bpf: use rte strerror
  bus/cdx: use rte strerror
  bus/dpaa: use rte strerror
  bus/fslmc: use rte strerror
  bus/pci: use rte strerror
  bus/vdev: use rte strerror
  bus/vmbus: use rte strerror
  common/cnxk: use rte strerror
  common/mlx5: use rte strerror
  crypto/caam_jr: use rte strerror
  dma/idxd: use rte strerror
  net/af_packet: use rte strerror
  net/bnxt: use rte strerror
  net/af_xdp: use rte strerror
  net/bonding: use rte strerror
  net/dpaa: use rte strerror
  net/dpaa2: use rte strerror
  net/enetfec: use rte strerror
  net/failsafe: use rte strerror
  net/i40e: use rte strerror
  net/ice: use rte strerror
  net/ixgbe: use rte strerror
  net/memif: use rte strerror
  net/mlx4: use rte strerror
  net/mlx5: use rte strerror
  net/qede: use rte strerror
  net/sfc: use rte strerror
  net/tap: use rte strerror
  net/vhost: use rte strerror
  net/virtio: use rte strerror
  raw/ifpga: use rte strerror
  vdpa/ifc: use rte strerror
  vdpa/mlx5: use rte strerror
  vdpa/sfc: use rte strerror

 devtools/checkpatches.sh                      |   8 +
 drivers/bus/cdx/cdx.c                         |   2 +-
 drivers/bus/cdx/cdx_vfio.c                    |  13 +-
 drivers/bus/dpaa/base/fman/fman.c             |   2 +-
 drivers/bus/dpaa/dpaa_bus.c                   |   2 +-
 drivers/bus/fslmc/fslmc_vfio.c                |  12 +-
 drivers/bus/pci/bsd/pci.c                     |   8 +-
 drivers/bus/pci/linux/pci.c                   |   7 +-
 drivers/bus/pci/linux/pci_uio.c               |  23 +-
 drivers/bus/pci/linux/pci_vfio.c              |  23 +-
 drivers/bus/pci/pci_common_uio.c              |   3 +-
 drivers/bus/vdev/vdev.c                       |   2 +-
 drivers/bus/vmbus/linux/vmbus_bus.c           |   7 +-
 drivers/bus/vmbus/linux/vmbus_uio.c           |  21 +-
 drivers/bus/vmbus/vmbus_common.c              |   4 +-
 drivers/bus/vmbus/vmbus_common_uio.c          |   3 +-
 drivers/common/cnxk/roc_dev.c                 |   6 +-
 drivers/common/cnxk/roc_model.c               |   4 +-
 drivers/common/cnxk/roc_utils.c               |   4 +-
 drivers/common/mlx5/linux/mlx5_nl.c           |  12 +-
 drivers/common/mlx5/mlx5_common.c             |   6 +-
 drivers/crypto/caam_jr/caam_jr_uio.c          |   5 +-
 drivers/dma/idxd/idxd_bus.c                   |  15 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  12 +-
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 drivers/net/bonding/bonding_testpmd.c         |   4 +-
 drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
 drivers/net/bonding/rte_eth_bond_flow.c       |   4 +-
 drivers/net/bonding/rte_eth_bond_pmd.c        |   6 +-
 drivers/net/dpaa/dpaa_ethdev.c                |   4 +-
 drivers/net/dpaa/fmlib/fm_lib.c               |   6 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
 drivers/net/enetfec/enet_uio.c                |   2 +-
 drivers/net/failsafe/failsafe.c               |   8 +-
 drivers/net/failsafe/failsafe_args.c          |   4 +-
 drivers/net/failsafe/failsafe_eal.c           |   4 +-
 drivers/net/failsafe/failsafe_flow.c          |   4 +-
 drivers/net/failsafe/failsafe_ops.c           |   2 +-
 drivers/net/failsafe/failsafe_private.h       |   6 +-
 drivers/net/i40e/i40e_testpmd.c               |  42 +--
 drivers/net/ice/ice_testpmd.c                 |   4 +-
 drivers/net/ixgbe/ixgbe_testpmd.c             |  12 +-
 drivers/net/memif/memif_socket.c              |   4 +-
 drivers/net/memif/rte_eth_memif.c             |  20 +-
 drivers/net/mlx4/mlx4.c                       |  14 +-
 drivers/net/mlx4/mlx4_ethdev.c                |  18 +-
 drivers/net/mlx4/mlx4_rxq.c                   |  10 +-
 drivers/net/mlx4/mlx4_txq.c                   |  10 +-
 drivers/net/mlx5/hws/mlx5dr_matcher.c         |   2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |  22 +-
 drivers/net/mlx5/linux/mlx5_os.c              |  18 +-
 drivers/net/mlx5/linux/mlx5_socket.c          |  16 +-
 drivers/net/mlx5/linux/mlx5_verbs.c           |   8 +-
 drivers/net/mlx5/mlx5.c                       |   8 +-
 drivers/net/mlx5/mlx5_devx.c                  |   4 +-
 drivers/net/mlx5/mlx5_mac.c                   |   2 +-
 drivers/net/mlx5/mlx5_rxmode.c                |   8 +-
 drivers/net/mlx5/mlx5_rxq.c                   |   4 +-
 drivers/net/mlx5/mlx5_rxtx.c                  |   2 +-
 drivers/net/mlx5/mlx5_stats.c                 |   4 +-
 drivers/net/mlx5/mlx5_testpmd.c               |  26 +-
 drivers/net/mlx5/mlx5_trigger.c               |  12 +-
 drivers/net/mlx5/mlx5_vlan.c                  |   2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c     |   2 +-
 drivers/net/mlx5/windows/mlx5_os.c            |  12 +-
 drivers/net/qede/qede_regs.c                  |   4 +-
 drivers/net/sfc/sfc_flow.c                    |   2 +-
 drivers/net/sfc/sfc_flow_tunnel.c             |   2 +-
 drivers/net/sfc/sfc_mae.c                     |  58 ++---
 drivers/net/tap/rte_eth_tap.c                 |  28 +-
 drivers/net/tap/tap_flow.c                    |  14 +-
 drivers/net/tap/tap_netlink.c                 |   5 +-
 drivers/net/tap/tap_tcmsgs.c                  |   6 +-
 drivers/net/vhost/rte_eth_vhost.c             |   6 +-
 drivers/net/virtio/virtio_user/vhost_kernel.c |   8 +-
 .../net/virtio/virtio_user/vhost_kernel_tap.c |  25 +-
 drivers/net/virtio/virtio_user/vhost_user.c   |  20 +-
 drivers/net/virtio/virtio_user/vhost_vdpa.c   |  12 +-
 .../net/virtio/virtio_user/virtio_user_dev.c  |   8 +-
 drivers/net/virtio/virtio_user_ethdev.c       |   6 +-
 drivers/raw/ifpga/afu_pmd_n3000.c             |   5 +-
 drivers/raw/ifpga/base/ifpga_fme_rsu.c        |  12 +-
 drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c                 |  23 +-
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c           |   2 +-
 drivers/vdpa/sfc/sfc_vdpa_ops.c               |   6 +-
 lib/bpf/bpf_load_elf.c                        |   2 +-
 lib/eal/common/eal_common_fbarray.c           |   2 +-
 lib/eal/common/eal_common_options.c           |   7 +-
 lib/eal/common/eal_common_proc.c              |  12 +-
 lib/eal/common/eal_common_trace_utils.c       |   6 +-
 lib/eal/freebsd/eal.c                         |   4 +-
 lib/eal/freebsd/eal_interrupts.c              |   8 +-
 lib/eal/freebsd/eal_memory.c                  |   2 +-
 lib/eal/freebsd/eal_timer.c                   |   7 +-
 lib/eal/linux/eal.c                           |  10 +-
 lib/eal/linux/eal_dev.c                       |   2 +-
 lib/eal/linux/eal_hugepage_info.c             |   5 +-
 lib/eal/linux/eal_interrupts.c                |  18 +-
 lib/eal/linux/eal_memalloc.c                  |  47 ++--
 lib/eal/linux/eal_memory.c                    |  42 +--
 lib/eal/linux/eal_timer.c                     |   2 +-
 lib/eal/linux/eal_vfio.c                      |  42 +--
 lib/eal/unix/eal_filesystem.c                 |   5 +-
 lib/eal/unix/eal_unix_memory.c                |   6 +-
 lib/eal/unix/rte_thread.c                     |   6 +-
 lib/eventdev/rte_event_eth_rx_adapter.c       |   2 +-
 lib/latencystats/rte_latencystats.c           |   4 +-
 lib/node/kernel_tx.c                          |   2 +-
 lib/pdump/rte_pdump.c                         |   6 +-
 lib/power/guest_channel.c                     |   7 +-
 lib/power/power_kvm_vm.c                      |   3 +-
 lib/power/power_pstate_cpufreq.c              |   7 +-
 lib/power/rte_power_pmd_mgmt.c                |   2 +-
 lib/vhost/fd_man.c                            |   7 +-
 lib/vhost/socket.c                            |  13 +-
 lib/vhost/vduse.c                             |  45 ++--
 lib/vhost/vhost_user.c                        |  10 +-
 135 files changed, 956 insertions(+), 913 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 01/42] devtools: forbid use of strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 02/42] eal: use rte strerror Dengdui Huang
                       ` (42 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
rte_strerror() has been provided in DPDK to replace it.

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index d860f19045..078d5714da 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -209,6 +209,14 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# refrain from using strerror() for drivers and libs
+	awk -v FOLDERS="lib drivers" \
+		-v EXPRESSIONS="\\\sstrerror\\\(" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Using strerror, prefer rte_strerror' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	# refrain from using RTE_LOG_REGISTER for drivers and libs
 	awk -v FOLDERS='lib drivers' \
 		-v EXPRESSIONS='\\<RTE_LOG_REGISTER\\>' \
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 02/42] eal: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 03/42] eventdev: " Dengdui Huang
                       ` (41 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/eal/common/eal_common_fbarray.c     |  2 +-
 lib/eal/common/eal_common_options.c     |  7 ++--
 lib/eal/common/eal_common_proc.c        | 12 +++----
 lib/eal/common/eal_common_trace_utils.c |  6 ++--
 lib/eal/freebsd/eal.c                   |  4 +--
 lib/eal/freebsd/eal_interrupts.c        |  8 ++---
 lib/eal/freebsd/eal_memory.c            |  2 +-
 lib/eal/freebsd/eal_timer.c             |  7 ++--
 lib/eal/linux/eal.c                     | 10 +++---
 lib/eal/linux/eal_dev.c                 |  2 +-
 lib/eal/linux/eal_hugepage_info.c       |  5 +--
 lib/eal/linux/eal_interrupts.c          | 18 +++++-----
 lib/eal/linux/eal_memalloc.c            | 47 +++++++++++++------------
 lib/eal/linux/eal_memory.c              | 42 +++++++++++-----------
 lib/eal/linux/eal_timer.c               |  2 +-
 lib/eal/linux/eal_vfio.c                | 42 +++++++++++-----------
 lib/eal/unix/eal_filesystem.c           |  5 +--
 lib/eal/unix/eal_unix_memory.c          |  6 ++--
 lib/eal/unix/rte_thread.c               |  6 ++--
 19 files changed, 119 insertions(+), 114 deletions(-)

diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c
index 22b43073c6..8b3ab3cb19 100644
--- a/lib/eal/common/eal_common_fbarray.c
+++ b/lib/eal/common/eal_common_fbarray.c
@@ -1041,7 +1041,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)
 		eal_get_fbarray_path(path, sizeof(path), arr->name);
 		if (unlink(path)) {
 			EAL_LOG(DEBUG, "Cannot unlink fbarray: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			/*
 			 * we're still holding an exclusive lock, so drop it to
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index f1a5e329a5..2aee5a7dad 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -44,6 +44,7 @@
 #ifndef RTE_EXEC_ENV_WINDOWS
 #include "eal_trace.h"
 #endif
+#include <rte_errno.h>
 
 #define BITS_PER_HEX 4
 #define LCORE_OPT_LST 1
@@ -411,7 +412,7 @@ eal_plugindir_init(const char *path)
 	d = opendir(path);
 	if (d == NULL) {
 		EAL_LOG(ERR, "failed to open directory %s: %s",
-			path, strerror(errno));
+			path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -463,7 +464,7 @@ verify_perms(const char *dirpath)
 	/* call stat to check for permissions and ensure not world writable */
 	if (stat(dirpath, &st) != 0) {
 		EAL_LOG(ERR, "Error with stat on %s, %s",
-				dirpath, strerror(errno));
+				dirpath, rte_strerror(errno));
 		return -1;
 	}
 	if (st.st_mode & S_IWOTH) {
@@ -491,7 +492,7 @@ eal_dlopen(const char *pathname)
 	}
 	if (realp == NULL) {
 		EAL_LOG(ERR, "Error with realpath for %s, %s",
-				pathname, strerror(errno));
+				pathname, rte_strerror(errno));
 		goto out;
 	}
 	if (strnlen(realp, PATH_MAX) == PATH_MAX) {
diff --git a/lib/eal/common/eal_common_proc.c b/lib/eal/common/eal_common_proc.c
index d24093937c..07ccf68118 100644
--- a/lib/eal/common/eal_common_proc.c
+++ b/lib/eal/common/eal_common_proc.c
@@ -291,7 +291,7 @@ read_msg(int fd, struct mp_msg_internal *m, struct sockaddr_un *s)
 		if (errno == EINTR)
 			goto retry;
 
-		EAL_LOG(ERR, "recvmsg failed, %s", strerror(errno));
+		EAL_LOG(ERR, "recvmsg failed, %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -583,7 +583,7 @@ open_socket_fd(void)
 
 	if (bind(mp_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		EAL_LOG(ERR, "failed to bind %s: %s",
-			un.sun_path, strerror(errno));
+			un.sun_path, rte_strerror(errno));
 		close(mp_fd);
 		return -1;
 	}
@@ -631,13 +631,13 @@ rte_mp_channel_init(void)
 	dir_fd = open(mp_dir_path, O_RDONLY);
 	if (dir_fd < 0) {
 		EAL_LOG(ERR, "failed to open %s: %s",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		return -1;
 	}
 
 	if (flock(dir_fd, LOCK_EX)) {
 		EAL_LOG(ERR, "failed to lock %s: %s",
-			mp_dir_path, strerror(errno));
+			mp_dir_path, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
@@ -650,7 +650,7 @@ rte_mp_channel_init(void)
 	if (rte_thread_create_internal_control(&mp_handle_tid, "mp-msg",
 			mp_handle, NULL) < 0) {
 		EAL_LOG(ERR, "failed to create mp thread: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dir_fd);
 		close(rte_atomic_exchange_explicit(&mp_fd, -1, rte_memory_order_relaxed));
 		return -1;
@@ -733,7 +733,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type)
 			return 0;
 		}
 		EAL_LOG(ERR, "failed to send to (%s) due to %s",
-			dst_path, strerror(errno));
+			dst_path, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c
index 7282715b11..ee5fe6f7b3 100644
--- a/lib/eal/common/eal_common_trace_utils.c
+++ b/lib/eal/common/eal_common_trace_utils.c
@@ -245,7 +245,7 @@ eal_trace_dir_args_save(char const *val)
 	int rc;
 
 	if (asprintf(&dir_path, "%s/", val) == -1) {
-		trace_err("failed to copy directory: %s", strerror(errno));
+		trace_err("failed to copy directory: %s", rte_strerror(errno));
 		return -ENOMEM;
 	}
 
@@ -329,7 +329,7 @@ trace_mkdir(void)
 	/* Create the path if it t exist, no "mkdir -p" available here */
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0 && errno != EEXIST) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
@@ -344,7 +344,7 @@ trace_mkdir(void)
 
 	rc = mkdir(trace->dir, 0700);
 	if (rc < 0) {
-		trace_err("mkdir %s failed [%s]", trace->dir, strerror(errno));
+		trace_err("mkdir %s failed [%s]", trace->dir, rte_strerror(errno));
 		rte_errno = errno;
 		return -rte_errno;
 	}
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 1229230063..083867babd 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -203,7 +203,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -250,7 +250,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
index 23747babc2..1fbcdc2f2d 100644
--- a/lib/eal/freebsd/eal_interrupts.c
+++ b/lib/eal/freebsd/eal_interrupts.c
@@ -186,7 +186,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
 			else
 				EAL_LOG(ERR, "Error adding fd %d kevent, %s",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			ret = -errno;
 			goto fail;
 		}
@@ -323,7 +323,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,
 		if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 			EAL_LOG(ERR, "Error removing fd %d kevent, %s",
 				rte_intr_fd_get(src->intr_handle),
-				strerror(errno));
+				rte_strerror(errno));
 			/* removing non-existent even is an expected condition
 			 * in some circumstances (e.g. oneshot events).
 			 */
@@ -516,7 +516,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				EAL_LOG(ERR, "Error reading from file "
 					"descriptor %d: %s",
 					event_fd,
-					strerror(errno));
+					rte_strerror(errno));
 			} else if (bytes_read == 0)
 				EAL_LOG(ERR, "Read nothing from file "
 					"descriptor %d", event_fd);
@@ -567,7 +567,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)
 				if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
 					EAL_LOG(ERR, "Error removing fd %d kevent, %s",
 						rte_intr_fd_get(src->intr_handle),
-						strerror(errno));
+						rte_strerror(errno));
 					/* removing non-existent even is an expected
 					 * condition in some circumstances
 					 * (e.g. oneshot events).
diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c
index a6f3ba226e..029c84f7b2 100644
--- a/lib/eal/freebsd/eal_memory.c
+++ b/lib/eal/freebsd/eal_memory.c
@@ -85,7 +85,7 @@ rte_eal_hugepage_init(void)
 				MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 		if (addr == MAP_FAILED) {
 			EAL_LOG(ERR, "%s: mmap() failed: %s", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			return -1;
 		}
 
diff --git a/lib/eal/freebsd/eal_timer.c b/lib/eal/freebsd/eal_timer.c
index 4eba66eadb..ccd07072c6 100644
--- a/lib/eal/freebsd/eal_timer.c
+++ b/lib/eal/freebsd/eal_timer.c
@@ -15,6 +15,7 @@
 #include <rte_memory.h>
 #include <rte_eal.h>
 #include <rte_debug.h>
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
@@ -36,20 +37,20 @@ get_tsc_freq(uint64_t arch_hz)
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.smp_tsc", &tmp, &sz, NULL, 0))
-		EAL_LOG(WARNING, "%s", strerror(errno));
+		EAL_LOG(WARNING, "%s", rte_strerror(errno));
 	else if (tmp != 1)
 		EAL_LOG(WARNING, "TSC is not safe to use in SMP mode");
 
 	tmp = 0;
 
 	if (sysctlbyname("kern.timecounter.invariant_tsc", &tmp, &sz, NULL, 0))
-		EAL_LOG(WARNING, "%s", strerror(errno));
+		EAL_LOG(WARNING, "%s", rte_strerror(errno));
 	else if (tmp != 1)
 		EAL_LOG(WARNING, "TSC is not invariant");
 
 	sz = sizeof(tsc_hz);
 	if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) {
-		EAL_LOG(WARNING, "%s", strerror(errno));
+		EAL_LOG(WARNING, "%s", rte_strerror(errno));
 		return arch_hz;
 	}
 
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 54577b7718..ded2222d49 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -160,7 +160,7 @@ eal_clean_runtime_dir(void)
 		closedir(dir);
 
 	EAL_LOG(ERR, "Error while clearing runtime dir: %s",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -288,7 +288,7 @@ rte_eal_config_attach(void)
 		close(mem_cfg_fd);
 		mem_cfg_fd = -1;
 		EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -335,7 +335,7 @@ rte_eal_config_reattach(void)
 			return -1;
 		}
 		EAL_LOG(ERR, "Cannot mmap memory for rte_config! error %i (%s)",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1412,7 +1412,7 @@ rte_eal_check_module(const char *module_name)
 	/* Check if there is sysfs mounted */
 	if (stat("/sys/module", &st) != 0) {
 		EAL_LOG(DEBUG, "sysfs is not mounted! error %i (%s)",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1425,7 +1425,7 @@ rte_eal_check_module(const char *module_name)
 
 	if (stat(sysfs_mod_name, &st) != 0) {
 		EAL_LOG(DEBUG, "Module %s not found! error %i (%s)",
-		        sysfs_mod_name, errno, strerror(errno));
+		        sysfs_mod_name, errno, rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index e63f24d108..95b1d02c9f 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -73,7 +73,7 @@ static void sigbus_handler(int signum, siginfo_t *info,
 	if (ret == -1) {
 		rte_exit(EXIT_FAILURE,
 			 "Failed to handle SIGBUS for hot-unplug, "
-			 "(rte_errno: %s)!", strerror(rte_errno));
+			 "(rte_errno: %s)!", rte_strerror(rte_errno));
 	} else if (ret == 1) {
 		if (sigbus_action_old.sa_flags == SA_SIGINFO
 		    && sigbus_action_old.sa_sigaction) {
diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c
index d47a19c56a..8d4e28fb58 100644
--- a/lib/eal/linux/eal_hugepage_info.c
+++ b/lib/eal/linux/eal_hugepage_info.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_common.h>
 #include "rte_string_fns.h"
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
@@ -378,7 +379,7 @@ walk_hugedir(const char *hugedir, walk_hugedir_t *cb, void *user_data)
 		closedir(dir);
 
 	EAL_LOG(ERR, "Error while walking hugepage dir: %s",
-		strerror(errno));
+		rte_strerror(errno));
 
 	return -1;
 }
@@ -404,7 +405,7 @@ inspect_hugedir_cb(const struct walk_hugedir_data *whd)
 
 	if (fstat(whd->file_fd, &st) < 0)
 		EAL_LOG(DEBUG, "%s(): stat(\"%s\") failed: %s",
-				__func__, whd->file_name, strerror(errno));
+				__func__, whd->file_name, rte_strerror(errno));
 	else
 		(*total_size) += st.st_size;
 }
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index 6436f796eb..629d012436 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -460,7 +460,7 @@ uio_intr_disable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		EAL_LOG(ERR, "Error disabling interrupts for fd %d (%s)",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -474,7 +474,7 @@ uio_intr_enable(const struct rte_intr_handle *intr_handle)
 	if (rte_intr_fd_get(intr_handle) < 0 ||
 	    write(rte_intr_fd_get(intr_handle), &value, sizeof(value)) < 0) {
 		EAL_LOG(ERR, "Error enabling interrupts for fd %d (%s)",
-			rte_intr_fd_get(intr_handle), strerror(errno));
+			rte_intr_fd_get(intr_handle), rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -975,7 +975,7 @@ eal_intr_process_interrupts(struct epoll_event *events, int nfds)
 				EAL_LOG(ERR, "Error reading from file "
 					"descriptor %d: %s",
 					events[n].data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				/*
 				 * The device is unplugged or buggy, remove
 				 * it as an interrupt source and return to
@@ -1130,7 +1130,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 		if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd,
 						&pipe_event) < 0) {
 			rte_panic("Error adding fd to %d epoll_ctl, %s\n",
-					intr_pipe.readfd, strerror(errno));
+					intr_pipe.readfd, rte_strerror(errno));
 		}
 		numfds++;
 
@@ -1153,7 +1153,7 @@ eal_intr_thread_main(__rte_unused void *arg)
 					rte_intr_fd_get(src->intr_handle), &ev) < 0) {
 				rte_panic("Error adding fd %d epoll_ctl, %s\n",
 					rte_intr_fd_get(src->intr_handle),
-					strerror(errno));
+					rte_strerror(errno));
 			}
 			else
 				numfds++;
@@ -1244,7 +1244,7 @@ eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handle)
 				continue;
 			EAL_LOG(ERR,
 				"Error reading from fd %d: %s",
-				fd, strerror(errno));
+				fd, rte_strerror(errno));
 		} else if (nbytes == 0)
 			EAL_LOG(ERR, "Read nothing from fd %d", fd);
 		return;
@@ -1343,7 +1343,7 @@ eal_epoll_wait(int epfd, struct rte_epoll_event *events,
 			}
 			/* epoll_wait fail */
 			EAL_LOG(ERR, "epoll_wait returns with fail %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rc = -1;
 			break;
 		} else {
@@ -1412,7 +1412,7 @@ rte_epoll_ctl(int epfd, int op, int fd,
 	ev.events = event->epdata.event;
 	if (epoll_ctl(epfd, op, fd, &ev) < 0) {
 		EAL_LOG(ERR, "Error op %d fd %d epoll_ctl, %s",
-			op, fd, strerror(errno));
+			op, fd, rte_strerror(errno));
 		if (op == EPOLL_CTL_ADD)
 			/* rollback status when CTL_ADD fail */
 			rte_atomic_store_explicit(&event->status, RTE_EPOLL_INVALID,
@@ -1525,7 +1525,7 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)
 			if (fd < 0) {
 				EAL_LOG(ERR,
 					"can't setup eventfd, error %i (%s)",
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 				return -errno;
 			}
 
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index e354efc95d..08cb502a5a 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -31,6 +31,7 @@
 #include <rte_log.h>
 #include <rte_eal.h>
 #include <rte_memory.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "eal_internal_cfg.h"
@@ -161,7 +162,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id)
 			  oldmask->size + 1, 0, 0) < 0) {
 		EAL_LOG(ERR,
 			"Failed to get current mempolicy: %s. "
-			"Assuming MPOL_DEFAULT.", strerror(errno));
+			"Assuming MPOL_DEFAULT.", rte_strerror(errno));
 		*oldpolicy = MPOL_DEFAULT;
 	}
 	EAL_LOG(DEBUG,
@@ -180,7 +181,7 @@ restore_numa(int *oldpolicy, struct bitmask *oldmask)
 	} else if (set_mempolicy(*oldpolicy, oldmask->maskp,
 				 oldmask->size + 1) < 0) {
 		EAL_LOG(ERR, "Failed to restore mempolicy: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		numa_set_localalloc();
 	}
 	numa_free_cpumask(oldmask);
@@ -224,7 +225,7 @@ static int lock(int fd, int type)
 		return 0;
 	} else if (ret) {
 		EAL_LOG(ERR, "%s(): error calling flock(): %s",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return -1;
 	}
 	/* lock was successful */
@@ -252,7 +253,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				EAL_LOG(DEBUG, "%s(): memfd create failed: %s",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].memseg_list_fd = fd;
@@ -266,7 +267,7 @@ get_seg_memfd(struct hugepage_info *hi __rte_unused,
 			fd = memfd_create(segname, flags);
 			if (fd < 0) {
 				EAL_LOG(DEBUG, "%s(): memfd create failed: %s",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 			fd_list[list_idx].fds[seg_idx] = fd;
@@ -317,7 +318,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	ret = stat(path, &st);
 	if (ret < 0 && errno != ENOENT) {
 		EAL_LOG(DEBUG, "%s(): stat() for '%s' failed: %s",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	if (!internal_conf->hugepage_file.unlink_existing && ret == 0 &&
@@ -343,7 +344,7 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 		/* coverity[toctou] */
 		if (unlink(path) < 0) {
 			EAL_LOG(DEBUG, "%s(): could not remove '%s': %s",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -352,13 +353,13 @@ get_seg_fd(char *path, int buflen, struct hugepage_info *hi,
 	fd = open(path, O_CREAT | O_RDWR, 0600);
 	if (fd < 0) {
 		EAL_LOG(ERR, "%s(): open '%s' failed: %s",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		return -1;
 	}
 	/* take out a read lock */
 	if (lock(fd, LOCK_SH) < 0) {
 		EAL_LOG(ERR, "%s(): lock '%s' failed: %s",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -380,7 +381,7 @@ resize_hugefile_in_memory(int fd, uint64_t fa_offset,
 	if (ret < 0) {
 		EAL_LOG(DEBUG, "%s(): fallocate() failed: %s",
 				__func__,
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -415,7 +416,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 			if (new_size > cur_size &&
 					ftruncate(fd, new_size) < 0) {
 				EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				return -1;
 			}
 		} else {
@@ -451,7 +452,7 @@ resize_hugefile_in_filesystem(int fd, uint64_t fa_offset, uint64_t page_sz,
 				} else {
 					EAL_LOG(DEBUG, "%s(): fallocate() failed: %s",
 						__func__,
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			} else {
@@ -484,7 +485,7 @@ close_hugefile(int fd, char *path, int list_idx)
 			rte_eal_process_type() == RTE_PROC_PRIMARY &&
 			unlink(path))
 		EAL_LOG(ERR, "%s(): unlinking '%s' failed: %s",
-			__func__, path, strerror(errno));
+			__func__, path, rte_strerror(errno));
 
 	close(fd);
 	fd_list[list_idx].memseg_list_fd = -1;
@@ -585,14 +586,14 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 			map_offset = 0;
 			if (ftruncate(fd, alloc_sz) < 0) {
 				EAL_LOG(DEBUG, "%s(): ftruncate() failed: %s",
-					__func__, strerror(errno));
+					__func__, rte_strerror(errno));
 				goto resized;
 			}
 			if (internal_conf->hugepage_file.unlink_before_mapping &&
 					!internal_conf->in_memory) {
 				if (unlink(path)) {
 					EAL_LOG(DEBUG, "%s(): unlink() failed: %s",
-						__func__, strerror(errno));
+						__func__, rte_strerror(errno));
 					goto resized;
 				}
 			}
@@ -611,7 +612,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 
 	if (va == MAP_FAILED) {
 		EAL_LOG(DEBUG, "%s(): mmap() failed: %s", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		/* mmap failed, but the previous region might have been
 		 * unmapped anyway. try to remap it
 		 */
@@ -662,7 +663,7 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 					MPOL_F_NODE | MPOL_F_ADDR);
 		if (ret < 0) {
 			EAL_LOG(DEBUG, "%s(): get_mempolicy: %s",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mapped;
 		} else if (cur_socket_id != socket_id) {
 			EAL_LOG(DEBUG,
@@ -874,13 +875,13 @@ alloc_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			EAL_LOG(ERR, "%s(): Cannot open '%s': %s",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			EAL_LOG(ERR, "%s(): Cannot lock '%s': %s",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -981,13 +982,13 @@ free_seg_walk(const struct rte_memseg_list *msl, void *arg)
 		dir_fd = open(wa->hi->hugedir, O_RDONLY);
 		if (dir_fd < 0) {
 			EAL_LOG(ERR, "%s(): Cannot open '%s': %s",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			return -1;
 		}
 		/* blocking writelock */
 		if (flock(dir_fd, LOCK_EX)) {
 			EAL_LOG(ERR, "%s(): Cannot lock '%s': %s",
-				__func__, wa->hi->hugedir, strerror(errno));
+				__func__, wa->hi->hugedir, rte_strerror(errno));
 			close(dir_fd);
 			return -1;
 		}
@@ -1345,13 +1346,13 @@ sync_existing(struct rte_memseg_list *primary_msl,
 	dir_fd = open(hi->hugedir, O_RDONLY);
 	if (dir_fd < 0) {
 		EAL_LOG(ERR, "%s(): Cannot open '%s': %s", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		return -1;
 	}
 	/* blocking writelock */
 	if (flock(dir_fd, LOCK_EX)) {
 		EAL_LOG(ERR, "%s(): Cannot lock '%s': %s", __func__,
-			hi->hugedir, strerror(errno));
+			hi->hugedir, rte_strerror(errno));
 		close(dir_fd);
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 45879ca743..30568335f8 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -105,7 +105,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	fd = open("/proc/self/pagemap", O_RDONLY);
 	if (fd < 0) {
 		EAL_LOG(INFO, "%s(): cannot open /proc/self/pagemap: %s",
-			__func__, strerror(errno));
+			__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	}
 
@@ -113,7 +113,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	offset = sizeof(uint64_t) * virt_pfn;
 	if (lseek(fd, offset, SEEK_SET) == (off_t) -1) {
 		EAL_LOG(INFO, "%s(): seek error in /proc/self/pagemap: %s",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		close(fd);
 		return RTE_BAD_IOVA;
 	}
@@ -122,7 +122,7 @@ rte_mem_virt2phy(const void *virtaddr)
 	close(fd);
 	if (retval < 0) {
 		EAL_LOG(INFO, "%s(): cannot read /proc/self/pagemap: %s",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 		return RTE_BAD_IOVA;
 	} else if (retval != PFN_MASK_SIZE) {
 		EAL_LOG(INFO, "%s(): read %d bytes from /proc/self/pagemap "
@@ -237,7 +237,7 @@ static int huge_wrap_sigsetjmp(void)
 /* Callback for numa library. */
 void numa_error(char *where)
 {
-	EAL_LOG(ERR, "%s failed: %s", where, strerror(errno));
+	EAL_LOG(ERR, "%s failed: %s", where, rte_strerror(errno));
 }
 #endif
 
@@ -278,7 +278,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				  oldmask->size + 1, 0, 0) < 0) {
 			EAL_LOG(ERR,
 				"Failed to get current mempolicy: %s. "
-				"Assuming MPOL_DEFAULT.", strerror(errno));
+				"Assuming MPOL_DEFAULT.", rte_strerror(errno));
 			oldpolicy = MPOL_DEFAULT;
 		}
 		for (i = 0; i < RTE_MAX_NUMA_NODES; i++)
@@ -333,7 +333,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		fd = open(hf->filepath, O_CREAT | O_RDWR, 0600);
 		if (fd < 0) {
 			EAL_LOG(DEBUG, "%s(): open failed: %s", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			goto out;
 		}
 
@@ -346,7 +346,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 				MAP_SHARED | MAP_POPULATE, fd, 0);
 		if (virtaddr == MAP_FAILED) {
 			EAL_LOG(DEBUG, "%s(): mmap failed: %s", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -379,7 +379,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			EAL_LOG(DEBUG, "%s(): Locking file failed:%s ",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			close(fd);
 			goto out;
 		}
@@ -397,7 +397,7 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
 		} else if (set_mempolicy(oldpolicy, oldmask->maskp,
 					 oldmask->size + 1) < 0) {
 			EAL_LOG(ERR, "Failed to restore mempolicy: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			numa_set_localalloc();
 		}
 	}
@@ -590,7 +590,7 @@ unlink_hugepage_files(struct hugepage_file *hugepg_tbl,
 
 		if (hp->orig_va != NULL && unlink(hp->filepath)) {
 			EAL_LOG(WARNING, "%s(): Removing %s failed: %s",
-				__func__, hp->filepath, strerror(errno));
+				__func__, hp->filepath, rte_strerror(errno));
 		}
 	}
 	return 0;
@@ -640,7 +640,7 @@ unmap_unneeded_hugepages(struct hugepage_file *hugepg_tbl,
 						hp->orig_va = NULL;
 						if (unlink(hp->filepath) == -1) {
 							EAL_LOG(ERR, "%s(): Removing %s failed: %s",
-									__func__, hp->filepath, strerror(errno));
+									__func__, hp->filepath, rte_strerror(errno));
 							return -1;
 						}
 					} else {
@@ -736,13 +736,13 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 		fd = open(hfile->filepath, O_RDWR);
 		if (fd < 0) {
 			EAL_LOG(ERR, "Could not open '%s': %s",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			return -1;
 		}
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			EAL_LOG(DEBUG, "Could not lock '%s': %s",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -756,7 +756,7 @@ remap_segment(struct hugepage_file *hugepages, int seg_start, int seg_end)
 				MAP_SHARED | MAP_POPULATE | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED) {
 			EAL_LOG(ERR, "Couldn't remap '%s': %s",
-					hfile->filepath, strerror(errno));
+					hfile->filepath, rte_strerror(errno));
 			close(fd);
 			return -1;
 		}
@@ -1178,13 +1178,13 @@ eal_legacy_hugepage_init(void)
 		memfd = memfd_create("nohuge", 0);
 		if (memfd < 0) {
 			EAL_LOG(DEBUG, "Cannot create memfd: %s",
-					strerror(errno));
+					rte_strerror(errno));
 			EAL_LOG(DEBUG, "Falling back to anonymous map");
 		} else {
 			/* we got an fd - now resize it */
 			if (ftruncate(memfd, internal_conf->memory) < 0) {
 				EAL_LOG(ERR, "Cannot resize memfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				EAL_LOG(ERR, "Falling back to anonymous map");
 				close(memfd);
 			} else {
@@ -1212,7 +1212,7 @@ eal_legacy_hugepage_init(void)
 				flags | MAP_FIXED, fd, 0);
 		if (addr == MAP_FAILED || addr != prealloc_addr) {
 			EAL_LOG(ERR, "%s: mmap() failed: %s", __func__,
-					strerror(errno));
+					rte_strerror(errno));
 			munmap(prealloc_addr, mem_sz);
 			return -1;
 		}
@@ -1571,7 +1571,7 @@ eal_legacy_hugepage_attach(void)
 		fd = open(hf->filepath, O_RDWR);
 		if (fd < 0) {
 			EAL_LOG(ERR, "Could not open %s: %s",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto error;
 		}
 
@@ -1579,14 +1579,14 @@ eal_legacy_hugepage_attach(void)
 				MAP_SHARED | MAP_FIXED, fd, 0);
 		if (map_addr == MAP_FAILED) {
 			EAL_LOG(ERR, "Could not map %s: %s",
-				hf->filepath, strerror(errno));
+				hf->filepath, rte_strerror(errno));
 			goto fd_error;
 		}
 
 		/* set shared lock on the file. */
 		if (flock(fd, LOCK_SH) < 0) {
 			EAL_LOG(DEBUG, "%s(): Locking file failed: %s",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto mmap_error;
 		}
 
@@ -1931,7 +1931,7 @@ rte_eal_memseg_init(void)
 
 		if (setrlimit(RLIMIT_NOFILE, &lim) < 0) {
 			EAL_LOG(DEBUG, "Setting maximum number of open files failed: %s",
-					strerror(errno));
+					rte_strerror(errno));
 		} else {
 			EAL_LOG(DEBUG, "Setting maximum number of open files to %"
 					PRIu64,
diff --git a/lib/eal/linux/eal_timer.c b/lib/eal/linux/eal_timer.c
index 489732c116..3aecff7f47 100644
--- a/lib/eal/linux/eal_timer.c
+++ b/lib/eal/linux/eal_timer.c
@@ -146,7 +146,7 @@ rte_eal_hpet_init(int make_default)
 	fd = open(DEV_HPET, O_RDONLY);
 	if (fd < 0) {
 		EAL_LOG(ERR, "ERROR: Cannot open "DEV_HPET": %s!",
-			strerror(errno));
+			rte_strerror(errno));
 		internal_conf->no_hpet = 1;
 		return -1;
 	}
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index 7132e24cba..f04fbca2df 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -368,7 +368,7 @@ vfio_open_group_fd(int iommu_group_num)
 			/* if file not found, it's not an error */
 			if (errno != ENOENT) {
 				EAL_LOG(ERR, "Cannot open %s: %s",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 				return -1;
 			}
 
@@ -381,7 +381,7 @@ vfio_open_group_fd(int iommu_group_num)
 				if (errno != ENOENT) {
 					EAL_LOG(ERR,
 						"Cannot open %s: %s",
-						filename, strerror(errno));
+						filename, rte_strerror(errno));
 					return -1;
 				}
 				return -ENOENT;
@@ -791,7 +791,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status);
 	if (ret) {
 		EAL_LOG(ERR, "%s cannot get VFIO group status, "
-			"error %i (%s)", dev_addr, errno, strerror(errno));
+			"error %i (%s)", dev_addr, errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -819,7 +819,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			EAL_LOG(ERR,
 				"%s cannot add VFIO group to container, error "
-				"%i (%s)", dev_addr, errno, strerror(errno));
+				"%i (%s)", dev_addr, errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			rte_vfio_clear_group(vfio_group_fd);
 			return -1;
@@ -860,7 +860,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 				EAL_LOG(ERR,
 					"%s DMA remapping failed, error "
 					"%i (%s)",
-					dev_addr, errno, strerror(errno));
+					dev_addr, errno, rte_strerror(errno));
 				close(vfio_group_fd);
 				rte_vfio_clear_group(vfio_group_fd);
 				rte_mcfg_mem_read_unlock();
@@ -978,7 +978,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		EAL_LOG(ERR, "%s cannot get device info, "
 				"error %i (%s)", dev_addr, errno,
-				strerror(errno));
+				rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
@@ -1219,7 +1219,7 @@ vfio_set_iommu_type(int vfio_container_fd)
 		/* not an error, there may be more supported IOMMU types */
 		EAL_LOG(DEBUG, "Set IOMMU type %d (%s) failed, error "
 				"%i (%s)", t->type_id, t->name, errno,
-				strerror(errno));
+				rte_strerror(errno));
 	}
 	/* if we didn't find a suitable IOMMU type, fail */
 	return NULL;
@@ -1243,7 +1243,7 @@ rte_vfio_get_device_info(const char *sysfs_base, const char *dev_addr,
 		ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info);
 		if (ret) {
 			EAL_LOG(ERR, "%s cannot get device info, error %i (%s)",
-					dev_addr, errno, strerror(errno));
+					dev_addr, errno, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -1263,7 +1263,7 @@ vfio_has_supported_extensions(int vfio_container_fd)
 				t->type_id);
 		if (ret < 0) {
 			EAL_LOG(ERR, "Could not get IOMMU type, error "
-					"%i (%s)", errno, strerror(errno));
+					"%i (%s)", errno, rte_strerror(errno));
 			close(vfio_container_fd);
 			return -1;
 		} else if (ret == 1) {
@@ -1303,7 +1303,7 @@ rte_vfio_get_container_fd(void)
 			EAL_LOG(ERR,
 					"Cannot open VFIO container %s, error "
 					"%i (%s)", VFIO_CONTAINER_PATH,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1313,7 +1313,7 @@ rte_vfio_get_container_fd(void)
 			if (ret < 0)
 				EAL_LOG(ERR,
 					"Could not get VFIO API version, error "
-					"%i (%s)", errno, strerror(errno));
+					"%i (%s)", errno, rte_strerror(errno));
 			else
 				EAL_LOG(ERR, "Unsupported VFIO API version!");
 			close(vfio_container_fd);
@@ -1445,7 +1445,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 			} else {
 				EAL_LOG(ERR,
 					"Cannot set up DMA remapping, error "
-					"%i (%s)", errno, strerror(errno));
+					"%i (%s)", errno, rte_strerror(errno));
 				return -1;
 			}
 		}
@@ -1459,7 +1459,7 @@ vfio_type1_dma_mem_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			EAL_LOG(ERR, "Cannot clear DMA remapping, error "
-					"%i (%s)", errno, strerror(errno));
+					"%i (%s)", errno, rte_strerror(errno));
 			return -1;
 		} else if (dma_unmap.size != len) {
 			EAL_LOG(ERR, "Unexpected size %"PRIu64
@@ -1508,7 +1508,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			EAL_LOG(ERR,
 				"Cannot register vaddr for IOMMU, error "
-				"%i (%s)", errno, strerror(errno));
+				"%i (%s)", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1523,7 +1523,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
 		if (ret) {
 			EAL_LOG(ERR, "Cannot map vaddr for IOMMU, error "
-					"%i (%s)", errno, strerror(errno));
+					"%i (%s)", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1539,7 +1539,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 				&dma_unmap);
 		if (ret) {
 			EAL_LOG(ERR, "Cannot unmap vaddr for IOMMU, error "
-					"%i (%s)", errno, strerror(errno));
+					"%i (%s)", errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -1548,7 +1548,7 @@ vfio_spapr_dma_do_map(int vfio_container_fd, uint64_t vaddr, uint64_t iova,
 		if (ret) {
 			EAL_LOG(ERR,
 				"Cannot unregister vaddr for IOMMU, error "
-				"%i (%s)", errno, strerror(errno));
+				"%i (%s)", errno, rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -1733,7 +1733,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 	ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_GET_INFO, &info);
 	if (ret) {
 		EAL_LOG(ERR, "Cannot get IOMMU info, error %i (%s)",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1774,7 +1774,7 @@ vfio_spapr_create_dma_window(int vfio_container_fd)
 #endif /* VFIO_IOMMU_SPAPR_INFO_DDW */
 	if (ret) {
 		EAL_LOG(ERR, "Cannot create new DMA window, error "
-				"%i (%s)", errno, strerror(errno));
+				"%i (%s)", errno, rte_strerror(errno));
 		EAL_LOG(ERR,
 			"Consider using a larger hugepage size if supported by the system");
 		return -1;
@@ -2035,7 +2035,7 @@ rte_vfio_noiommu_is_enabled(void)
 	if (fd < 0) {
 		if (errno != ENOENT) {
 			EAL_LOG(ERR, "Cannot open VFIO noiommu file "
-					"%i (%s)", errno, strerror(errno));
+					"%i (%s)", errno, rte_strerror(errno));
 			return -1;
 		}
 		/*
@@ -2049,7 +2049,7 @@ rte_vfio_noiommu_is_enabled(void)
 	close(fd);
 	if (cnt != 1) {
 		EAL_LOG(ERR, "Unable to read from VFIO noiommu file "
-				"%i (%s)", errno, strerror(errno));
+				"%i (%s)", errno, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_filesystem.c b/lib/eal/unix/eal_filesystem.c
index 6cd5f1492c..0d08b996f8 100644
--- a/lib/eal/unix/eal_filesystem.c
+++ b/lib/eal/unix/eal_filesystem.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "eal_private.h"
 #include "eal_filesystem.h"
@@ -59,14 +60,14 @@ int eal_create_runtime_dir(void)
 	ret = mkdir(tmp, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		EAL_LOG(ERR, "Error creating '%s': %s",
-			tmp, strerror(errno));
+			tmp, rte_strerror(errno));
 		return -1;
 	}
 
 	ret = mkdir(run_dir, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		EAL_LOG(ERR, "Error creating '%s': %s",
-			run_dir, strerror(errno));
+			run_dir, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/eal/unix/eal_unix_memory.c b/lib/eal/unix/eal_unix_memory.c
index 97969a401b..a1cdbd1537 100644
--- a/lib/eal/unix/eal_unix_memory.c
+++ b/lib/eal/unix/eal_unix_memory.c
@@ -32,7 +32,7 @@ mem_map(void *requested_addr, size_t size, int prot, int flags,
 		EAL_LOG(DEBUG,
 		    "Cannot mmap(%p, 0x%zx, 0x%x, 0x%x, %d, 0x%"PRIx64"): %s",
 		    requested_addr, size, prot, flags, fd, offset,
-		    strerror(errno));
+		    rte_strerror(errno));
 		rte_errno = errno;
 		return NULL;
 	}
@@ -45,7 +45,7 @@ mem_unmap(void *virt, size_t size)
 	int ret = munmap(virt, size);
 	if (ret < 0) {
 		EAL_LOG(DEBUG, "Cannot munmap(%p, 0x%zx): %s",
-			virt, size, strerror(errno));
+			virt, size, rte_strerror(errno));
 		rte_errno = errno;
 	}
 	return ret;
@@ -84,7 +84,7 @@ eal_mem_set_dump(void *virt, size_t size, bool dump)
 	int ret = madvise(virt, size, flags);
 	if (ret) {
 		EAL_LOG(DEBUG, "madvise(%p, %#zx, %d) failed: %s",
-				virt, size, flags, strerror(rte_errno));
+				virt, size, flags, rte_strerror(rte_errno));
 		rte_errno = errno;
 	}
 	return ret;
diff --git a/lib/eal/unix/rte_thread.c b/lib/eal/unix/rte_thread.c
index 1b4c73f58e..f0dae50549 100644
--- a/lib/eal/unix/rte_thread.c
+++ b/lib/eal/unix/rte_thread.c
@@ -304,7 +304,7 @@ rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *))
 	err = pthread_key_create(&((*key)->thread_index), destructor);
 	if (err) {
 		EAL_LOG(DEBUG, "pthread_key_create failed: %s",
-			strerror(err));
+			rte_strerror(err));
 		free(*key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -325,7 +325,7 @@ rte_thread_key_delete(rte_thread_key key)
 	err = pthread_key_delete(key->thread_index);
 	if (err) {
 		EAL_LOG(DEBUG, "pthread_key_delete failed: %s",
-			strerror(err));
+			rte_strerror(err));
 		free(key);
 		rte_errno = ENOEXEC;
 		return -1;
@@ -347,7 +347,7 @@ rte_thread_value_set(rte_thread_key key, const void *value)
 	err = pthread_setspecific(key->thread_index, value);
 	if (err) {
 		EAL_LOG(DEBUG, "pthread_setspecific failed: %s",
-			strerror(err));
+			rte_strerror(err));
 		rte_errno = ENOEXEC;
 		return -1;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 03/42] eventdev: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 02/42] eal: use rte strerror Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 04/42] latency: " Dengdui Huang
                       ` (40 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/eventdev/rte_event_eth_rx_adapter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c
index 3ee20d95f3..1aef2458b6 100644
--- a/lib/eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/eventdev/rte_event_eth_rx_adapter.c
@@ -1106,7 +1106,7 @@ rxa_intr_ring_enqueue(struct event_eth_rx_adapter *rx_adapter, void *data)
 		 */
 		if (err)
 			RTE_EDEV_LOG_ERR("Failed to enqueue interrupt"
-				" to ring: %s", strerror(-err));
+				" to ring: %s", rte_strerror(-err));
 		else
 			rte_eth_dev_rx_intr_disable(port_id, queue);
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 04/42] latency: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (2 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 03/42] eventdev: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 05/42] node: " Dengdui Huang
                       ` (39 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/latencystats/rte_latencystats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c
index 6a261309f9..1ae95a52ae 100644
--- a/lib/latencystats/rte_latencystats.c
+++ b/lib/latencystats/rte_latencystats.c
@@ -268,7 +268,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
 		if (ret != 0) {
 			LATENCY_STATS_LOG(INFO,
 				"Error during getting device (port %u) info: %s",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
@@ -312,7 +312,7 @@ rte_latencystats_uninit(void)
 		if (ret != 0) {
 			LATENCY_STATS_LOG(INFO,
 				"Error during getting device (port %u) info: %s",
-				pid, strerror(-ret));
+				pid, rte_strerror(-ret));
 
 			continue;
 		}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 05/42] node: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (3 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 04/42] latency: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 06/42] pdump: " Dengdui Huang
                       ` (38 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/node/kernel_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/node/kernel_tx.c b/lib/node/kernel_tx.c
index 3a96741622..c99a3ebbe2 100644
--- a/lib/node/kernel_tx.c
+++ b/lib/node/kernel_tx.c
@@ -36,7 +36,7 @@ kernel_tx_process_mbuf(struct rte_node *node, struct rte_mbuf **mbufs, uint16_t
 		sin.sin_addr.s_addr = ip4->dst_addr;
 
 		if (sendto(ctx->sock, buf, len, 0, (struct sockaddr *)&sin, sizeof(sin)) < 0)
-			node_err("kernel_tx", "Unable to send packets: %s", strerror(errno));
+			node_err("kernel_tx", "Unable to send packets: %s", rte_strerror(errno));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 06/42] pdump: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (4 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 05/42] node: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 07/42] power: " Dengdui Huang
                       ` (37 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/pdump/rte_pdump.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c
index 679c3dd0b5..ebf6498b82 100644
--- a/lib/pdump/rte_pdump.c
+++ b/lib/pdump/rte_pdump.c
@@ -337,7 +337,7 @@ set_pdump_rxtx_cbs(const struct pdump_request *p)
 		if (ret != 0) {
 			PDUMP_LOG_LINE(ERR,
 				"Error during getting device (port %u) info: %s",
-				port, strerror(-ret));
+				port, rte_strerror(-ret));
 			return ret;
 		}
 
@@ -407,7 +407,7 @@ pdump_server(const struct rte_mp_msg *mp_msg, const void *peer)
 	mp_resp.num_fds = 0;
 	if (rte_mp_reply(&mp_resp, peer) < 0) {
 		PDUMP_LOG_LINE(ERR, "failed to send to client:%s",
-			  strerror(rte_errno));
+			  rte_strerror(rte_errno));
 		return -1;
 	}
 
@@ -739,7 +739,7 @@ rte_pdump_stats(uint16_t port, struct rte_pdump_stats *stats)
 	if (ret != 0) {
 		PDUMP_LOG_LINE(ERR,
 			  "Error during getting device (port %u) info: %s",
-			  port, strerror(-ret));
+			  port, rte_strerror(-ret));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 07/42] power: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (5 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 06/42] pdump: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 08/42] vhost: " Dengdui Huang
                       ` (36 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/power/guest_channel.c        | 7 ++++---
 lib/power/power_kvm_vm.c         | 3 ++-
 lib/power/power_pstate_cpufreq.c | 7 ++++---
 lib/power/rte_power_pmd_mgmt.c   | 2 +-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index bc3f55b6bf..a197113b90 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -14,6 +14,7 @@
 
 #include <rte_log.h>
 #include <rte_power.h>
+#include <rte_errno.h>
 
 #include "guest_channel.h"
 
@@ -78,7 +79,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	fd = open(fd_path, O_RDWR);
 	if (fd < 0) {
 		GUEST_CHANNEL_LOG(ERR, "Unable to connect to '%s' with error "
-				"%s", fd_path, strerror(errno));
+				"%s", fd_path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -107,7 +108,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	if (ret != 0) {
 		GUEST_CHANNEL_LOG(ERR,
 				"Error on channel '%s' communications test: %s",
-				fd_path, ret > 0 ? strerror(ret) :
+				fd_path, ret > 0 ? rte_strerror(ret) :
 				"channel not connected");
 		goto error;
 	}
@@ -187,7 +188,7 @@ int power_guest_channel_read_msg(void *pkt,
 		return -1;
 	} else if (ret < 0) {
 		GUEST_CHANNEL_LOG(ERR, "Error occurred during poll function: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index f15be8fac5..5e5532832e 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -5,6 +5,7 @@
 #include <string.h>
 
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
@@ -83,7 +84,7 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 	if (ret == 0)
 		return 1;
 	POWER_LOG(DEBUG, "Error sending message: %s",
-			ret > 0 ? strerror(ret) : "channel not connected");
+			ret > 0 ? rte_strerror(ret) : "channel not connected");
 	return -1;
 }
 
diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 4755909466..acc922ea2f 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -13,6 +13,7 @@
 
 #include <rte_memcpy.h>
 #include <rte_stdatomic.h>
+#include <rte_errno.h>
 
 #include "rte_power_pmd_mgmt.h"
 #include "power_pstate_cpufreq.h"
@@ -83,7 +84,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (fd < 0) {
 		POWER_LOG(ERR, "Error opening '%s': %s", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		return fd;
 	}
 
@@ -91,7 +92,7 @@ power_read_turbo_pct(uint64_t *outVal)
 
 	if (ret < 0) {
 		POWER_LOG(ERR, "Error reading '%s': %s", POWER_SYSFILE_TURBO_PCT,
-				 strerror(errno));
+				 rte_strerror(errno));
 		goto out;
 	}
 
@@ -99,7 +100,7 @@ power_read_turbo_pct(uint64_t *outVal)
 	*outVal = (uint64_t) strtol(val, &endptr, 10);
 	if (errno != 0 || (*endptr != 0 && *endptr != '\n')) {
 		POWER_LOG(ERR, "Error converting str to digits, read from %s: %s",
-				 POWER_SYSFILE_TURBO_PCT, strerror(errno));
+				 POWER_SYSFILE_TURBO_PCT, rte_strerror(errno));
 		ret = -1;
 		goto out;
 	}
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index 5e50613f5b..f52c2c08d5 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -575,7 +575,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
 	ret = queue_list_add(lcore_cfg, &qdata);
 	if (ret < 0) {
 		POWER_LOG(DEBUG, "Failed to add queue to list: %s",
-				strerror(-ret));
+				rte_strerror(-ret));
 		goto end;
 	}
 	/* new queue is always added last */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 08/42] vhost: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (6 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 07/42] power: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 09/42] bpf: " Dengdui Huang
                       ` (35 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/vhost/fd_man.c     |  7 ++++---
 lib/vhost/socket.c     | 13 ++++++------
 lib/vhost/vduse.c      | 45 +++++++++++++++++++++---------------------
 lib/vhost/vhost_user.c | 10 +++++-----
 4 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/lib/vhost/fd_man.c b/lib/vhost/fd_man.c
index 9bc7e50b93..e9367fabee 100644
--- a/lib/vhost/fd_man.c
+++ b/lib/vhost/fd_man.c
@@ -13,6 +13,7 @@
 #include <rte_malloc.h>
 #include <rte_string_fns.h>
 #include <rte_thread.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 
@@ -238,7 +239,7 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat)
 	ret = epoll_ctl(pfdset->epfd, EPOLL_CTL_ADD, fd, &ev);
 	if (ret < 0) {
 		VHOST_FDMAN_LOG(ERR, "could not add %d fd to %d epfd: %s",
-			fd, pfdset->epfd, strerror(errno));
+			fd, pfdset->epfd, rte_strerror(errno));
 		goto out_remove;
 	}
 
@@ -259,10 +260,10 @@ fdset_del_locked(struct fdset *pfdset, struct fdentry *pfdentry)
 	if (epoll_ctl(pfdset->epfd, EPOLL_CTL_DEL, pfdentry->fd, NULL) == -1) {
 		if (errno == EBADF) /* File might have already been closed. */
 			VHOST_FDMAN_LOG(DEBUG, "could not remove %d fd from %d epfd: %s",
-				pfdentry->fd, pfdset->epfd, strerror(errno));
+				pfdentry->fd, pfdset->epfd, rte_strerror(errno));
 		else
 			VHOST_FDMAN_LOG(ERR, "could not remove %d fd from %d epfd: %s",
-				pfdentry->fd, pfdset->epfd, strerror(errno));
+				pfdentry->fd, pfdset->epfd, rte_strerror(errno));
 	}
 
 	fdset_remove_entry(pfdset, pfdentry);
diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index d29d15494c..07ae2167ea 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -16,6 +16,7 @@
 
 #include <rte_thread.h>
 #include <rte_log.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 #include "vduse.h"
@@ -124,7 +125,7 @@ read_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int m
 	if (ret <= 0) {
 		if (ret)
 			VHOST_CONFIG_LOG(ifname, ERR, "recvmsg failed on fd %d (%s)",
-				sockfd, strerror(errno));
+				sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -195,7 +196,7 @@ send_fd_message(char *ifname, int sockfd, char *buf, int buflen, int *fds, int f
 
 	if (ret < 0) {
 		VHOST_CONFIG_LOG(ifname, ERR, "sendmsg error on fd %d (%s)",
-			sockfd, strerror(errno));
+			sockfd, rte_strerror(errno));
 		return ret;
 	}
 
@@ -352,7 +353,7 @@ create_unix_socket(struct vhost_user_socket *vsocket)
 	if (!vsocket->is_server && fcntl(fd, F_SETFL, O_NONBLOCK)) {
 		VHOST_CONFIG_LOG(vsocket->path, ERR,
 			"vhost-user: can't set nonblocking mode for socket, fd: %d (%s)",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -386,7 +387,7 @@ vhost_user_start_server(struct vhost_user_socket *vsocket)
 	ret = bind(fd, (struct sockaddr *)&vsocket->un, sizeof(vsocket->un));
 	if (ret < 0) {
 		VHOST_CONFIG_LOG(path, ERR, "failed to bind: %s; remove it and try again",
-			strerror(errno));
+			rte_strerror(errno));
 		goto err;
 	}
 	VHOST_CONFIG_LOG(path, INFO, "binding succeeded");
@@ -439,7 +440,7 @@ vhost_user_connect_nonblock(char *path, int fd, struct sockaddr *un, size_t sz)
 	flags = fcntl(fd, F_GETFL, 0);
 	if (flags < 0) {
 		VHOST_CONFIG_LOG(path, ERR, "can't get flags for connfd %d (%s)",
-			fd, strerror(errno));
+			fd, rte_strerror(errno));
 		return -2;
 	}
 	if ((flags & O_NONBLOCK) && fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)) {
@@ -534,7 +535,7 @@ vhost_user_start_client(struct vhost_user_socket *vsocket)
 			return 0;
 		}
 
-		VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", strerror(errno));
+		VHOST_CONFIG_LOG(path, WARNING, "failed to connect: %s", rte_strerror(errno));
 
 		if (ret == -2 || !vsocket->reconnect) {
 			close(fd);
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index f9ac317438..9b241cc311 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -17,6 +17,7 @@
 
 #include <rte_common.h>
 #include <rte_thread.h>
+#include <rte_errno.h>
 
 #include "fd_man.h"
 #include "iotlb.h"
@@ -126,7 +127,7 @@ vduse_control_queue_event(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &buf, sizeof(buf));
 	if (ret < 0) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to read control queue event: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -148,7 +149,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_GET_INFO, &vq_info);
 	if (ret) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to get VQ %u info: %s",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		return;
 	}
 
@@ -179,7 +180,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect)
 	vq->kickfd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (vq->kickfd < 0) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to init kickfd for VQ %u: %s",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		vq->kickfd = VIRTIO_INVALID_EVENTFD;
 		return;
 	}
@@ -211,7 +212,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to setup kickfd for VQ %u: %s",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 		close(vq->kickfd);
 		vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
 		return;
@@ -222,7 +223,7 @@ vduse_vring_setup(struct virtio_net *dev, unsigned int index, bool reconnect)
 		if (ret) {
 			VHOST_CONFIG_LOG(dev->ifname, ERR,
 					"Failed to setup kickfd handler for VQ %u: %s",
-					index, strerror(errno));
+					index, rte_strerror(errno));
 			vq_efd.fd = VDUSE_EVENTFD_DEASSIGN;
 			ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 			close(vq->kickfd);
@@ -249,7 +250,7 @@ vduse_vring_cleanup(struct virtio_net *dev, unsigned int index)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_VQ_SETUP_KICKFD, &vq_efd);
 	if (ret)
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to cleanup kickfd for VQ %u: %s",
-				index, strerror(errno));
+				index, rte_strerror(errno));
 
 	close(vq->kickfd);
 	vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD;
@@ -288,7 +289,7 @@ vduse_device_start(struct virtio_net *dev, bool reconnect)
 	ret = ioctl(dev->vduse_dev_fd, VDUSE_DEV_GET_FEATURES, &dev->features);
 	if (ret) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to get features: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -364,7 +365,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = read(fd, &req, sizeof(req));
 	if (ret < 0) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to read request: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	} else if (ret < (int)sizeof(req)) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Incomplete to read request %d", ret);
@@ -407,7 +408,7 @@ vduse_events_handler(int fd, void *arg, int *remove __rte_unused)
 	ret = write(dev->vduse_dev_fd, &resp, sizeof(resp));
 	if (ret != sizeof(resp)) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR, "Failed to write response %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return;
 	}
 
@@ -455,7 +456,7 @@ vduse_reconnect_path_init(void)
 	ret = mkdir(vduse_reconnect_dir, 0700);
 	if (ret < 0 && errno != EEXIST) {
 		VHOST_CONFIG_LOG("vduse", ERR, "Error creating '%s': %s",
-				vduse_reconnect_dir, strerror(errno));
+				vduse_reconnect_dir, rte_strerror(errno));
 		return -1;
 	}
 
@@ -516,13 +517,13 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	control_fd = open(VDUSE_CTRL_PATH, O_RDWR);
 	if (control_fd < 0) {
 		VHOST_CONFIG_LOG(name, ERR, "Failed to open %s: %s",
-				VDUSE_CTRL_PATH, strerror(errno));
+				VDUSE_CTRL_PATH, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(control_fd, VDUSE_SET_API_VERSION, &ver)) {
 		VHOST_CONFIG_LOG(name, ERR, "Failed to set API version: %" PRIu64 ": %s",
-				ver, strerror(errno));
+				ver, rte_strerror(errno));
 		ret = -1;
 		goto out_ctrl_close;
 	}
@@ -558,7 +559,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 						reconnect_file);
 			else
 				VHOST_CONFIG_LOG(name, ERR, "Failed to open reconnect file %s (%s)",
-						reconnect_file, strerror(errno));
+						reconnect_file, rte_strerror(errno));
 			ret = -1;
 			goto out_ctrl_close;
 		}
@@ -568,7 +569,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 		close(reco_fd);
 		if (reconnect_log == MAP_FAILED) {
 			VHOST_CONFIG_LOG(name, ERR, "Failed to mmap reconnect file %s (%s)",
-					reconnect_file, strerror(errno));
+					reconnect_file, rte_strerror(errno));
 			ret = -1;
 			goto out_ctrl_close;
 		}
@@ -602,7 +603,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 						reconnect_file);
 			} else {
 				VHOST_CONFIG_LOG(name, ERR, "Failed to open reconnect file %s (%s)",
-						reconnect_file, strerror(errno));
+						reconnect_file, rte_strerror(errno));
 			}
 			ret = -1;
 			goto out_ctrl_close;
@@ -611,7 +612,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 		ret = ftruncate(reco_fd, sizeof(*reconnect_log));
 		if (ret < 0) {
 			VHOST_CONFIG_LOG(name, ERR, "Failed to truncate reconnect file %s (%s)",
-					reconnect_file, strerror(errno));
+					reconnect_file, rte_strerror(errno));
 			close(reco_fd);
 			goto out_ctrl_close;
 		}
@@ -621,7 +622,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 		close(reco_fd);
 		if (reconnect_log == MAP_FAILED) {
 			VHOST_CONFIG_LOG(name, ERR, "Failed to mmap reconnect file %s (%s)",
-					reconnect_file, strerror(errno));
+					reconnect_file, rte_strerror(errno));
 			ret = -1;
 			goto out_ctrl_close;
 		}
@@ -651,7 +652,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 		ret = ioctl(control_fd, VDUSE_CREATE_DEV, dev_config);
 		if (ret < 0) {
 			VHOST_CONFIG_LOG(name, ERR, "Failed to create VDUSE device: %s",
-					strerror(errno));
+					rte_strerror(errno));
 			goto out_free;
 		}
 
@@ -664,7 +665,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	dev_fd = open(path, O_RDWR);
 	if (dev_fd < 0) {
 		VHOST_CONFIG_LOG(name, ERR, "Failed to open device %s: %s",
-				path, strerror(errno));
+				path, rte_strerror(errno));
 		ret = -1;
 		goto out_dev_close;
 	}
@@ -672,7 +673,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 	ret = fcntl(dev_fd, F_SETFL, O_NONBLOCK);
 	if (ret < 0) {
 		VHOST_CONFIG_LOG(name, ERR, "Failed to set chardev as non-blocking: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		goto out_dev_close;
 	}
 
@@ -741,7 +742,7 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 		reco_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (reco_fd < 0) {
 			VHOST_CONFIG_LOG(name, ERR, "Failed to create reco_fd: %s",
-					strerror(errno));
+					rte_strerror(errno));
 			ret = -1;
 			goto out_dev_destroy;
 		}
@@ -814,7 +815,7 @@ vduse_device_destroy(const char *path)
 		ret = ioctl(dev->vduse_ctrl_fd, VDUSE_DESTROY_DEV, name);
 		if (ret) {
 			VHOST_CONFIG_LOG(name, ERR, "Failed to destroy VDUSE device: %s",
-					strerror(errno));
+					rte_strerror(errno));
 		} else {
 			/*
 			 * VDUSE device was no more attached to the vDPA bus,
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 6d92ad904e..32b5f46749 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -832,7 +832,7 @@ mem_set_dump(struct virtio_net *dev, void *ptr, size_t size, bool enable, uint64
 
 	if (madvise(start, len, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) {
 		VHOST_CONFIG_LOG(dev->ifname, INFO,
-			"could not set coredump preference (%s).", strerror(errno));
+			"could not set coredump preference (%s).", rte_strerror(errno));
 	}
 #endif
 }
@@ -1210,7 +1210,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev,
 			(uint64_t)reg_struct.range.start +
 			(uint64_t)reg_struct.range.len - 1,
 			dev->postcopy_ufd,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -1339,7 +1339,7 @@ vhost_user_mmap_region(struct virtio_net *dev,
 			MAP_SHARED | populate, region->fd, 0);
 
 	if (mmap_addr == MAP_FAILED) {
-		VHOST_CONFIG_LOG(dev->ifname, ERR, "mmap failed (%s).", strerror(errno));
+		VHOST_CONFIG_LOG(dev->ifname, ERR, "mmap failed (%s).", rte_strerror(errno));
 		return -1;
 	}
 
@@ -2776,7 +2776,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (dev->postcopy_ufd == -1) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR,
 			"userfaultfd not available: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		return RTE_VHOST_MSG_RESULT_ERR;
 	}
 	api_struct.api = UFFD_API;
@@ -2784,7 +2784,7 @@ vhost_user_set_postcopy_advise(struct virtio_net **pdev,
 	if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) {
 		VHOST_CONFIG_LOG(dev->ifname, ERR,
 			"UFFDIO_API ioctl failure: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		close(dev->postcopy_ufd);
 		dev->postcopy_ufd = -1;
 		return RTE_VHOST_MSG_RESULT_ERR;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 09/42] bpf: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (7 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 08/42] vhost: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 10/42] bus/cdx: " Dengdui Huang
                       ` (34 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/bpf/bpf_load_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bpf/bpf_load_elf.c b/lib/bpf/bpf_load_elf.c
index e0abd3c856..fb3c18cb5f 100644
--- a/lib/bpf/bpf_load_elf.c
+++ b/lib/bpf/bpf_load_elf.c
@@ -310,7 +310,7 @@ rte_bpf_elf_load(const struct rte_bpf_prm *prm, const char *fname,
 	if (fd < 0) {
 		rc = errno;
 		RTE_BPF_LOG_LINE(ERR, "%s(%s) error code: %d(%s)",
-			__func__, fname, rc, strerror(rc));
+			__func__, fname, rc, rte_strerror(rc));
 		rte_errno = EINVAL;
 		return NULL;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 10/42] bus/cdx: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (8 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 09/42] bpf: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 11/42] bus/dpaa: " Dengdui Huang
                       ` (33 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/bus/cdx/cdx.c      |  2 +-
 drivers/bus/cdx/cdx_vfio.c | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c
index 62b108e082..747f53b17f 100644
--- a/drivers/bus/cdx/cdx.c
+++ b/drivers/bus/cdx/cdx.c
@@ -271,7 +271,7 @@ cdx_scan(void)
 	dir = opendir(RTE_CDX_BUS_DEVICES_PATH);
 	if (dir == NULL) {
 		CDX_BUS_INFO("%s(): opendir failed: %s", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return 0;
 	}
 
diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 664f267471..87e69e0082 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -20,6 +20,7 @@
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "bus_cdx_driver.h"
 #include "cdx_logs.h"
@@ -204,7 +205,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			CDX_BUS_ERR("Cannot get VFIO IRQ info, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -222,7 +223,7 @@ cdx_vfio_setup_interrupts(struct rte_cdx_device *dev, int vfio_dev_fd,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			CDX_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -255,7 +256,7 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int vfio_dev_fd,
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
 		CDX_BUS_ERR("Unable to reset device! Error: %d (%s)", errno,
-			strerror(errno));
+			rte_strerror(errno));
 		return -1;
 	}
 
@@ -423,7 +424,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s cannot get device region info error %i (%s)",
-				dev_name, errno, strerror(errno));
+				dev_name, errno, rte_strerror(errno));
 			goto err_vfio_res;
 		}
 
@@ -451,7 +452,7 @@ cdx_vfio_map_resource_primary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, 0);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping region %i failed: %s",
-				cdx_addr, i, strerror(errno));
+				cdx_addr, i, rte_strerror(errno));
 			free(reg);
 			goto err_vfio_res;
 		}
@@ -519,7 +520,7 @@ cdx_vfio_map_resource_secondary(struct rte_cdx_device *dev)
 		ret = cdx_vfio_mmap_resource(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 		if (ret < 0) {
 			CDX_BUS_ERR("%s mapping MMIO region %i failed: %s",
-				dev_name, i, strerror(errno));
+				dev_name, i, rte_strerror(errno));
 			goto err_vfio_dev_fd;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 11/42] bus/dpaa: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (9 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 10/42] bus/cdx: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 12/42] bus/fslmc: " Dengdui Huang
                       ` (32 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/bus/dpaa/base/fman/fman.c | 2 +-
 drivers/bus/dpaa/dpaa_bus.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index d49339d81e..eb0a4dc398 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -1154,7 +1154,7 @@ fman_finish(void)
 		/* release the mapping */
 		_errno = munmap(__if->ccsr_map, __if->regs_size);
 		if (unlikely(_errno < 0))
-			FMAN_ERR(_errno, "munmap() = (%s)", strerror(errno));
+			FMAN_ERR(_errno, "munmap() = (%s)", rte_strerror(errno));
 		DPAA_BUS_INFO("Tearing down %s", __if->node_path);
 		list_del(&__if->__if.node);
 		rte_free(__if);
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 9ffbe07c93..a97e2e375f 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -632,7 +632,7 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		DPAA_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return errno;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 12/42] bus/fslmc: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (10 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 11/42] bus/dpaa: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 13/42] bus/pci: " Dengdui Huang
                       ` (31 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 6981679a2d..46f598593c 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -481,7 +481,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get group status, "
 				"error %i (%s)", dev_addr,
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 		close(vfio_group_fd);
 		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
@@ -504,7 +504,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		if (ret) {
 			DPAA2_BUS_ERR("  %s cannot add VFIO group to container, "
 					"error %i (%s)", dev_addr,
-					errno, strerror(errno));
+					errno, rte_strerror(errno));
 			close(vfio_group_fd);
 			close(vfio_container_fd);
 			rte_vfio_clear_group(vfio_group_fd);
@@ -551,7 +551,7 @@ fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 	ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info);
 	if (ret) {
 		DPAA2_BUS_ERR("  %s cannot get device info, error %i (%s)",
-				dev_addr, errno, strerror(errno));
+				dev_addr, errno, rte_strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
 		close(vfio_container_fd);
@@ -617,7 +617,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index)
 	if (ret) {
 		DPAA2_BUS_ERR("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)",
 			      rte_intr_fd_get(intr_handle), errno,
-			      strerror(errno));
+			      rte_strerror(errno));
 		return ret;
 	}
 
@@ -667,7 +667,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq_info);
 		if (ret < 0) {
 			DPAA2_BUS_ERR("Cannot get IRQ(%d) info, error %i (%s)",
-				      i, errno, strerror(errno));
+				      i, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -682,7 +682,7 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			DPAA2_BUS_ERR("Cannot set up eventfd, error %i (%s)",
-				      errno, strerror(errno));
+				      errno, rte_strerror(errno));
 			return -1;
 		}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 13/42] bus/pci: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (11 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 12/42] bus/fslmc: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 14/42] bus/vdev: " Dengdui Huang
                       ` (30 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/bus/pci/bsd/pci.c        |  8 ++++----
 drivers/bus/pci/linux/pci.c      |  7 ++++---
 drivers/bus/pci/linux/pci_uio.c  | 23 ++++++++++++-----------
 drivers/bus/pci/linux/pci_vfio.c | 23 ++++++++++++-----------
 drivers/bus/pci/pci_common_uio.c |  3 ++-
 5 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 2f88252418..cf10a3b66a 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -122,7 +122,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	}
 
 	if (rte_intr_fd_get(dev->intr_handle) < 0) {
-		PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -164,7 +164,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	/* allocate memory to keep path */
 	maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0);
 	if (maps[map_idx].path == NULL) {
-		PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno));
+		PCI_LOG(ERR, "Cannot allocate memory for path: %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -173,7 +173,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	 */
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
-		PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -347,7 +347,7 @@ rte_pci_scan(void)
 		unsigned i;
 		if (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {
 			PCI_LOG(ERR, "%s(): error with ioctl on /dev/pci: %s",
-				__func__, strerror(errno));
+				__func__, rte_strerror(errno));
 			goto error;
 		}
 
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 9056035b33..1350412610 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -12,6 +12,7 @@
 #include <rte_devargs.h>
 #include <rte_memcpy.h>
 #include <rte_vfio.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -449,7 +450,7 @@ rte_pci_scan(void)
 
 	dir = opendir(rte_pci_get_sysfs_path());
 	if (dir == NULL) {
-		PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, strerror(errno));
+		PCI_LOG(ERR, "%s(): opendir failed: %s", __func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -500,7 +501,7 @@ pci_device_iommu_support_va(const struct rte_pci_device *dev)
 			return true;
 
 		PCI_LOG(ERR, "%s(): can't open %s: %s",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return false;
 	}
 
@@ -551,7 +552,7 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
 
 	if (fp == NULL) {
 		PCI_LOG(ERR, "%s(): can't open %s: %s",
-			__func__, filename, strerror(errno));
+			__func__, filename, rte_strerror(errno));
 		return ret;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 4c1d3327a9..58039176ce 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -21,6 +21,7 @@
 #include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
@@ -108,7 +109,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
 	dev = makedev(major, minor);
 	ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);
 	if (ret != 0) {
-		PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, strerror(errno));
+		PCI_LOG(ERR, "%s(): mknod() failed %s", __func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -237,7 +238,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 	/* save fd */
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
-		PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -249,7 +250,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 
 	uio_cfg_fd = open(cfgname, O_RDWR);
 	if (uio_cfg_fd < 0) {
-		PCI_LOG(ERR, "Cannot open %s: %s", cfgname, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", cfgname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -310,7 +311,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	/* allocate memory to keep path */
 	maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0);
 	if (maps[map_idx].path == NULL) {
-		PCI_LOG(ERR, "Cannot allocate memory for path: %s", strerror(errno));
+		PCI_LOG(ERR, "Cannot allocate memory for path: %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -342,7 +343,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 		/* then try to map resource file */
 		fd = open(devname, O_RDWR);
 		if (fd < 0) {
-			PCI_LOG(ERR, "Cannot open %s: %s", devname, strerror(errno));
+			PCI_LOG(ERR, "Cannot open %s: %s", devname, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -397,7 +398,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		dev->addr.devid, dev->addr.function);
 	f = fopen(filename, "r");
 	if (f == NULL) {
-		PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, strerror(errno));
+		PCI_LOG(ERR, "%s(): Cannot open sysfs resource: %s", __func__, rte_strerror(errno));
 		return -1;
 	}
 
@@ -438,14 +439,14 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 					RTE_INTR_HANDLE_UNKNOWN) {
 		int uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
 		if (uio_num < 0) {
-			PCI_LOG(ERR, "cannot open %s: %s", dirname, strerror(errno));
+			PCI_LOG(ERR, "cannot open %s: %s", dirname, rte_strerror(errno));
 			goto error;
 		}
 
 		snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num);
 		fd = open(filename, O_RDWR);
 		if (fd < 0) {
-			PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno));
+			PCI_LOG(ERR, "Cannot open %s: %s", filename, rte_strerror(errno));
 			goto error;
 		}
 		if (rte_intr_fd_set(dev->intr_handle, fd))
@@ -484,7 +485,7 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 		dev->addr.devid, dev->addr.function);
 	f = fopen(filename, "r");
 	if (f == NULL) {
-		PCI_LOG(ERR, "Cannot open sysfs resource: %s", strerror(errno));
+		PCI_LOG(ERR, "Cannot open sysfs resource: %s", rte_strerror(errno));
 		return -1;
 	}
 	for (i = 0; i < bar + 1; i++) {
@@ -507,14 +508,14 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
 	/* mmap the pci resource */
 	fd = open(filename, O_RDWR);
 	if (fd < 0) {
-		PCI_LOG(ERR, "Cannot open %s: %s", filename, strerror(errno));
+		PCI_LOG(ERR, "Cannot open %s: %s", filename, rte_strerror(errno));
 		goto error;
 	}
 	addr = mmap(NULL, end_addr + 1, PROT_READ | PROT_WRITE,
 		MAP_SHARED, fd, 0);
 	close(fd);
 	if (addr == MAP_FAILED) {
-		PCI_LOG(ERR, "Cannot mmap IO port resource: %s", strerror(errno));
+		PCI_LOG(ERR, "Cannot mmap IO port resource: %s", rte_strerror(errno));
 		goto error;
 	}
 
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 5317170231..6ccf097fb7 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -21,6 +21,7 @@
 #include <bus_driver.h>
 #include <rte_spinlock.h>
 #include <rte_tailq.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 
@@ -223,7 +224,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_IRQ_INFO, &irq);
 		if (ret < 0) {
 			PCI_LOG(ERR, "Cannot get VFIO IRQ info, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -249,7 +250,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
 		fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 		if (fd < 0) {
 			PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -330,7 +331,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 	fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (fd < 0) {
 		PCI_LOG(ERR, "Cannot set up eventfd, error %i (%s)",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -451,7 +452,7 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd)
 	 * then it updates errno as EINVAL.
 	 */
 	if (ioctl(vfio_dev_fd, VFIO_DEVICE_RESET) && errno != EINVAL) {
-		PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, strerror(errno));
+		PCI_LOG(ERR, "Unable to reset device! Error: %d (%s)", errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -724,7 +725,7 @@ pci_vfio_fill_regions(struct rte_pci_device *dev, int vfio_dev_fd,
 		ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			PCI_LOG(DEBUG, "%s cannot get device region info error %i (%s)",
-				dev->name, errno, strerror(errno));
+				dev->name, errno, rte_strerror(errno));
 			return -1;
 		}
 
@@ -792,7 +793,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		VFIO_PCI_CONFIG_REGION_INDEX);
 	if (ret < 0) {
 		PCI_LOG(ERR, "%s cannot get device region info error %i (%s)",
-			dev->name, errno, strerror(errno));
+			dev->name, errno, rte_strerror(errno));
 		goto err_vfio_res;
 	}
 	pdev->region[VFIO_PCI_CONFIG_REGION_INDEX].size = reg->size;
@@ -830,7 +831,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 		ret = pci_vfio_get_region_info(vfio_dev_fd, &reg, i);
 		if (ret < 0) {
 			PCI_LOG(ERR, "%s cannot get device region info error %i (%s)",
-				pci_addr, errno, strerror(errno));
+				pci_addr, errno, rte_strerror(errno));
 			goto err_map;
 		}
 
@@ -891,7 +892,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s",
-					pci_addr, i, strerror(errno));
+					pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -899,7 +900,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, 0);
 			if (ret < 0) {
 				PCI_LOG(ERR, "%s mapping BAR%i failed: %s",
-					pci_addr, i, strerror(errno));
+					pci_addr, i, rte_strerror(errno));
 				free(reg);
 				goto err_map;
 			}
@@ -995,14 +996,14 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				PCI_LOG(ERR, "%s sparse mapping BAR%i failed: %s",
-					pci_addr, i, strerror(errno));
+					pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		} else {
 			ret = pci_vfio_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
 				PCI_LOG(ERR, "%s mapping BAR%i failed: %s",
-					pci_addr, i, strerror(errno));
+					pci_addr, i, rte_strerror(errno));
 				goto err_vfio_dev_fd;
 			}
 		}
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index 30503bd23a..b2b0ba798d 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -15,6 +15,7 @@
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -52,7 +53,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 			fd = open(uio_res->maps[i].path, O_RDWR);
 			if (fd < 0) {
 				PCI_LOG(ERR, "Cannot open %s: %s",
-					uio_res->maps[i].path, strerror(errno));
+					uio_res->maps[i].path, rte_strerror(errno));
 				return -1;
 			}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 14/42] bus/vdev: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (12 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 13/42] bus/pci: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 15/42] bus/vmbus: " Dengdui Huang
                       ` (29 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/bus/vdev/vdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index ec7abe7cda..299f8c2873 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -437,7 +437,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 			strlcpy(ou->name, devname, RTE_DEV_NAME_MAX_LEN);
 			if (rte_mp_sendmsg(&mp_resp) < 0)
 				VDEV_LOG(ERR, "send vdev, %s, failed, %s",
-					 devname, strerror(rte_errno));
+					 devname, rte_strerror(rte_errno));
 			num++;
 		}
 		rte_spinlock_recursive_unlock(&vdev_device_list_lock);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 15/42] bus/vmbus: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (13 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 14/42] bus/vdev: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 16/42] common/cnxk: " Dengdui Huang
                       ` (28 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/bus/vmbus/linux/vmbus_bus.c  |  7 ++++---
 drivers/bus/vmbus/linux/vmbus_uio.c  | 21 +++++++++++----------
 drivers/bus/vmbus/vmbus_common.c     |  4 ++--
 drivers/bus/vmbus/vmbus_common_uio.c |  3 ++-
 4 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index 01d8111b85..0c92c1d4dd 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -18,6 +18,7 @@
 #include <rte_memory.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "eal_filesystem.h"
 #include "private.h"
@@ -50,7 +51,7 @@ parse_sysfs_uuid(const char *filename, rte_uuid_t uu)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s: %s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -92,7 +93,7 @@ get_sysfs_string(const char *filename, char *buf, size_t buflen)
 	f = fopen(filename, "r");
 	if (f == NULL) {
 		VMBUS_LOG(ERR, "cannot open sysfs value %s:%s",
-			  filename, strerror(errno));
+			  filename, rte_strerror(errno));
 		return -1;
 	}
 
@@ -350,7 +351,7 @@ rte_vmbus_scan(void)
 			return 0;
 
 		VMBUS_LOG(ERR, "opendir %s failed: %s",
-			  SYSFS_VMBUS_DEVICES, strerror(errno));
+			  SYSFS_VMBUS_DEVICES, rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 26edef342d..5fce68d880 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -18,6 +18,7 @@
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
 #include <rte_string_fns.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -34,7 +35,7 @@ void vmbus_uio_irq_control(struct rte_vmbus_device *dev, int32_t onoff)
 		  sizeof(onoff)) < 0) {
 		VMBUS_LOG(ERR, "cannot write to %d:%s",
 			  rte_intr_fd_get(dev->intr_handle),
-			  strerror(errno));
+			  rte_strerror(errno));
 	}
 }
 
@@ -51,7 +52,7 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev)
 	if (cc < (int)sizeof(count)) {
 		if (cc < 0) {
 			VMBUS_LOG(ERR, "IRQ read failed %s",
-				  strerror(errno));
+				  rte_strerror(errno));
 			return -errno;
 		}
 		VMBUS_LOG(ERR, "can't read IRQ count");
@@ -91,7 +92,7 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev,
 	fd = open(devname, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			devname, strerror(errno));
+			devname, rte_strerror(errno));
 		goto error;
 	}
 
@@ -158,7 +159,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
@@ -256,13 +257,13 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
 	fd = open(ring_path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		return -errno;
 	}
 
 	if (fstat(fd, &sb) < 0) {
 		VMBUS_LOG(ERR, "Cannot state %s: %s",
-			  ring_path, strerror(errno));
+			  ring_path, rte_strerror(errno));
 		close(fd);
 		return -errno;
 	}
@@ -342,7 +343,7 @@ static int vmbus_uio_sysfs_read(const char *dir, const char *name,
 	f = fopen(path, "r");
 	if (!f) {
 		VMBUS_LOG(ERR, "can't open %s:%s",
-			  path, strerror(errno));
+			  path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -404,7 +405,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 	chan_dir = opendir(chan_path);
 	if (!chan_dir) {
 		VMBUS_LOG(ERR, "cannot open %s: %s",
-			  chan_path, strerror(errno));
+			  chan_path, rte_strerror(errno));
 		return -errno;
 	}
 
@@ -441,7 +442,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &subid, UINT16_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no subchannel_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
@@ -452,7 +453,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 					   &monid, UINT8_MAX);
 		if (err) {
 			VMBUS_LOG(NOTICE, "no monitor_id in %s:%s",
-				  subchan_path, strerror(-err));
+				  subchan_path, rte_strerror(-err));
 			goto fail;
 		}
 
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 8a965d10d9..ef05d62714 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -38,7 +38,7 @@ vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 		VMBUS_LOG(ERR,
 			  "mmap(%d, %p, %zu, %ld) failed: %s",
 			  fd, requested_addr, size, (long)offset,
-			  strerror(errno));
+			  rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory mapped at %p",
 			  mapaddr);
@@ -57,7 +57,7 @@ vmbus_unmap_resource(void *requested_addr, size_t size)
 	if (munmap(requested_addr, size)) {
 		VMBUS_LOG(ERR, "munmap(%p, 0x%lx) failed: %s",
 			requested_addr, (unsigned long)size,
-			strerror(errno));
+			rte_strerror(errno));
 	} else {
 		VMBUS_LOG(DEBUG, "  VMBUS memory unmapped at %p",
 			  requested_addr);
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 4d4613513c..54c1187026 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -14,6 +14,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
+#include <rte_errno.h>
 
 #include "private.h"
 
@@ -56,7 +57,7 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
 	fd = open(uio_res->path, O_RDWR);
 	if (fd < 0) {
 		VMBUS_LOG(ERR, "Cannot open %s: %s",
-			  uio_res->path, strerror(errno));
+			  uio_res->path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 16/42] common/cnxk: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (14 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 15/42] bus/vmbus: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 17/42] common/mlx5: " Dengdui Huang
                       ` (27 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/common/cnxk/roc_dev.c   | 6 ++++--
 drivers/common/cnxk/roc_model.c | 4 +++-
 drivers/common/cnxk/roc_utils.c | 4 +++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index c905d35ea6..94a4f62ce1 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -8,6 +8,8 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -1323,7 +1325,7 @@ cn20k_pfvf_mbox_alloc(struct dev *dev, uint16_t max_vfs)
 
 	mz = plt_memzone_reserve_aligned(name, vf_mbox_region, 0, MBOX_SIZE);
 	if (!mz) {
-		plt_err("Memory alloc failed: %s", strerror(errno));
+		plt_err("Memory alloc failed: %s", rte_strerror(errno));
 		goto fail;
 	}
 
@@ -1445,7 +1447,7 @@ dev_lmt_setup(struct dev *dev)
 	 */
 	mz = plt_lmt_region_reserve_aligned(name, LMT_REGION_SIZE, LMT_REGION_SIZE);
 	if (!mz) {
-		plt_err("Memory alloc failed: %s", strerror(errno));
+		plt_err("Memory alloc failed: %s", rte_strerror(errno));
 		goto fail;
 	}
 
diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index 6289461db4..da0664afdb 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -6,6 +6,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -157,7 +159,7 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass)
 	dir = opendir(SYSFS_PCI_DEVICES);
 	if (dir == NULL) {
 		plt_err("%s(): opendir failed: %s", __func__,
-			strerror(errno));
+			rte_strerror(errno));
 		return -errno;
 	}
 
diff --git a/drivers/common/cnxk/roc_utils.c b/drivers/common/cnxk/roc_utils.c
index 9af2ae9b69..418cd6b477 100644
--- a/drivers/common/cnxk/roc_utils.c
+++ b/drivers/common/cnxk/roc_utils.c
@@ -2,6 +2,8 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <rte_errno.h>
+
 #include "roc_api.h"
 #include "roc_priv.h"
 
@@ -245,7 +247,7 @@ roc_error_msg_get(int errorcode)
 		 * Handle general error (as defined in linux errno.h)
 		 */
 		if (abs(errorcode) < 300)
-			err_msg = strerror(abs(errorcode));
+			err_msg = rte_strerror(abs(errorcode));
 		else
 			err_msg = "Unknown error code";
 		break;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 17/42] common/mlx5: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (15 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 16/42] common/cnxk: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 18/42] crypto/caam_jr: " Dengdui Huang
                       ` (26 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/common/mlx5/linux/mlx5_nl.c | 12 ++++++------
 drivers/common/mlx5/mlx5_common.c   |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_nl.c b/drivers/common/mlx5/linux/mlx5_nl.c
index a5ac4dc543..568c7826c3 100644
--- a/drivers/common/mlx5/linux/mlx5_nl.c
+++ b/drivers/common/mlx5/linux/mlx5_nl.c
@@ -548,7 +548,7 @@ mlx5_nl_mac_addr_list(int nlsk_fd, unsigned int iface_idx,
 	return 0;
 error:
 	DRV_LOG(DEBUG, "Interface %u cannot retrieve MAC address list %s",
-		iface_idx, strerror(rte_errno));
+		iface_idx, rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -618,7 +618,7 @@ mlx5_nl_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s MAC address %s %s",
 			iface_idx,
-			add ? "add" : "remove", m, strerror(rte_errno));
+			add ? "add" : "remove", m, rte_strerror(rte_errno));
 	}
 #endif
 	return -rte_errno;
@@ -705,7 +705,7 @@ mlx5_nl_vf_mac_addr_modify(int nlsk_fd, unsigned int iface_idx,
 		RTE_ETHER_ADDR_PRT_FMT " : %s",
 		vf_index,
 		RTE_ETHER_ADDR_BYTES(mac),
-		strerror(rte_errno));
+		rte_strerror(rte_errno));
 	return -rte_errno;
 }
 
@@ -930,7 +930,7 @@ mlx5_nl_promisc(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s promisc mode: Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -957,7 +957,7 @@ mlx5_nl_allmulti(int nlsk_fd, unsigned int iface_idx, int enable)
 		DRV_LOG(DEBUG,
 			"Interface %u cannot %s allmulti : Netlink error %s",
 			iface_idx, enable ? "enable" : "disable",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 	return ret;
 }
 
@@ -1935,7 +1935,7 @@ mlx5_nl_read_events(int nlsk_fd, mlx5_nl_event_cb *cb, void *cb_arg)
 			if (errno == EINTR)
 				continue;
 			DRV_LOG(DEBUG, "Failed to receive netlink message: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return -rte_errno;
 		}
diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index ca8543e36e..7aafd0083d 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -762,7 +762,7 @@ mlx5_common_dev_create(struct rte_device *eal_dev, uint32_t classes,
 	ret = mlx5_common_config_get(mkvlist, &cdev->config);
 	if (ret < 0) {
 		DRV_LOG(ERR, "Failed to process device arguments: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		rte_free(cdev);
 		return NULL;
 	}
@@ -837,7 +837,7 @@ mlx5_common_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_common_config_get(mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
@@ -1011,7 +1011,7 @@ mlx5_common_dev_probe(struct rte_device *eal_dev)
 		if (ret) {
 			DRV_LOG(ERR,
 				"Probe again parameters aren't compatible : %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto class_err;
 		}
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 18/42] crypto/caam_jr: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (16 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 17/42] common/mlx5: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 19/42] dma/idxd: " Dengdui Huang
                       ` (25 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 8956f7750d..cdd027aeae 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -17,6 +17,7 @@
 #include <rte_malloc.h>
 #include <rte_crypto.h>
 #include <rte_security.h>
+#include <rte_errno.h>
 
 #include <caam_jr_config.h>
 #include <caam_jr_hw_specific.h>
@@ -355,7 +356,7 @@ free_job_ring(int uio_fd)
 	if (munmap(job_ring->register_base_addr, job_ring->map_size)) {
 		CAAM_JR_INFO("cannot munmap(%p, 0x%lx): %s",
 			job_ring->register_base_addr,
-			(unsigned long)job_ring->map_size, strerror(errno));
+			(unsigned long)job_ring->map_size, rte_strerror(errno));
 	} else
 		CAAM_JR_DEBUG("JR UIO memory is unmapped");
 
@@ -419,7 +420,7 @@ sec_configure(void)
 	d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		CAAM_JR_ERR("Error opening directory '%s': %s",
-			SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 19/42] dma/idxd: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (17 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 18/42] crypto/caam_jr: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 20/42] net/af_packet: " Dengdui Huang
                       ` (24 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/dma/idxd/idxd_bus.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index ba8076715d..c4a2c6bb54 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -16,6 +16,7 @@
 #include <rte_log.h>
 #include <rte_dmadev_pmd.h>
 #include <rte_string_fns.h>
+#include <rte_errno.h>
 
 #include "idxd_internal.h"
 
@@ -145,7 +146,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	fd = open(sysfs_node, O_RDONLY);
 	if (fd < 0) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
@@ -153,7 +154,7 @@ read_wq_string(struct rte_dsa_device *dev, const char *filename,
 	close(fd);
 	if (len < 0) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 	value[len] = '\0';
@@ -173,13 +174,13 @@ read_wq_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -200,13 +201,13 @@ read_device_int(struct rte_dsa_device *dev, const char *filename,
 	f = fopen(sysfs_node, "r");
 	if (f == NULL) {
 		IDXD_PMD_ERR("%s(): opening file '%s' failed: %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		return -1;
 	}
 
 	if (fscanf(f, "%d", value) != 1) {
 		IDXD_PMD_ERR("%s(): error reading file '%s': %s",
-				__func__, sysfs_node, strerror(errno));
+				__func__, sysfs_node, rte_strerror(errno));
 		ret = -1;
 	}
 
@@ -323,7 +324,7 @@ dsa_scan(void)
 		if (errno == ENOENT)
 			return 0; /* no bus, return without error */
 		IDXD_PMD_ERR("%s(): opendir '%s' failed: %s",
-				__func__, path, strerror(errno));
+				__func__, path, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 20/42] net/af_packet: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (18 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 19/42] dma/idxd: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang
                       ` (23 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index bfd3bd1eb1..cb3be4f906 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -114,7 +114,7 @@ RTE_LOG_REGISTER_DEFAULT(af_packet_logtype, NOTICE);
 
 #define PMD_LOG_ERRNO(level, fmt, ...) \
 	RTE_LOG_LINE(level, AFPACKET, "%s(): " fmt ":%s", __func__, \
-		## __VA_ARGS__, strerror(errno))
+		## __VA_ARGS__, rte_strerror(errno))
 
 static uint16_t
 eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 21/42] net/bnxt: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (19 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 20/42] net/af_packet: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23 20:24       ` Ajit Khaparde
  2024-10-23  8:28     ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang
                       ` (22 subsequent siblings)
  43 siblings, 1 reply; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/bnxt/bnxt_stats.c                 |   2 +-
 drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
 drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
 drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
 drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
 drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
 drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
 drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
 drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
 drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
 drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
 drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
 drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
 drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
 17 files changed, 360 insertions(+), 360 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 5e59afe79f..3f89f42bbb 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -1187,7 +1187,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 	ret = bnxt_hwrm_port_clr_stats(bp);
 	if (ret != 0)
 		PMD_DRV_LOG_LINE(ERR, "Failed to reset xstats: %s",
-			    strerror(-ret));
+			    rte_strerror(-ret));
 
 	bnxt_clear_prev_stat(bp);
 
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index e9b5739050..fedea23a74 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -149,7 +149,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -191,7 +191,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -249,7 +249,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -308,7 +308,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -365,7 +365,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -409,7 +409,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -600,7 +600,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -636,7 +636,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -670,7 +670,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id)
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -705,7 +705,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -744,7 +744,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -827,7 +827,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
@@ -871,7 +871,7 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on)
 	if (rc != 0) {
 		PMD_DRV_LOG_LINE(ERR,
 			"Error during getting device (port %u) info: %s",
-			port, strerror(-rc));
+			port, rte_strerror(-rc));
 
 		return rc;
 	}
diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 3a812bee3a..2c7ee09888 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -205,7 +205,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -215,7 +215,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -232,7 +232,7 @@ int tf_insert_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM insert failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -261,7 +261,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -271,7 +271,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -285,7 +285,7 @@ int tf_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: EM delete failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -313,7 +313,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -323,7 +323,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -338,7 +338,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -347,7 +347,7 @@ int tf_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -375,7 +375,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -385,7 +385,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -400,7 +400,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -409,7 +409,7 @@ int tf_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Global Cfg set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -437,7 +437,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -456,7 +456,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -468,7 +468,7 @@ tf_alloc_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -497,7 +497,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -507,7 +507,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -516,7 +516,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -529,7 +529,7 @@ tf_free_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -566,7 +566,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -575,7 +575,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -589,7 +589,7 @@ tf_search_identifier(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Identifier search failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -615,7 +615,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -625,7 +625,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -634,7 +634,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -656,7 +656,7 @@ tf_search_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -688,7 +688,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -707,7 +707,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -720,7 +720,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM allocation failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -748,7 +748,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -758,7 +758,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -768,7 +768,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -786,7 +786,7 @@ tf_set_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	TFP_DRV_LOG(DEBUG,
@@ -816,7 +816,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -826,7 +826,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -835,7 +835,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -853,7 +853,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_sz_in_bits = gparms.key_size * 8;
@@ -881,7 +881,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -891,7 +891,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -900,7 +900,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_free_tcam_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM free failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -935,7 +935,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -945,7 +945,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -954,7 +954,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -963,7 +963,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries move failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -986,7 +986,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -996,7 +996,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1005,7 +1005,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1014,7 +1014,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: TCAM shared entries clear failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1042,7 +1042,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1052,7 +1052,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1067,7 +1067,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1076,7 +1076,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: External table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1085,7 +1085,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1094,7 +1094,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table allocation failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1124,7 +1124,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1134,7 +1134,7 @@ tf_free_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1149,7 +1149,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1158,7 +1158,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1167,7 +1167,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1177,7 +1177,7 @@ tf_free_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table free failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1204,7 +1204,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1214,7 +1214,7 @@ tf_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1231,7 +1231,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1240,7 +1240,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}  else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1249,7 +1249,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1258,7 +1258,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1267,7 +1267,7 @@ tf_set_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table set failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1295,7 +1295,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1305,7 +1305,7 @@ tf_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	gparms.dir = parms->dir;
@@ -1320,7 +1320,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	} else {
@@ -1329,7 +1329,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Operation not supported, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return -EOPNOTSUPP;
 		}
 
@@ -1338,7 +1338,7 @@ tf_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: Table get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -1366,7 +1366,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1376,7 +1376,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1393,7 +1393,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s, External table type not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 
 		return rc;
 	} else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
@@ -1402,7 +1402,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s: SRAM table bulk get failed, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		}
 		return rc;
 	}
@@ -1412,7 +1412,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1421,7 +1421,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Table get bulk failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -1442,7 +1442,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1452,7 +1452,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1463,7 +1463,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1472,7 +1472,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Get table increment not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1494,7 +1494,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1503,7 +1503,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1532,7 +1532,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1541,7 +1541,7 @@ tf_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1571,7 +1571,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1580,7 +1580,7 @@ tf_free_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1612,7 +1612,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1622,7 +1622,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1631,7 +1631,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1646,7 +1646,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1670,7 +1670,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1680,7 +1680,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1689,7 +1689,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1704,7 +1704,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: If_tbl get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1725,7 +1725,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1734,7 +1734,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1744,7 +1744,7 @@ int tf_get_session_info(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1752,14 +1752,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Ident get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tbl_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1767,14 +1767,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Tbl get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_tcam_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1782,14 +1782,14 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "TCAM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	if (dev->ops->tf_dev_get_em_resc_info == NULL) {
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1797,7 +1797,7 @@ int tf_get_session_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EM get resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -1861,7 +1861,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1870,7 +1870,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1901,7 +1901,7 @@ int tf_query_sram_resources(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EOPNOTSUPP;
 	}
 
@@ -1911,7 +1911,7 @@ int tf_query_sram_resources(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Get SRAM resc info failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1943,7 +1943,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1952,7 +1952,7 @@ int tf_set_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy set failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1984,7 +1984,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1993,7 +1993,7 @@ int tf_get_sram_policy(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: SRAM policy get failed, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c
index c518150d1f..162bc275b9 100644
--- a/drivers/net/bnxt/tf_core/tf_em_common.c
+++ b/drivers/net/bnxt/tf_core/tf_em_common.c
@@ -51,7 +51,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (tfp_calloc(&parms) != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: external pool failure %s\n",
-			    tf_dir_2_str(dir), strerror(ENOMEM));
+			    tf_dir_2_str(dir), rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -61,7 +61,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 
 	if (rc != 0) {
 		TFP_DRV_LOG(ERR, "%s: TBL: stack init failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -78,7 +78,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 		rc = stack_push(pool, j);
 		if (rc != 0) {
 			TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-				    tf_dir_2_str(dir), strerror(-rc));
+				    tf_dir_2_str(dir), rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -93,7 +93,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
 	if (!stack_is_full(pool)) {
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
-			    tf_dir_2_str(dir), strerror(-rc));
+			    tf_dir_2_str(dir), rte_strerror(-rc));
 		goto cleanup;
 	}
 	return 0;
@@ -921,7 +921,7 @@ tf_em_ext_common_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_ext_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -980,7 +980,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -989,7 +989,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -997,7 +997,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1157,7 +1157,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Map table scope operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1167,14 +1167,14 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 	data = aparms.mem_va;
 
 	if (tfp_calloc(&aparms) != 0) {
 		TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		rc = -ENOMEM;
 		goto clean;
 	}
@@ -1188,7 +1188,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map table scope config failure, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleaner;
 	}
 
@@ -1203,7 +1203,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Map tbl scope, set failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 cleaner:
 	tfp_free(mask);
diff --git a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
index 9c527e152d..92dba8c4f9 100644
--- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
@@ -130,7 +130,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -165,7 +165,7 @@ tf_em_move_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c
index 9efffe4ee5..55d27b88a2 100644
--- a/drivers/net/bnxt/tf_core/tf_em_host.c
+++ b/drivers/net/bnxt/tf_core/tf_em_host.c
@@ -182,7 +182,7 @@ tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl)
 			TFP_DRV_LOG(WARNING,
 				"Failed to allocate page table: lvl: %d, rc:%s\n",
 				i,
-				strerror(-rc));
+				rte_strerror(-rc));
 			goto cleanup;
 		}
 
@@ -379,7 +379,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-		strerror(-rc));
+		rte_strerror(-rc));
 		return rc;
 	}
 
@@ -387,7 +387,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
@@ -396,7 +396,7 @@ tf_em_ext_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "EEM: PF query error rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -420,7 +420,7 @@ tf_em_ext_alloc(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			"Failed to allocate session table scope, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		goto cleanup;
 	}
 
@@ -436,7 +436,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to query for EEM capability,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 	}
@@ -456,7 +456,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to register for EEM ctx,"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_ts;
 		}
 
@@ -473,7 +473,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "TBL: Unable to configure EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -485,7 +485,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "EEM: Unable to enable EEM in firmware"
 				    " rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 
@@ -501,7 +501,7 @@ tf_em_ext_alloc(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "%s TBL: Unable to allocate idx pools %s\n",
 				    tf_dir_2_str(dir),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			goto cleanup_full;
 		}
 	}
@@ -547,7 +547,7 @@ tf_em_ext_free(struct tf *tfp,
 	rc = tf_session_get_session_internal(tfp, &tfs);
 	if (rc) {
 		TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -555,7 +555,7 @@ tf_em_ext_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			"Failed to get em_ext_db from session, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return rc;
 	}
 	ext_db = (struct em_ext_db *)ext_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
index 7f7a663789..2fea8adb4b 100644
--- a/drivers/net/bnxt/tf_core/tf_em_internal.c
+++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
@@ -49,7 +49,7 @@ tf_em_insert_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -113,7 +113,7 @@ tf_em_delete_int_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -153,7 +153,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -163,7 +163,7 @@ tf_em_move_callback(void *user_data,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(parms.dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -202,7 +202,7 @@ tf_em_int_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "em_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -232,7 +232,7 @@ tf_em_int_bind(struct tf *tfp,
 				    "%s, EM Allocation must be in blocks of %d, failure %s\n",
 				    tf_dir_2_str(i),
 				    TF_SESSION_EM_ENTRY_SIZE,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 			return rc;
 		}
@@ -278,7 +278,7 @@ tf_em_int_bind(struct tf *tfp,
 				TFP_DRV_LOG(ERR,
 					 "%s, EM stack allocation failure %s\n",
 					 tf_dir_2_str(i),
-					 strerror(-rc));
+					 rte_strerror(-rc));
 				return rc;
 			}
 
diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c
index 3a8030a2fb..ba748fdc23 100644
--- a/drivers/net/bnxt/tf_core/tf_global_cfg.c
+++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c
@@ -83,7 +83,7 @@ tf_global_cfg_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -141,7 +141,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -151,7 +151,7 @@ tf_global_cfg_set(struct tf *tfp,
 			    "%s, Set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -185,7 +185,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -196,7 +196,7 @@ tf_global_cfg_get(struct tf *tfp,
 			    "%s, Get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c
index 7d9d9595dd..21e60a8ad5 100644
--- a/drivers/net/bnxt/tf_core/tf_identifier.c
+++ b/drivers/net/bnxt/tf_core/tf_identifier.c
@@ -39,7 +39,7 @@ tf_ident_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "ident_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -124,7 +124,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -164,7 +164,7 @@ tf_ident_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
@@ -222,7 +222,7 @@ tf_ident_search(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get ident_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	ident_db = (struct ident_rm_db *)ident_db_ptr;
diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c
index 578d361417..4d85b77b4e 100644
--- a/drivers/net/bnxt/tf_core/tf_if_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c
@@ -65,7 +65,7 @@ tf_if_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_if_tbl_set(struct tf *tfp,
 			    "%s, If Tbl set failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
@@ -187,7 +187,7 @@ tf_if_tbl_get(struct tf *tfp,
 			    "%s, If Tbl get failed, type:%d, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    parms->type,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return 0;
diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c
index 1c66c7e01a..5e180813d8 100644
--- a/drivers/net/bnxt/tf_core/tf_msg.c
+++ b/drivers/net/bnxt/tf_core/tf_msg.c
@@ -216,7 +216,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -224,7 +224,7 @@ tf_msg_session_client_register(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -291,7 +291,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -299,7 +299,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -361,7 +361,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -370,7 +370,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -378,7 +378,7 @@ tf_msg_session_qcfg(struct tf *tfp)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -447,7 +447,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(WARNING,
 			    "%s: QCAPS message size error, rc:%s, request %d vs response %d\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL),
+			    rte_strerror(EINVAL),
 			    size,
 			    resp.size);
 	}
@@ -498,7 +498,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -509,7 +509,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -559,7 +559,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -605,7 +605,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -616,7 +616,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -666,7 +666,7 @@ tf_msg_session_resc_info(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc message size error, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(EINVAL));
+			    rte_strerror(EINVAL));
 		rc = -EINVAL;
 		goto cleanup;
 	}
@@ -712,7 +712,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -722,7 +722,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -731,7 +731,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -797,7 +797,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -807,7 +807,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -816,7 +816,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -830,7 +830,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -893,7 +893,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -903,7 +903,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -912,7 +912,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -927,7 +927,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Record size to large, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -982,7 +982,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -992,7 +992,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1001,7 +1001,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1050,7 +1050,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1060,7 +1060,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1069,7 +1069,7 @@ tf_msg_move_em_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(em_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1129,7 +1129,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1149,7 +1149,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
 		rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n",
-				strerror(-rc));
+				rte_strerror(-rc));
 			return rc;
 		}
 
@@ -1180,7 +1180,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1189,7 +1189,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	/* Retrieve the session information */
@@ -1231,7 +1231,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1240,7 +1240,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1284,7 +1284,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1293,7 +1293,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1334,7 +1334,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1345,7 +1345,7 @@ tf_msg_em_qcaps(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1401,7 +1401,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1411,7 +1411,7 @@ tf_msg_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1465,7 +1465,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1475,7 +1475,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	fw_se_id = tfs->session_id.internal.fw_session_id;
@@ -1534,7 +1534,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1544,7 +1544,7 @@ tf_msg_em_op(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1585,7 +1585,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1594,7 +1594,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1664,7 +1664,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1673,7 +1673,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1705,7 +1705,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    parms->key_size,
 			    resp.key_size,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->key_size = resp.key_size;
@@ -1734,7 +1734,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1743,7 +1743,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(in_parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1793,7 +1793,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1803,7 +1803,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1812,7 +1812,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1877,7 +1877,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1887,7 +1887,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1896,7 +1896,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -1964,7 +1964,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1974,7 +1974,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1983,7 +1983,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2043,7 +2043,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2053,7 +2053,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2062,7 +2062,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2082,7 +2082,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Invalid parameters for msg type, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2140,7 +2140,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2150,7 +2150,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2159,7 +2159,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Unable to lookup FW id, rc:%s\n",
 			    tf_dir_2_str(dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	flags = (dir == TF_DIR_TX ?
@@ -2217,7 +2217,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2227,7 +2227,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup device, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2278,7 +2278,7 @@ tf_msg_set_if_tbl_entry(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Failed to lookup session, rc:%s\n",
 			    tf_dir_2_str(params->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2366,7 +2366,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2375,7 +2375,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2383,7 +2383,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2421,7 +2421,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2430,7 +2430,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup device, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -2438,7 +2438,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c
index 9b85f5397d..05d05befaa 100644
--- a/drivers/net/bnxt/tf_core/tf_rm.c
+++ b/drivers/net/bnxt/tf_core/tf_rm.c
@@ -1059,7 +1059,7 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db,
 			    "%s: Invalid pool for this type:%d, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
 			    tmp_subtype,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	*new_subtype = tmp_subtype;
@@ -1106,7 +1106,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Allocation failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1120,7 +1120,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
 		TFP_DRV_LOG(ERR,
 			    "%s: Alloc adjust of base index failed, rc:%s\n",
 			    tf_dir_2_str(rm_db->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return -EINVAL;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
index 253d716572..a1f9848aed 100644
--- a/drivers/net/bnxt/tf_core/tf_session.c
+++ b/drivers/net/bnxt/tf_core/tf_session.c
@@ -78,11 +78,11 @@ tf_session_create(struct tf *tfp,
 		if (rc == -EEXIST)
 			TFP_DRV_LOG(ERR,
 				    "Session is already open, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 		else
 			TFP_DRV_LOG(ERR,
 				    "Open message send failed, rc:%s\n",
-				    strerror(-rc));
+				    rte_strerror(-rc));
 
 		parms->open_cfg->session_id.id = TF_FW_SESSION_ID_INVALID;
 		return rc;
@@ -97,7 +97,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session info, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session = (struct tf_session_info *)cparms.mem_va;
@@ -111,7 +111,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	tfp->session->core_data = cparms.mem_va;
@@ -154,7 +154,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -226,7 +226,7 @@ tf_session_create(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	if (tfp->session) {
 		tfp_free(tfp->session->core_data);
@@ -268,7 +268,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -289,7 +289,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to create client on session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -303,7 +303,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate session client, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		goto cleanup;
 	}
 	client = cparms.mem_va;
@@ -320,7 +320,7 @@ tf_session_client_create(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session Firmware id lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -373,7 +373,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to lookup session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -405,7 +405,7 @@ tf_session_client_destroy(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Client destroy on FW Failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	ll_delete(&tfs->client_ll, &client->ll_entry);
@@ -435,7 +435,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to create session, ctrl_chan_name:%s, rc:%s\n",
 				    parms->open_cfg->ctrl_chan_name,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -457,7 +457,7 @@ tf_session_open_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 			      "Failed to create client on session 0x%x, rc:%s\n",
 			      parms->open_cfg->session_id.id,
-			      strerror(-rc));
+			      rte_strerror(-rc));
 			return rc;
 		}
 
@@ -480,7 +480,7 @@ tf_session_attach_session(struct tf *tfp __rte_unused,
 
 	TFP_DRV_LOG(ERR,
 		    "Attach not yet supported, rc:%s\n",
-		    strerror(-rc));
+		    rte_strerror(-rc));
 	return rc;
 }
 
@@ -503,7 +503,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -511,7 +511,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid session id, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -531,7 +531,7 @@ tf_session_close_session(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Client not part of the session, unable to close, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -556,7 +556,7 @@ tf_session_close_session(struct tf *tfp,
 			TFP_DRV_LOG(ERR,
 				    "Failed to unregister Client %d, rc:%s\n",
 				    client->session_client_id.id,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 
@@ -576,7 +576,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Device lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -586,7 +586,7 @@ tf_session_close_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Unable to lookup FW id, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -596,7 +596,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Device unbind failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	rc = tf_msg_session_close(tfp, fw_session_id, mailbox);
@@ -604,7 +604,7 @@ tf_session_close_session(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "FW Session close failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	/* Final cleanup as we're last user of the session thus we
@@ -658,7 +658,7 @@ tf_session_get_session_internal(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -689,7 +689,7 @@ tf_session_get_session(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Internal FID lookup\n, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -698,7 +698,7 @@ tf_session_get_session(struct tf *tfp,
 		TFP_DRV_LOG
 			(ERR,
 			"Ctrl channel not registered with session\n, rc:%s\n",
-			strerror(-rc));
+			rte_strerror(-rc));
 		return -EINVAL;
 	}
 
@@ -810,7 +810,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -818,7 +818,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -842,7 +842,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Session not created, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -850,7 +850,7 @@ tf_session_get_session_id(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Invalid Argument(s), rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1152,7 +1152,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1160,7 +1160,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to set state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1169,7 +1169,7 @@ tf_session_set_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Set session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
@@ -1186,7 +1186,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Session lookup failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1194,7 +1194,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		rc = -EINVAL;
 		TFP_DRV_LOG(ERR,
 			    "Only shared session able to get state, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -1203,7 +1203,7 @@ tf_session_get_hotup_state(struct tf *tfp,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Get session hot upgrade state failed, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_sram_mgr.c b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
index 87e8882fed..afbc3a3e46 100644
--- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c
+++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
@@ -494,7 +494,7 @@ static struct tf_sram_block
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate block, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return NULL;
 	}
 	block = (struct tf_sram_block *)cparms.mem_va;
@@ -588,7 +588,7 @@ tf_sram_mgr_bind(void **sram_handle)
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "Failed to allocate SRAM mgmt data, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	sram = (struct tf_sram *)cparms.mem_va;
@@ -628,7 +628,7 @@ tf_sram_mgr_unbind(void *sram_handle)
 					/* Log error */
 					TFP_DRV_LOG(ERR,
 						  "No SRAM slice list, rc:%s\n",
-						  strerror(-rc));
+						  rte_strerror(-rc));
 					return rc;
 				}
 				if (tf_sram_get_block_cnt(slice_list))
@@ -670,7 +670,7 @@ int tf_sram_mgr_alloc(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -759,7 +759,7 @@ tf_sram_mgr_free(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -781,7 +781,7 @@ tf_sram_mgr_free(void *sram_handle,
 	rc = tf_sram_free_slice(parms->slice_size, slice_offset,
 				block, &block_is_empty);
 	if (rc) {
-		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", strerror(-rc));
+		TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", rte_strerror(-rc));
 		return rc;
 	}
 #if (STATS_CLEAR_ON_READ_SUPPORT == 0)
@@ -805,7 +805,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -821,7 +821,7 @@ tf_sram_mgr_free(void *sram_handle,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->tbl_type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -836,14 +836,14 @@ tf_sram_mgr_free(void *sram_handle,
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n",
-				    block_id, strerror(-rc));
+				    block_id, rte_strerror(-rc));
 		}
 		fparms.index = block_id + 1;
 		rc = tf_rm_free(&fparms);
 
 		if (rc) {
 			TFP_DRV_LOG(ERR, "Free next block_id(%d) failed error(%s)\n",
-				    block_id + 1, strerror(-rc));
+				    block_id + 1, rte_strerror(-rc));
 		}
 		/* Free local entry regardless */
 		tf_sram_free_block(slice_list, block);
@@ -937,7 +937,7 @@ int tf_sram_mgr_is_allocated(void *sram_handle,
 		/* Log error */
 		TFP_DRV_LOG(ERR,
 			    "No SRAM slice list, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
index f5f3889934..0fbcba6c76 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl.c
@@ -45,7 +45,7 @@ tf_tbl_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tbl_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -143,7 +143,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -195,7 +195,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -234,7 +234,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Failed type lookup, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 		/* Clear the counter
@@ -250,7 +250,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 				    "%s, Set failed, type:%s, rc:%s\n",
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			return rc;
 		}
 	}
@@ -302,7 +302,7 @@ tf_tbl_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -341,7 +341,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -356,7 +356,7 @@ tf_tbl_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -393,7 +393,7 @@ tf_tbl_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -432,7 +432,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -449,7 +449,7 @@ tf_tbl_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -485,7 +485,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -517,7 +517,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tbl_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 
 	return rc;
diff --git a/drivers/net/bnxt/tf_core/tf_tbl_sram.c b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
index 3a6f1c68c7..39dbe11610 100644
--- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c
+++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
@@ -114,7 +114,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get hcapi_type %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	parms->bank_id = tf_tbl_sram_hcapi_2_bank[hcapi_type];
@@ -129,7 +129,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 			    "%s: Failed to get slice cnt %s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->tbl_type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (slices)
@@ -168,7 +168,7 @@ tf_tbl_sram_unbind(struct tf *tfp __rte_unused)
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (sram_handle)
@@ -204,7 +204,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tbl_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -214,7 +214,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -290,7 +290,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -299,7 +299,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -345,7 +345,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -417,7 +417,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -426,7 +426,7 @@ tf_tbl_sram_set(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -489,7 +489,7 @@ tf_tbl_sram_set(struct tf *tfp,
 				    tf_dir_2_str(parms->dir),
 				    tf_tbl_type_2_str(parms->type),
 				    parms->idx,
-				    strerror(-rc));
+				    rte_strerror(-rc));
 			rc = -ENOMEM;
 			return rc;
 		}
@@ -504,7 +504,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -519,7 +519,7 @@ tf_tbl_sram_set(struct tf *tfp,
 			    "%s, Set failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -553,7 +553,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -562,7 +562,7 @@ tf_tbl_sram_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -592,7 +592,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -607,7 +607,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	if (parms->type == TF_TBL_TYPE_ACT_STATS_64)
@@ -626,7 +626,7 @@ tf_tbl_sram_get(struct tf *tfp,
 			    "%s, Get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return rc;
@@ -661,7 +661,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
@@ -670,7 +670,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get sram_handle from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -703,7 +703,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    parms->starting_idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -716,7 +716,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
 			    idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		rc = -ENOMEM;
 		return rc;
 	}
@@ -730,7 +730,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Failed type lookup, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -751,7 +751,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
 			    "%s, Bulk get failed, type:%s, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
 			    tf_tbl_type_2_str(parms->type),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 	}
 	return rc;
 }
diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c
index 9e0671d47b..5924c5e6c1 100644
--- a/drivers/net/bnxt/tf_core/tf_tcam.c
+++ b/drivers/net/bnxt/tf_core/tf_tcam.c
@@ -57,7 +57,7 @@ tf_tcam_bind(struct tf *tfp,
 		rc = -EOPNOTSUPP;
 		TFP_DRV_LOG(ERR,
 			    "Operation not supported, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -91,7 +91,7 @@ tf_tcam_bind(struct tf *tfp,
 	cparms.alignment = 0;
 	if (tfp_calloc(&cparms) != 0) {
 		TFP_DRV_LOG(ERR, "tcam_rm_db alloc error %s\n",
-			    strerror(ENOMEM));
+			    rte_strerror(ENOMEM));
 		return -ENOMEM;
 	}
 
@@ -301,7 +301,7 @@ tf_tcam_alloc(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -320,7 +320,7 @@ tf_tcam_alloc(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get tcam_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -385,7 +385,7 @@ tf_tcam_free(struct tf *tfp,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -417,7 +417,7 @@ tf_tcam_free(struct tf *tfp,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -477,7 +477,7 @@ tf_tcam_free(struct tf *tfp,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -515,7 +515,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 		TFP_DRV_LOG(ERR,
 			    "%s: Operation not supported, rc:%s\n",
 			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
@@ -535,7 +535,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -579,7 +579,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	return 0;
@@ -618,7 +618,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 	if (rc) {
 		TFP_DRV_LOG(ERR,
 			    "Failed to get em_ext_db from session, rc:%s\n",
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 	tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
@@ -662,7 +662,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
 			    tf_dir_2_str(parms->dir),
 			    tf_tcam_tbl_2_str(parms->type),
 			    parms->idx,
-			    strerror(-rc));
+			    rte_strerror(-rc));
 		return rc;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 22/42] net/af_xdp: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (20 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-24 17:05       ` Maryam Tahhan
  2024-10-23  8:28     ` [PATCH v4 23/42] net/bonding: " Dengdui Huang
                       ` (21 subsequent siblings)
  43 siblings, 1 reply; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 814398ba4b..0b561b6683 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1191,7 +1191,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
 				&rxq->fq, &rxq->cq, &usr_config);
 		if (ret) {
 			AF_XDP_LOG_LINE(ERR, "Failed to create umem [%d]: [%s]",
-				   errno, strerror(errno));
+				   errno, rte_strerror(errno));
 			goto err;
 		}
 		umem->buffer = aligned_addr;
@@ -1408,7 +1408,7 @@ init_uds_sock(struct sockaddr_un *server, const char *dp_path)
 	if (connect(sock, (struct sockaddr *)server, sizeof(struct sockaddr_un)) < 0) {
 		close(sock);
 		AF_XDP_LOG_LINE(ERR, "Error connecting stream socket errno = [%d]: [%s]",
-			   errno, strerror(errno));
+			   errno, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1492,7 +1492,7 @@ read_msg(int sock, char *response, struct sockaddr_un *s, int *fd)
 		return 0;
 
 	if (msglen < 0) {
-		AF_XDP_LOG_LINE(ERR, "recvmsg failed, %s", strerror(errno));
+		AF_XDP_LOG_LINE(ERR, "recvmsg failed, %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -1527,7 +1527,7 @@ make_request_dp(int sock, struct sockaddr_un *server, char *request,
 		rval = send_msg(sock, request, req_fd, dp_path);
 
 	if (rval < 0) {
-		AF_XDP_LOG_LINE(ERR, "Write error %s", strerror(errno));
+		AF_XDP_LOG_LINE(ERR, "Write error %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -2023,7 +2023,7 @@ parse_prog_arg(const char *key __rte_unused,
 
 	if (access(value, F_OK) != 0) {
 		AF_XDP_LOG_LINE(ERR, "Error accessing %s: %s",
-			   value, strerror(errno));
+			   value, rte_strerror(errno));
 		return -EINVAL;
 	}
 
@@ -2518,7 +2518,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(ETH_AF_XDP_MP_KEY, afxdp_mp_send_fds);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			AF_XDP_LOG_LINE(ERR, "%s: Failed to register multi-process IPC callback: %s",
-				   name, strerror(rte_errno));
+				   name, rte_strerror(rte_errno));
 			return -1;
 		}
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 23/42] net/bonding: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (21 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 24/42] net/dpaa: " Dengdui Huang
                       ` (20 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/bonding/bonding_testpmd.c   | 4 ++--
 drivers/net/bonding/rte_eth_bond_api.c  | 2 +-
 drivers/net/bonding/rte_eth_bond_flow.c | 4 ++--
 drivers/net/bonding/rte_eth_bond_pmd.c  | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..111f9de0e7 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -551,7 +551,7 @@ static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mac_addr_set =
@@ -604,7 +604,7 @@ static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index ffc1322047..dbb642dc4c 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -483,7 +483,7 @@ __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s",
-			__func__, member_port_id, strerror(-ret));
+			__func__, member_port_id, rte_strerror(-ret));
 
 		return ret;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 5d0be5caf5..a38cc84f56 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -31,7 +31,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -45,7 +45,7 @@ bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index cda1c37124..95049eead6 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -192,7 +192,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s",
-			__func__, member_port, strerror(-ret));
+			__func__, member_port, rte_strerror(-ret));
 
 		return ret;
 	}
@@ -223,7 +223,7 @@ bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
 			RTE_BOND_LOG(ERR,
 				"%s: Error during getting device (port %u) info: %s",
 				__func__, bond_dev->data->port_id,
-				strerror(-ret));
+				rte_strerror(-ret));
 
 			return ret;
 		}
@@ -2290,7 +2290,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 					"%s: Error during getting device (port %u) info: %s",
 					__func__,
 					member.port_id,
-					strerror(-ret));
+					rte_strerror(-ret));
 
 				return ret;
 			}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 24/42] net/dpaa: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (22 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 23/42] net/bonding: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 25/42] net/dpaa2: " Dengdui Huang
                       ` (19 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/dpaa/dpaa_ethdev.c  | 4 ++--
 drivers/net/dpaa/fmlib/fm_lib.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index e8d34e5898..ddf61395d6 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1218,7 +1218,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 		ret = qman_init_fq(rxq, flags, &opts);
 		if (ret) {
 			DPAA_PMD_ERR("Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 			return ret;
 		}
 		if (dpaa_svr_family == SVR_LS1043A_FAMILY) {
@@ -1353,7 +1353,7 @@ dpaa_eth_eventq_attach(const struct rte_eth_dev *dev,
 	ret = qman_init_fq(rxq, flags, &opts);
 	if (ret) {
 		DPAA_PMD_ERR("Ev-Channel/Q association failed. fqid 0x%x "
-				"ret:%d(%s)", rxq->fqid, ret, strerror(ret));
+				"ret:%d(%s)", rxq->fqid, ret, rte_strerror(ret));
 		return ret;
 	}
 
diff --git a/drivers/net/dpaa/fmlib/fm_lib.c b/drivers/net/dpaa/fmlib/fm_lib.c
index b35feba004..fe19a5d8cb 100644
--- a/drivers/net/dpaa/fmlib/fm_lib.c
+++ b/drivers/net/dpaa/fmlib/fm_lib.c
@@ -103,7 +103,7 @@ fm_get_api_version(t_handle h_fm, ioc_fm_api_version_t *p_version)
 	ret = ioctl(p_dev->fd, FM_IOC_GET_API_VERSION, p_version);
 	if (ret) {
 		DPAA_PMD_ERR("cannot get API version, error %i (%s)",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 	_fml_dbg("Finishing.");
@@ -276,7 +276,7 @@ fm_pcd_kg_scheme_set(t_handle h_fm_pcd,
 	ret = ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_SET, params);
 	if (ret) {
 		DPAA_PMD_ERR("  cannot set kg scheme, error %i (%s)",
-			     errno, strerror(errno));
+			     errno, rte_strerror(errno));
 		return NULL;
 	}
 
@@ -310,7 +310,7 @@ fm_pcd_kg_scheme_delete(t_handle h_scheme)
 
 	if (ioctl(p_pcd_dev->fd, FM_PCD_IOC_KG_SCHEME_DELETE, &id)) {
 		DPAA_PMD_WARN("cannot delete kg scheme, error %i (%s)",
-			      errno, strerror(errno));
+			      errno, rte_strerror(errno));
 		RETURN_ERROR(MINOR, E_INVALID_OPERATION, NO_MSG);
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 25/42] net/dpaa2: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (23 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 24/42] net/dpaa: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 26/42] net/enetfec: " Dengdui Huang
                       ` (18 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 7b3e587a8d..ef34bce88f 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1170,7 +1170,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				irq_index, mask);
 	if (err < 0) {
 		DPAA2_PMD_ERR("Error: dpni_set_irq_mask():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 		return err;
 	}
 
@@ -1178,7 +1178,7 @@ dpaa2_eth_setup_irqs(struct rte_eth_dev *dev, int enable)
 				  irq_index, enable);
 	if (err < 0)
 		DPAA2_PMD_ERR("Error: dpni_set_irq_enable():%d (%s)", err,
-			      strerror(-err));
+			      rte_strerror(-err));
 
 	return err;
 }
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 26/42] net/enetfec: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (24 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 25/42] net/dpaa2: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 27/42] net/failsafe: " Dengdui Huang
                       ` (17 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/enetfec/enet_uio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/enetfec/enet_uio.c b/drivers/net/enetfec/enet_uio.c
index 9f4e896985..3967f95e82 100644
--- a/drivers/net/enetfec/enet_uio.c
+++ b/drivers/net/enetfec/enet_uio.c
@@ -231,7 +231,7 @@ enetfec_configure(void)
 	d = opendir(FEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		ENETFEC_PMD_ERR("Error opening directory '%s': %s",
-			FEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			FEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 27/42] net/failsafe: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (25 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 26/42] net/enetfec: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 28/42] net/i40e: " Dengdui Huang
                       ` (16 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/failsafe/failsafe.c         | 8 ++++----
 drivers/net/failsafe/failsafe_args.c    | 4 ++--
 drivers/net/failsafe/failsafe_eal.c     | 4 ++--
 drivers/net/failsafe/failsafe_flow.c    | 4 ++--
 drivers/net/failsafe/failsafe_ops.c     | 2 +-
 drivers/net/failsafe/failsafe_private.h | 6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 32811403b4..f89c946ce4 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -92,7 +92,7 @@ failsafe_hotplug_alarm_cancel(struct rte_eth_dev *dev)
 	rte_eal_alarm_cancel(fs_hotplug_alarm, dev);
 	if (rte_errno) {
 		ERROR("rte_eal_alarm_cancel failed (errno: %s)",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		ret = -rte_errno;
 	} else {
 		PRIV(dev)->pending_alarm = 0;
@@ -138,18 +138,18 @@ fs_mutex_init(struct fs_priv *priv)
 
 	ret = pthread_mutexattr_init(&attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex attributes - %s", strerror(ret));
+		ERROR("Cannot initiate mutex attributes - %s", rte_strerror(ret));
 		return ret;
 	}
 	/* Allow mutex relocks for the thread holding the mutex. */
 	ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 	if (ret) {
-		ERROR("Cannot set mutex type - %s", strerror(ret));
+		ERROR("Cannot set mutex type - %s", rte_strerror(ret));
 		return ret;
 	}
 	ret = pthread_mutex_init(&priv->hotplug_mutex, &attr);
 	if (ret) {
-		ERROR("Cannot initiate mutex - %s", strerror(ret));
+		ERROR("Cannot initiate mutex - %s", rte_strerror(ret));
 		return ret;
 	}
 	return 0;
diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c
index 1b8f1d3050..cc15428b7b 100644
--- a/drivers/net/failsafe/failsafe_args.c
+++ b/drivers/net/failsafe/failsafe_args.c
@@ -112,7 +112,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 	fp = popen(sdev->cmdline, "r");
 	if (fp == NULL) {
 		ret = -errno;
-		ERROR("popen: %s", strerror(errno));
+		ERROR("popen: %s", rte_strerror(errno));
 		return ret;
 	}
 	/* We only read one line */
@@ -131,7 +131,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline)
 		ERROR("Parsing device '%s' failed", output);
 ret_pclose:
 	if (pclose(fp) == -1)
-		ERROR("pclose: %s", strerror(errno));
+		ERROR("pclose: %s", rte_strerror(errno));
 	return ret;
 }
 
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index e79d3b4120..07fa802653 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -52,7 +52,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			if (ret < 0) {
 				ERROR("sub_device %d probe failed %s%s%s", i,
 				      rte_errno ? "(" : "",
-				      rte_errno ? strerror(rte_errno) : "",
+				      rte_errno ? rte_strerror(rte_errno) : "",
 				      rte_errno ? ")" : "");
 				continue;
 			}
@@ -100,7 +100,7 @@ fs_bus_init(struct rte_eth_dev *dev)
 			ret = rte_eth_dev_owner_set(pid, &PRIV(dev)->my_owner);
 			if (ret < 0) {
 				INFO("sub_device %d owner set failed (%s), "
-				     "will try again later", i, strerror(-ret));
+				     "will try again later", i, rte_strerror(-ret));
 				continue;
 			} else if (strncmp(rte_eth_devices[pid].device->name,
 				   da->name, strlen(da->name)) != 0) {
diff --git a/drivers/net/failsafe/failsafe_flow.c b/drivers/net/failsafe/failsafe_flow.c
index 707e6c63b5..5d17182cc5 100644
--- a/drivers/net/failsafe/failsafe_flow.c
+++ b/drivers/net/failsafe/failsafe_flow.c
@@ -33,7 +33,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Unable to process flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -47,7 +47,7 @@ fs_flow_allocate(const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		ERROR("Failed to copy flow rule (%s): %s",
 		      error.message ? error.message : "unspecified",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 9c013e0419..f3b2daf400 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -452,7 +452,7 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,
 #ifdef RTE_EXEC_ENV_LINUX
 	rxq->event_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 	if (rxq->event_fd < 0) {
-		ERROR("Failed to create an eventfd: %s", strerror(errno));
+		ERROR("Failed to create an eventfd: %s", rte_strerror(errno));
 		fs_unlock(dev, 0);
 		return -errno;
 	}
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index babea6016e..fcbb1b771e 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -407,14 +407,14 @@ fs_lock(struct rte_eth_dev *dev, unsigned int is_alarm)
 		ret = pthread_mutex_trylock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
 			DEBUG("Hot-plug mutex lock trying failed(%s), will try"
-			      " again later...", strerror(ret));
+			      " again later...", rte_strerror(ret));
 			return ret;
 		}
 		PRIV(dev)->alarm_lock = 1;
 	} else {
 		ret = pthread_mutex_lock(&PRIV(dev)->hotplug_mutex);
 		if (ret) {
-			ERROR("Cannot lock mutex(%s)", strerror(ret));
+			ERROR("Cannot lock mutex(%s)", rte_strerror(ret));
 			return ret;
 		}
 	}
@@ -436,7 +436,7 @@ fs_unlock(struct rte_eth_dev *dev, unsigned int is_alarm)
 	}
 	ret = pthread_mutex_unlock(&PRIV(dev)->hotplug_mutex);
 	if (ret)
-		ERROR("Cannot unlock hot-plug mutex(%s)", strerror(ret));
+		ERROR("Cannot unlock hot-plug mutex(%s)", rte_strerror(ret));
 }
 
 /*
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 28/42] net/i40e: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (26 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 27/42] net/failsafe: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 29/42] net/ice: " Dengdui Huang
                       ` (15 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/i40e/i40e_testpmd.c | 42 ++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/i40e/i40e_testpmd.c b/drivers/net/i40e/i40e_testpmd.c
index b6ef5d6e42..d0995531bc 100644
--- a/drivers/net/i40e/i40e_testpmd.c
+++ b/drivers/net/i40e/i40e_testpmd.c
@@ -53,7 +53,7 @@ cmd_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -148,7 +148,7 @@ cmd_region_flowtype_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "region flowtype config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -233,7 +233,7 @@ cmd_user_priority_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "user_priority region config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -320,7 +320,7 @@ cmd_flush_queue_region_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config flush error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -433,7 +433,7 @@ cmd_show_queue_region_info_parsed(void *parsed_result,
 		break;
 	default:
 		fprintf(stderr, "queue region config info show error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	}
 }
 
@@ -536,7 +536,7 @@ cmd_flow_director_filter_parsed(void *parsed_result,
 							add);
 	if (ret < 0)
 		fprintf(stderr, "flow director config error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 	close_file(conf.input.packet);
 }
 
@@ -666,7 +666,7 @@ cmd_set_vf_promisc_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -745,7 +745,7 @@ cmd_set_vf_allmulti_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -825,7 +825,7 @@ cmd_set_vf_broadcast_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -908,7 +908,7 @@ cmd_set_vf_vlan_tag_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1013,7 +1013,7 @@ cmd_vf_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1108,7 +1108,7 @@ cmd_vf_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1158,7 +1158,7 @@ cmd_vf_tc_max_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1207,7 +1207,7 @@ cmd_strict_link_prio_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -1928,7 +1928,7 @@ cmd_pctype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2000,7 +2000,7 @@ cmd_pctype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		return;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 		return;
 	}
 
@@ -2111,7 +2111,7 @@ cmd_pctype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2191,7 +2191,7 @@ cmd_ptype_mapping_get_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 
 	if (!ret) {
@@ -2280,7 +2280,7 @@ cmd_ptype_mapping_replace_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2347,7 +2347,7 @@ cmd_ptype_mapping_reset_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -2427,7 +2427,7 @@ cmd_ptype_mapping_update_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 29/42] net/ice: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (27 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 28/42] net/i40e: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 30/42] net/ixgbe: " Dengdui Huang
                       ` (14 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/ice/ice_testpmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_testpmd.c b/drivers/net/ice/ice_testpmd.c
index 98c02d68c6..25e3d63163 100644
--- a/drivers/net/ice/ice_testpmd.c
+++ b/drivers/net/ice/ice_testpmd.c
@@ -61,7 +61,7 @@ cmd_ddp_dump_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
@@ -128,7 +128,7 @@ cmd_ddp_dump_switch_parsed(void *parsed_result,
 		default:
 			fprintf(stderr,
 				"Failed to dump DDP switch runtime configure,"
-				" error: (%s)\n", strerror(-ret));
+				" error: (%s)\n", rte_strerror(-ret));
 		}
 	}
 	free(buff);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 30/42] net/ixgbe: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (28 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 29/42] net/ice: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 31/42] net/memif: " Dengdui Huang
                       ` (13 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/ixgbe/ixgbe_testpmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_testpmd.c b/drivers/net/ixgbe/ixgbe_testpmd.c
index e0d161eafe..3c6d648844 100644
--- a/drivers/net/ixgbe/ixgbe_testpmd.c
+++ b/drivers/net/ixgbe/ixgbe_testpmd.c
@@ -141,7 +141,7 @@ cmd_set_vf_split_drop_en_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -243,7 +243,7 @@ cmd_set_macsec_offload_on_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -327,7 +327,7 @@ cmd_set_macsec_offload_off_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -402,7 +402,7 @@ cmd_set_macsec_sc_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -510,7 +510,7 @@ cmd_set_macsec_sa_parsed(void *parsed_result,
 		fprintf(stderr, "not supported on port %d\n", res->port_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -599,7 +599,7 @@ cmd_tc_min_bw_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 31/42] net/memif: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (29 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 30/42] net/ixgbe: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 32/42] net/mlx4: " Dengdui Huang
                       ` (12 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/memif/memif_socket.c  |  4 ++--
 drivers/net/memif/rte_eth_memif.c | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 649f8d0e61..592b71979a 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -71,7 +71,7 @@ memif_msg_send_from_queue(struct memif_control_channel *cc)
 	size = memif_msg_send(rte_intr_fd_get(cc->intr_handle), &e->msg,
 			      e->fd);
 	if (size != sizeof(memif_msg_t)) {
-		MIF_LOG(ERR, "sendmsg fail: %s.", strerror(errno));
+		MIF_LOG(ERR, "sendmsg fail: %s.", rte_strerror(errno));
 		ret = -1;
 	} else {
 		MIF_LOG(DEBUG, "Sent msg type %u.", e->msg.type);
@@ -975,7 +975,7 @@ memif_socket_create(char *key, uint8_t listener, bool is_abstract, uid_t owner_u
 	return sock;
 
  error:
-	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, strerror(errno));
+	MIF_LOG(ERR, "Failed to setup socket %s: %s", key, rte_strerror(errno));
 	if (sock != NULL) {
 		rte_intr_instance_free(sock->intr_handle);
 		rte_free(sock);
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index cd722f254f..4b1d2010a2 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -807,7 +807,7 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			     sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -958,7 +958,7 @@ eth_memif_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 				     &a, sizeof(a));
 		if (unlikely(size < 0)) {
 			MIF_LOG(WARNING,
-				"Failed to send interrupt. %s", strerror(errno));
+				"Failed to send interrupt. %s", rte_strerror(errno));
 		}
 	}
 
@@ -1080,27 +1080,27 @@ memif_region_init_shm(struct rte_eth_dev *dev, uint8_t has_buffers)
 
 	r->fd = memfd_create(shm_name, MFD_ALLOW_SEALING);
 	if (r->fd < 0) {
-		MIF_LOG(ERR, "Failed to create shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to create shm file: %s.", rte_strerror(errno));
 		ret = -1;
 		goto error;
 	}
 
 	ret = fcntl(r->fd, F_ADD_SEALS, F_SEAL_SHRINK);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to add seals to shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	ret = ftruncate(r->fd, r->region_size);
 	if (ret < 0) {
-		MIF_LOG(ERR, "Failed to truncate shm file: %s.", strerror(errno));
+		MIF_LOG(ERR, "Failed to truncate shm file: %s.", rte_strerror(errno));
 		goto error;
 	}
 
 	r->addr = mmap(NULL, r->region_size, PROT_READ |
 		       PROT_WRITE, MAP_SHARED, r->fd, 0);
 	if (r->addr == MAP_FAILED) {
-		MIF_LOG(ERR, "Failed to mmap shm region: %s.", strerror(ret));
+		MIF_LOG(ERR, "Failed to mmap shm region: %s.", rte_strerror(ret));
 		ret = -1;
 		goto error;
 	}
@@ -1221,7 +1221,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for tx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1245,7 +1245,7 @@ memif_init_queues(struct rte_eth_dev *dev)
 		if (rte_intr_fd_get(mq->intr_handle) < 0) {
 			MIF_LOG(WARNING,
 				"Failed to create eventfd for rx queue %d: %s.", i,
-				strerror(errno));
+				rte_strerror(errno));
 		}
 		mq->buffers = NULL;
 		if (pmd->flags & ETH_MEMIF_FLAG_ZERO_COPY) {
@@ -1301,7 +1301,7 @@ memif_connect(struct rte_eth_dev *dev)
 						MAP_SHARED, mr->fd, 0);
 				if (mr->addr == MAP_FAILED) {
 					MIF_LOG(ERR, "mmap failed: %s",
-						strerror(errno));
+						rte_strerror(errno));
 					return -1;
 				}
 			}
@@ -1985,7 +1985,7 @@ rte_pmd_memif_probe(struct rte_vdev_device *vdev)
 	 */
 	if (ret < 0 && rte_errno != EEXIST)
 		MIF_LOG(WARNING, "Failed to register mp action callback: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 
 	/* use abstract address by default */
 	flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 32/42] net/mlx4: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (30 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 31/42] net/memif: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 33/42] net/mlx5: " Dengdui Huang
                       ` (11 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/mlx4/mlx4.c        | 14 +++++++-------
 drivers/net/mlx4/mlx4_ethdev.c | 18 +++++++++---------
 drivers/net/mlx4/mlx4_rxq.c    | 10 +++++-----
 drivers/net/mlx4/mlx4_txq.c    | 10 +++++-----
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 9c2872429f..54073057e8 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -255,7 +255,7 @@ mlx4_dev_configure(struct rte_eth_dev *dev)
 	if (ret) {
 		ERROR("cannot set up internal flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto exit;
 	}
@@ -302,7 +302,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 	ret = mlx4_rss_init(priv);
 	if (ret) {
 		ERROR("%p: cannot initialize RSS resources: %s",
-		      (void *)dev, strerror(-ret));
+		      (void *)dev, rte_strerror(-ret));
 		goto err;
 	}
 #ifdef RTE_LIBRTE_MLX4_DEBUG
@@ -319,7 +319,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
 		ERROR("%p: cannot attach flow rules (code %d, \"%s\"),"
 		      " flow error type %d, cause %p, message: %s",
 		      (void *)dev,
-		      -ret, strerror(-ret), error.type, error.cause,
+		      -ret, rte_strerror(-ret), error.type, error.cause,
 		      error.message ? error.message : "(unspecified)");
 		goto err;
 	}
@@ -793,7 +793,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	err = mlx4_init_once();
 	if (err) {
 		ERROR("unable to init PMD global data: %s",
-		      strerror(rte_errno));
+		      rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	MLX4_ASSERT(pci_drv == &mlx4_driver);
@@ -946,7 +946,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_glue->query_port(ctx, port, &port_attr);
 		if (err) {
 			err = ENODEV;
-			ERROR("port query failed: %s", strerror(err));
+			ERROR("port query failed: %s", rte_strerror(err));
 			goto port_error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -963,7 +963,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_fd_set_non_blocking(ctx->async_fd);
 		if (err) {
 			ERROR("cannot make asynchronous FD non-blocking: %s",
-			      strerror(err));
+			      rte_strerror(err));
 			goto port_error;
 		}
 		/* Allocate protection domain. */
@@ -1024,7 +1024,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		err = mlx4_get_mac(priv, &mac.addr_bytes);
 		if (err) {
 			ERROR("cannot get MAC address, is mlx4_en loaded?"
-			      " (error: %s)", strerror(err));
+			      " (error: %s)", rte_strerror(err));
 			goto port_error;
 		}
 		INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index f11c6b4373..d52d2f5511 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -373,7 +373,7 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 
 	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      mode, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -462,7 +462,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 	ERROR("failed to synchronize flow rules after removing MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 }
 
@@ -501,7 +501,7 @@ mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
 	ERROR("failed to synchronize flow rules after adding MAC address"
 	      " at index %d (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
-	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
+	      index, rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -558,7 +558,7 @@ mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list,
 		return 0;
 	ERROR("failed to synchronize flow rules after modifying MC list,"
 	      " (code %d, \"%s\"), flow error type %d, cause %p, message: %s",
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -600,7 +600,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	      " (code %d, \"%s\"), "
 	      " flow error type %d, cause %p, message: %s",
 	      on ? "enabling" : "disabling", vlan_id,
-	      rte_errno, strerror(rte_errno), error.type, error.cause,
+	      rte_errno, rte_strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
 	return ret;
 }
@@ -807,7 +807,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	}
 	(void)wait_to_complete;
 	if (mlx4_ifreq(priv, SIOCGIFFLAGS, &ifr)) {
-		WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno));
+		WARN("ioctl(SIOCGIFFLAGS) failed: %s", rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	memset(&dev_link, 0, sizeof(dev_link));
@@ -816,7 +816,7 @@ mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	ifr.ifr_data = (void *)&edata;
 	if (mlx4_ifreq(priv, SIOCETHTOOL, &ifr)) {
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GSET) failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	link_speed = ethtool_cmd_speed(&edata);
@@ -858,7 +858,7 @@ mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -913,7 +913,7 @@ mlx4_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		ret = rte_errno;
 		WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 		     " failed: %s",
-		     strerror(rte_errno));
+		     rte_strerror(rte_errno));
 		goto out;
 	}
 	ret = 0;
diff --git a/drivers/net/mlx4/mlx4_rxq.c b/drivers/net/mlx4/mlx4_rxq.c
index 781ee256df..d0ec84201e 100644
--- a/drivers/net/mlx4/mlx4_rxq.c
+++ b/drivers/net/mlx4/mlx4_rxq.c
@@ -353,7 +353,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	if (ret) {
 		ERROR("cannot set up range size for RSS context to %u"
 		      " (for %u Rx queues), error: %s",
-		      1 << log2_range, dev->data->nb_rx_queues, strerror(ret));
+		      1 << log2_range, dev->data->nb_rx_queues, rte_strerror(ret));
 		rte_errno = ret;
 		return -ret;
 	}
@@ -431,7 +431,7 @@ mlx4_rss_init(struct mlx4_priv *priv)
 	return 0;
 error:
 	ERROR("cannot initialize common RSS resources (queue %u): %s: %s",
-	      i, msg, strerror(ret));
+	      i, msg, rte_strerror(ret));
 	while (i--) {
 		struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i];
 
@@ -631,7 +631,7 @@ mlx4_rxq_attach(struct rxq *rxq)
 	--rxq->usecnt;
 	rte_errno = ret;
 	ERROR("error while attaching Rx queue %p: %s: %s",
-	      (void *)rxq, msg, strerror(ret));
+	      (void *)rxq, msg, rte_strerror(ret));
 	priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE;
 	return -ret;
 }
@@ -882,13 +882,13 @@ mlx4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 			rte_errno = ENOMEM;
 			ERROR("%p: Rx interrupt completion channel creation"
 			      " failure: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 		if (mlx4_fd_set_non_blocking(rxq->channel->fd) < 0) {
 			ERROR("%p: unable to make Rx interrupt completion"
 			      " channel non-blocking: %s",
-			      (void *)dev, strerror(rte_errno));
+			      (void *)dev, rte_strerror(rte_errno));
 			goto error;
 		}
 	}
diff --git a/drivers/net/mlx4/mlx4_txq.c b/drivers/net/mlx4/mlx4_txq.c
index 0db2e55bef..f08c152d5e 100644
--- a/drivers/net/mlx4/mlx4_txq.c
+++ b/drivers/net/mlx4/mlx4_txq.c
@@ -411,7 +411,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->cq) {
 		rte_errno = ENOMEM;
 		ERROR("%p: CQ creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	qp_init_attr = (struct ibv_qp_init_attr){
@@ -431,7 +431,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (!txq->qp) {
 		rte_errno = errno ? errno : EINVAL;
 		ERROR("%p: QP creation failure: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	txq->max_inline = qp_init_attr.cap.max_inline_data;
@@ -445,7 +445,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_INIT failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -457,7 +457,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTR failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	ret = mlx4_glue->modify_qp
@@ -469,7 +469,7 @@ mlx4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	if (ret) {
 		rte_errno = ret;
 		ERROR("%p: QP state to IBV_QPS_RTS failed: %s",
-		      (void *)dev, strerror(rte_errno));
+		      (void *)dev, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Retrieve device queue information. */
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 33/42] net/mlx5: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (31 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 32/42] net/mlx4: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 34/42] net/qede: " Dengdui Huang
                       ` (10 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/mlx5/hws/mlx5dr_matcher.c     |  2 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c   | 22 +++++++++----------
 drivers/net/mlx5/linux/mlx5_os.c          | 18 ++++++++--------
 drivers/net/mlx5/linux/mlx5_socket.c      | 16 +++++++-------
 drivers/net/mlx5/linux/mlx5_verbs.c       |  8 +++----
 drivers/net/mlx5/mlx5.c                   |  8 +++----
 drivers/net/mlx5/mlx5_devx.c              |  4 ++--
 drivers/net/mlx5/mlx5_mac.c               |  2 +-
 drivers/net/mlx5/mlx5_rxmode.c            |  8 +++----
 drivers/net/mlx5/mlx5_rxq.c               |  4 ++--
 drivers/net/mlx5/mlx5_rxtx.c              |  2 +-
 drivers/net/mlx5/mlx5_stats.c             |  4 ++--
 drivers/net/mlx5/mlx5_testpmd.c           | 26 +++++++++++------------
 drivers/net/mlx5/mlx5_trigger.c           | 12 +++++------
 drivers/net/mlx5/mlx5_vlan.c              |  2 +-
 drivers/net/mlx5/windows/mlx5_ethdev_os.c |  2 +-
 drivers/net/mlx5/windows/mlx5_os.c        | 12 +++++------
 17 files changed, 76 insertions(+), 76 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index dfa2cd435c..063f6b871e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -1516,7 +1516,7 @@ mlx5dr_match_template_create(const struct rte_flow_item items[],
 	if (ret <= 0) {
 		DR_LOG(ERR, "Unable to process items (%s): %s",
 		       error.message ? error.message : "unspecified",
-		       strerror(rte_errno));
+		       rte_strerror(rte_errno));
 		goto free_template;
 	}
 
diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index 5d64984022..c874303722 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -314,7 +314,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -351,7 +351,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 			DRV_LOG(WARNING,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GSET) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -395,7 +395,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCGIFFLAGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	dev_link = (struct rte_eth_link) {
@@ -430,7 +430,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 			DRV_LOG(DEBUG,
 				"port %u ioctl(SIOCETHTOOL,"
 				" ETHTOOL_GLINKSETTINGS) failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return ret;
 		}
 	}
@@ -448,7 +448,7 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 		DRV_LOG(DEBUG,
 			"port %u ioctl(SIOCETHTOOL,"
 			"ETHTOOL_GLINKSETTINGS) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 
@@ -538,7 +538,7 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(DEBUG,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM) failed:"
 			" %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	fc_conf->autoneg = ethpause.autoneg;
@@ -591,7 +591,7 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		DRV_LOG(WARNING,
 			"port %u ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)"
 			" failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	return 0;
@@ -666,7 +666,7 @@ mlx5_link_update_bond(struct rte_eth_dev *dev)
 	ret = mlx5_ifreq_by_ifname(bond->ifname, SIOCGIFFLAGS, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "ifname %s ioctl(SIOCGIFFLAGS) failed: %s",
-			bond->ifname, strerror(rte_errno));
+			bond->ifname, rte_strerror(rte_errno));
 		return;
 	}
 	dev->data->dev_link.link_status =
@@ -1118,7 +1118,7 @@ mlx5_get_module_info(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret) {
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return ret;
 	}
 	modinfo->type = info.type;
@@ -1167,7 +1167,7 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
 	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
 	if (ret)
 		DRV_LOG(WARNING, "port %u ioctl(SIOCETHTOOL) failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	else
 		rte_memcpy(info->data, eeprom->data, info->length);
 	mlx5_free(eeprom);
@@ -1725,7 +1725,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, bond_master, xstats_ctrl->base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	stats_ctrl->imissed = 0;
 free:
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 0a8de88759..3bbc28bd55 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1256,7 +1256,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		err = mlx5_glue->query_port(sh->cdev->ctx, spawn->phys_port,
 					    &port_attr);
 		if (err) {
-			DRV_LOG(ERR, "port query failed: %s", strerror(err));
+			DRV_LOG(ERR, "port query failed: %s", rte_strerror(err));
 			goto error;
 		}
 		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
@@ -1271,7 +1271,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			spawn->phys_port);
 		if (err < 0) {
 			DRV_LOG(INFO, "Failed to get netlink port state: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			err = -rte_errno;
 			goto error;
 		}
@@ -1431,7 +1431,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -1522,7 +1522,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -1568,7 +1568,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -2034,7 +2034,7 @@ mlx5_device_bond_pci_match(const char *ibdev_name,
 					   bond_info->ifname);
 		if (ret)
 			DRV_LOG(ERR, "unable to get bond info: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 		else
 			DRV_LOG(INFO, "PF device %u, bond device %u(%s)",
 				ifindex, bond_info->ifindex, bond_info->ifname);
@@ -2748,7 +2748,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,
 			" encountering an error: %s",
 			owner_pci.domain, owner_pci.bus,
 			owner_pci.devid, owner_pci.function,
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		ret = -rte_errno;
 		/* Roll back. */
 		while (i--) {
@@ -2928,13 +2928,13 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "Unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	ret = mlx5_probe_again_args_validate(cdev, mkvlist);
 	if (ret) {
 		DRV_LOG(ERR, "Probe again parameters are not compatible : %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	if (mlx5_dev_is_pci(cdev->dev))
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 6ce0e59643..cfcbd5a099 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -61,13 +61,13 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	/* Accept the connection from the client. */
 	conn_sock = accept(server_socket, NULL, NULL);
 	if (conn_sock < 0) {
-		DRV_LOG(WARNING, "connection failed: %s", strerror(errno));
+		DRV_LOG(WARNING, "connection failed: %s", rte_strerror(errno));
 		return;
 	}
 	ret = recvmsg(conn_sock, &msg, MSG_WAITALL);
 	if (ret != sizeof(struct mlx5_flow_dump_req)) {
 		DRV_LOG(WARNING, "wrong message received: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 
@@ -138,7 +138,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0)
 		DRV_LOG(WARNING, "failed to send response %s",
-			strerror(errno));
+			rte_strerror(errno));
 error:
 	if (conn_sock >= 0)
 		close(conn_sock);
@@ -167,7 +167,7 @@ mlx5_pmd_socket_init(void)
 	ret = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "Failed to open mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	server_socket = ret;
@@ -183,13 +183,13 @@ mlx5_pmd_socket_init(void)
 	ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun));
 	if (ret < 0) {
 		DRV_LOG(WARNING,
-			"cannot bind mlx5 socket: %s", strerror(errno));
+			"cannot bind mlx5 socket: %s", rte_strerror(errno));
 		goto remove;
 	}
 	ret = listen(server_socket, 0);
 	if (ret < 0) {
 		DRV_LOG(WARNING, "cannot listen on mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	server_intr_handle = mlx5_os_interrupt_handler_create
@@ -197,7 +197,7 @@ mlx5_pmd_socket_init(void)
 		 server_socket, mlx5_pmd_socket_handle, NULL);
 	if (server_intr_handle == NULL) {
 		DRV_LOG(WARNING, "cannot register interrupt handler for mlx5 socket: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto remove;
 	}
 	return 0;
@@ -207,7 +207,7 @@ mlx5_pmd_socket_init(void)
 	claim_zero(close(server_socket));
 	server_socket = -1;
 error:
-	DRV_LOG(ERR, "Cannot initialize socket: %s", strerror(errno));
+	DRV_LOG(ERR, "Cannot initialize socket: %s", rte_strerror(errno));
 	return -errno;
 }
 
diff --git a/drivers/net/mlx5/linux/mlx5_verbs.c b/drivers/net/mlx5/linux/mlx5_verbs.c
index 454bd7c77e..b6d4f31c6d 100644
--- a/drivers/net/mlx5/linux/mlx5_verbs.c
+++ b/drivers/net/mlx5/linux/mlx5_verbs.c
@@ -100,7 +100,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Tx QP state to RESET %s",
-				strerror(errno));
+				rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -111,7 +111,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE | IBV_QP_PORT);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to INIT %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -119,7 +119,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTR %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -127,7 +127,7 @@ mlx5_ibv_modify_qp(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 	ret = mlx5_glue->modify_qp(obj->qp, &mod, IBV_QP_STATE);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Tx QP state to RTS %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index e36fa651a1..8ea53c4d28 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1506,7 +1506,7 @@ mlx5_shared_dev_ctx_args_config(struct mlx5_dev_ctx_shared *sh,
 					  mlx5_dev_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process device arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -1835,7 +1835,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
 	err = mlx5_shared_dev_ctx_args_config(sh, mkvlist, &sh->config);
 	if (err) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	sh->refcnt = 1;
@@ -2833,7 +2833,7 @@ mlx5_port_args_config(struct mlx5_priv *priv, struct mlx5_kvargs_ctrl *mkvlist,
 					  mlx5_port_args_check_handler, config);
 		if (ret) {
 			DRV_LOG(ERR, "Failed to process port arguments: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
@@ -3064,7 +3064,7 @@ mlx5_probe_again_args_validate(struct mlx5_common_device *cdev,
 	ret = mlx5_shared_dev_ctx_args_config(sh, mkvlist, config);
 	if (ret) {
 		DRV_LOG(ERR, "Failed to process device configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		mlx5_free(config);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c
index 8ebe784000..11e6d708e2 100644
--- a/drivers/net/mlx5/mlx5_devx.c
+++ b/drivers/net/mlx5/mlx5_devx.c
@@ -174,7 +174,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to RESET"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
@@ -186,7 +186,7 @@ mlx5_txq_devx_modify(struct mlx5_txq_obj *obj, enum mlx5_txq_modify_type type,
 		ret = mlx5_devx_cmd_modify_sq(obj->sq_obj.sq, &msq_attr);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change the Tx SQ state to READY"
-				" %s", strerror(errno));
+				" %s", rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
index 22a756a52b..f73b7bc394 100644
--- a/drivers/net/mlx5/mlx5_mac.c
+++ b/drivers/net/mlx5/mlx5_mac.c
@@ -100,7 +100,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
 		ret = mlx5_traffic_restart(dev);
 		if (ret)
 			DRV_LOG(ERR, "port %u cannot restart traffic: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 	}
 }
 
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index f44906e1a7..fae684defb 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -44,7 +44,7 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_enable() rollback
@@ -77,7 +77,7 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 
 	/*
 	 * rte_eth_dev_promiscuous_disable() rollback
@@ -117,7 +117,7 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_enable() rollback
@@ -150,7 +150,7 @@ mlx5_allmulticast_disable(struct rte_eth_dev *dev)
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 error:
 	/*
 	 * rte_eth_allmulticast_disable() rollback
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index c6655b7db4..e5ef5632dc 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -488,7 +488,7 @@ mlx5_rx_queue_stop_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RDY2RST);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to RESET:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
@@ -587,7 +587,7 @@ mlx5_rx_queue_start_primary(struct rte_eth_dev *dev, uint16_t idx)
 	ret = priv->obj_ops.rxq_obj_modify(rxq, MLX5_RXQ_MOD_RST2RDY);
 	if (ret) {
 		DRV_LOG(ERR, "Cannot change Rx WQ state to READY:  %s",
-			strerror(errno));
+			rte_strerror(errno));
 		rte_errno = errno;
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index eadadcdffb..fa01a9e658 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -402,7 +402,7 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
 		ret = priv->obj_ops.rxq_obj_modify(rxq, sm->state);
 		if (ret) {
 			DRV_LOG(ERR, "Cannot change Rx WQ state to %u  - %s",
-					sm->state, strerror(errno));
+					sm->state, rte_strerror(errno));
 			rte_errno = errno;
 			return ret;
 		}
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index f4ac58e2f9..ad81d11b48 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -247,7 +247,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	ret = mlx5_os_get_stats_n(dev, bond_master, &stats_n, &stats_n_2nd);
 	if (ret < 0) {
 		DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
-			strerror(-ret));
+			rte_strerror(-ret));
 		return ret;
 	}
 	if (xstats_ctrl->stats_n != stats_n ||
@@ -265,7 +265,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_counters(dev, bond_master, counters);
 	if (ret) {
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		mlx5_free(counters);
 		return ret;
 	}
diff --git a/drivers/net/mlx5/mlx5_testpmd.c b/drivers/net/mlx5/mlx5_testpmd.c
index 1bb5a89559..6cc3cedfa3 100644
--- a/drivers/net/mlx5/mlx5_testpmd.c
+++ b/drivers/net/mlx5/mlx5_testpmd.c
@@ -215,13 +215,13 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	socket_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
 	if (socket_fd < 0) {
 		TESTPMD_LOG(ERR, "Failed to create unix socket: %s\n",
-			    strerror(errno));
+			    rte_strerror(errno));
 		return -1;
 	}
 	rte_strlcpy(un.sun_path, path, sizeof(un.sun_path));
 	if (connect(socket_fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
 		TESTPMD_LOG(ERR, "Failed to connect %s: %s\n", un.sun_path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -232,7 +232,7 @@ mlx5_test_extend_devargs(char *identifier, char *extend)
 	} while (ret < 0 && errno == EINTR);
 	if (ret < 0) {
 		TESTPMD_LOG(ERR, "Failed to send request to (%s): %s\n", path,
-			    strerror(errno));
+			    rte_strerror(errno));
 		close(socket_fd);
 		return -1;
 	}
@@ -431,7 +431,7 @@ static void cmd_port_host_shaper_parsed(void *parsed_result,
 		ret = mlx5_test_set_port_host_shaper(res->port_num, res->fr,
 					   res->rate_num);
 	if (ret < 0)
-		printf("cmd_port_host_shaper error: (%s)\n", strerror(-ret));
+		printf("cmd_port_host_shaper error: (%s)\n", rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_port_host_shaper_mlx5 =
@@ -590,7 +590,7 @@ mlx5_cmd_map_ext_rxq_parsed(void *parsed_result,
 			res->sw_queue_id);
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -663,7 +663,7 @@ mlx5_cmd_unmap_ext_rxq_parsed(void *parsed_result,
 		fprintf(stderr, "function not implemented or supported\n");
 		break;
 	default:
-		fprintf(stderr, "programming error: (%s)\n", strerror(-ret));
+		fprintf(stderr, "programming error: (%s)\n", rte_strerror(-ret));
 	}
 }
 
@@ -746,7 +746,7 @@ mlx5_cmd_set_flow_engine_mode_parsed(void *parsed_result,
 	if (ret < 0)
 		fprintf(stderr, "Fail to set flow_engine to %s mode with flag 0x%x, error %s\n",
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag,
-			strerror(-ret));
+			rte_strerror(-ret));
 	else
 		TESTPMD_LOG(DEBUG, "Set %d ports flow_engine to %s mode with flag 0x%x\n", ret,
 			mode == RTE_PMD_MLX5_FLOW_ENGINE_MODE_ACTIVE ? "active" : "standby", flag);
@@ -1108,7 +1108,7 @@ mlx5_cmd_apply_tlv_options_parsed(void *parsed_result,
 	if (handle == NULL) {
 		fprintf(stderr,
 			"Fail to create GENEVE TLV parser, nb_option=%u: %s\n",
-			tlv_mng.nb_options, strerror(rte_errno));
+			tlv_mng.nb_options, rte_strerror(rte_errno));
 		return;
 	}
 
@@ -1177,7 +1177,7 @@ mlx5_cmd_destroy_tlv_options_parsed(void *parsed_result,
 	ret = rte_pmd_mlx5_destroy_geneve_tlv_parser(port->geneve_tlv_parser_handle);
 	if (ret < 0) {
 		fprintf(stderr, "Fail to destroy GENEVE TLV parser: %s\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 		return;
 	}
 
@@ -1259,10 +1259,10 @@ mlx5_cmd_dump_sq_context_options_parsed(void *parsed_result,
 		fprintf(stderr, "invalid port_id %u\n", res->port_id);
 		break;
 	case -EIO:
-		fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno));
+		fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno));
 		break;
 	default:
-		fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", strerror(rte_errno));
+		fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", rte_strerror(rte_errno));
 	}
 }
 
@@ -1341,10 +1341,10 @@ mlx5_cmd_dump_rq_context_options_parsed(void *parsed_result,
 		fprintf(stderr, "invalid port_id %u\n", res->port_id);
 		break;
 	case -EIO:
-		fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno));
+		fprintf(stderr, "File Access Error (%s)\n", rte_strerror(rte_errno));
 		break;
 	default:
-		fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", strerror(rte_errno));
+		fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", rte_strerror(rte_errno));
 	}
 }
 
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index bf836c92fc..8ac91e6c71 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -1201,14 +1201,14 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 		ret = mlx5_dev_configure_rss_reta(dev);
 		if (ret) {
 			DRV_LOG(ERR, "port %u reta config failed: %s",
-				dev->data->port_id, strerror(rte_errno));
+				dev->data->port_id, rte_strerror(rte_errno));
 			return -rte_errno;
 		}
 	}
 	ret = mlx5_txpp_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx packet pacing init failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_devx_obj_ops_en(priv->sh) &&
@@ -1220,7 +1220,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_txq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Tx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (priv->config.std_delay_drop || priv->config.hp_delay_drop) {
@@ -1244,7 +1244,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_rxq_start(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u Rx queue allocation failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/*
@@ -1254,7 +1254,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_hairpin_auto_bind(dev);
 	if (ret) {
 		DRV_LOG(ERR, "port %u hairpin auto binding failed: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	/* Set started flag here for the following steps like control flow. */
@@ -1307,7 +1307,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	ret = mlx5_flow_start_default(dev);
 	if (ret) {
 		DRV_LOG(DEBUG, "port %u failed to start default actions: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		goto error;
 	}
 	if (mlx5_dev_ctx_shared_mempool_subscribe(dev) != 0) {
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index e7161b66fe..e2914844c6 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -118,7 +118,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
 	ret = priv->obj_ops.rxq_obj_modify_vlan_strip(rxq, on);
 	if (ret) {
 		DRV_LOG(ERR, "Port %u failed to modify object stripping mode:"
-			" %s", dev->data->port_id, strerror(rte_errno));
+			" %s", dev->data->port_id, rte_strerror(rte_errno));
 		return;
 	}
 	/* Update related bits in RX queue. */
diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
index 49f750be68..cd0a02d76b 100644
--- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
@@ -221,7 +221,7 @@ mlx5_os_stats_init(struct rte_eth_dev *dev)
 	ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 	stats_ctrl->imissed = 0;
 }
 
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 0ebd233595..3d3419965a 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -382,7 +382,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	err = mlx5_glue->devx_init_showdown_event(sh->cdev->ctx);
 	if (err) {
 		DRV_LOG(ERR, "failed to init showdown event: %s",
-			strerror(errno));
+			rte_strerror(errno));
 		goto error;
 	}
 	/* Allocate private eth device data. */
@@ -430,7 +430,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		if (err) {
 			err = rte_errno;
 			DRV_LOG(ERR, "unable to allocate switch domain: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto error;
 		}
 		own_domain_id = 1;
@@ -440,7 +440,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	if (err) {
 		err = rte_errno;
 		DRV_LOG(ERR, "Failed to process port configure: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		goto error;
 	}
 	eth_dev = rte_eth_dev_allocate(name);
@@ -483,7 +483,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s).",
-			eth_dev->data->port_id, strerror(rte_errno));
+			eth_dev->data->port_id, rte_strerror(rte_errno));
 		err = ENODEV;
 		goto error;
 	}
@@ -737,7 +737,7 @@ mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
 		DRV_LOG(ERR,
 			"port %u cannot get MAC address, is mlx5_en"
 			" loaded? (errno: %s)",
-			dev->data->port_id, strerror(rte_errno));
+			dev->data->port_id, rte_strerror(rte_errno));
 		return rte_errno;
 	}
 	if (!rte_is_same_ether_addr(&lmac, mac)) {
@@ -856,7 +856,7 @@ mlx5_os_net_probe(struct mlx5_common_device *cdev,
 	ret = mlx5_init_once();
 	if (ret) {
 		DRV_LOG(ERR, "unable to init PMD global data: %s",
-			strerror(rte_errno));
+			rte_strerror(rte_errno));
 		return -rte_errno;
 	}
 	spawn.eth_dev = mlx5_dev_spawn(cdev->dev, &spawn, mkvlist);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 34/42] net/qede: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (32 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 33/42] net/mlx5: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 35/42] net/sfc: " Dengdui Huang
                       ` (9 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/qede/qede_regs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/qede/qede_regs.c b/drivers/net/qede/qede_regs.c
index d2ea1c9108..3aa31a42c2 100644
--- a/drivers/net/qede/qede_regs.c
+++ b/drivers/net/qede/qede_regs.c
@@ -221,7 +221,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (!f) {
 		fprintf(stderr, "Can't open file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		return 1;
 	}
 	bytes = fwrite(dump, 1, len, f);
@@ -234,7 +234,7 @@ qede_write_fwdump(const char *dump_file, void *dump, size_t len)
 
 	if (fclose(f)) {
 		fprintf(stderr, "Can't close file %s: %s\n",
-			dump_file, strerror(errno));
+			dump_file, rte_strerror(errno));
 		err = 1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 35/42] net/sfc: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (33 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 34/42] net/qede: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 36/42] net/tap: " Dengdui Huang
                       ` (8 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/sfc/sfc_flow.c        |  2 +-
 drivers/net/sfc/sfc_flow_tunnel.c |  2 +-
 drivers/net/sfc/sfc_mae.c         | 58 +++++++++++++++----------------
 3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c
index 1006243539..db3a2fbc8f 100644
--- a/drivers/net/sfc/sfc_flow.c
+++ b/drivers/net/sfc/sfc_flow.c
@@ -1397,7 +1397,7 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa,
 		rc = item->parse(pattern, parse_ctx, error);
 		if (rc != 0) {
 			sfc_err(sa, "failed to parse item %s: %s",
-				item->name, strerror(-rc));
+				item->name, rte_strerror(-rc));
 			return rc;
 		}
 
diff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c
index 889fee569a..898d00dd6d 100644
--- a/drivers/net/sfc/sfc_flow_tunnel.c
+++ b/drivers/net/sfc/sfc_flow_tunnel.c
@@ -120,7 +120,7 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa,
 		if (rc != 0) {
 			/* The loop above might have spotted wrong actions. */
 			sfc_err(sa, "FT: TUNNEL: invalid actions: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			goto fail;
 		}
 
diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index b0e8b02b41..2813189f67 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -428,7 +428,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 					       &fw_rsrc->rule_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable outer_rule=%p: %s",
-				rule, strerror(rc));
+				rule, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -445,7 +445,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa,
 			fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't match on outer rule ID: %s", strerror(rc));
+		sfc_err(sa, "can't match on outer rule ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -484,7 +484,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 						  &invalid_rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "cannot restore match on invalid outer rule ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 		return;
 	}
 
@@ -503,7 +503,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable outer_rule=%p with OR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -616,7 +616,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 					    &fw_rsrc->mac_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable mac_addr=%p: %s",
-				mac_addr, strerror(rc));
+				mac_addr, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -642,7 +642,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa,
 		}
 
 		sfc_err(sa, "cannot fill in MAC address entry ID: %s",
-			strerror(rc));
+			rte_strerror(rc));
 
 		return rc;
 	}
@@ -685,7 +685,7 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa,
 				mac_addr, fw_rsrc->mac_id.id);
 		} else {
 			sfc_err(sa, "failed to disable mac_addr=%p with MAC_ID=0x%08x: %s",
-				mac_addr, fw_rsrc->mac_id.id, strerror(rc));
+				mac_addr, fw_rsrc->mac_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -818,7 +818,7 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa,
 						  bounce_eh->size);
 		if (ret != 0) {
 			sfc_err(sa, "failed to update encap_header=%p: %s",
-				encap_header, strerror(ret));
+				encap_header, rte_strerror(ret));
 			rte_free(buf);
 			return ret;
 		}
@@ -859,7 +859,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 						&fw_rsrc->eh_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable encap_header=%p: %s",
-				encap_header, strerror(rc));
+				encap_header, rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -873,7 +873,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa,
 			fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 		}
 
-		sfc_err(sa, "can't fill in encap. header ID: %s", strerror(rc));
+		sfc_err(sa, "can't fill in encap. header ID: %s", rte_strerror(rc));
 
 		return rc;
 	}
@@ -916,7 +916,7 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa,
 				encap_header, fw_rsrc->eh_id.id);
 		} else {
 			sfc_err(sa, "failed to disable encap_header=%p with EH_ID=0x%08x: %s",
-				encap_header, fw_rsrc->eh_id.id, strerror(rc));
+				encap_header, fw_rsrc->eh_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID;
 	}
@@ -1023,7 +1023,7 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter,
 			}
 
 			sfc_err(sa, "cannot fill in counter ID: %s",
-				strerror(rc));
+				rte_strerror(rc));
 			return rc;
 		}
 	}
@@ -1067,7 +1067,7 @@ sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter)
 				counter, counter->type, counter_id);
 		} else {
 			sfc_err(sa, "failed to disable counter=%p with COUNTER_ID=0x%x-#%u: %s",
-				counter, counter->type, counter_id, strerror(rc));
+				counter, counter->type, counter_id, rte_strerror(rc));
 		}
 
 		fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -1241,7 +1241,7 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa,
 					      &fw_rsrc->aset_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set=%p: %s",
-				action_set, strerror(rc));
+				action_set, rte_strerror(rc));
 
 			sfc_mae_encap_header_disable(sa, encap_header);
 			sfc_mae_mac_addr_disable(sa, src_mac_addr);
@@ -1289,7 +1289,7 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa,
 				action_set, fw_rsrc->aset_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_set=%p with AS_ID=0x%08x: %s",
-				action_set, fw_rsrc->aset_id.id, strerror(rc));
+				action_set, fw_rsrc->aset_id.id, rte_strerror(rc));
 		}
 		fw_rsrc->aset_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1445,7 +1445,7 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa,
 						&fw_rsrc->aset_list_id);
 		if (rc != 0) {
 			sfc_err(sa, "failed to enable action_set_list=%p: %s",
-				action_set_list, strerror(rc));
+				action_set_list, rte_strerror(rc));
 			goto fail_action_set_list_alloc;
 		}
 
@@ -1498,7 +1498,7 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa,
 		} else {
 			sfc_err(sa, "failed to disable action_set_list=%p with ASL_ID=0x%08x: %s",
 				action_set_list, fw_rsrc->aset_list_id.id,
-				strerror(rc));
+				rte_strerror(rc));
 		}
 		fw_rsrc->aset_list_id.id = EFX_MAE_RSRC_ID_INVALID;
 
@@ -1708,7 +1708,7 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa,
 					as_idp, &fw_rsrc->rule_id);
 	if (rc != 0) {
 		sfc_err(sa, "failed to enable action_rule=%p: %s",
-			rule, strerror(rc));
+			rule, rte_strerror(rc));
 		goto fail_action_rule_insert;
 	}
 
@@ -1759,7 +1759,7 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa,
 				rule, fw_rsrc->rule_id.id);
 		} else {
 			sfc_err(sa, "failed to disable action_rule=%p with AR_ID=0x%08x: %s",
-				rule, fw_rsrc->rule_id.id, strerror(rc));
+				rule, fw_rsrc->rule_id.id, rte_strerror(rc));
 		}
 
 		fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID;
@@ -4396,7 +4396,7 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa,
 
 	rc = efx_mae_action_set_populate_mark(spec, conf->id);
 	if (rc != 0)
-		sfc_err(sa, "failed to request action MARK: %s", strerror(rc));
+		sfc_err(sa, "failed to request action MARK: %s", rte_strerror(rc));
 
 	return rc;
 }
@@ -4570,14 +4570,14 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa,
 	if (rc != 0) {
 		sfc_err(sa, "failed to convert PF %u VF %d to m-port: %s",
 			encp->enc_pf, (vf != EFX_PCI_VF_INVALID) ? (int)vf : -1,
-			strerror(rc));
+			rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4606,14 +4606,14 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,
 					     port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			port_id, strerror(rc));
+			port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4632,14 +4632,14 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa,
 					     conf->port_id, type_mask, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4658,14 +4658,14 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa,
 					     conf->port_id, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s",
-			conf->port_id, strerror(rc));
+			conf->port_id, rte_strerror(rc));
 		return rc;
 	}
 
 	rc = efx_mae_action_set_populate_deliver(spec, &mport);
 	if (rc != 0) {
 		sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s",
-			mport.sel, strerror(rc));
+			mport.sel, rte_strerror(rc));
 	}
 
 	return rc;
@@ -4758,7 +4758,7 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa,
 
 			if (action_name != NULL) {
 				sfc_err(sa, "action %s was rejected: %s",
-					action_name, strerror(rc));
+					action_name, rte_strerror(rc));
 			}
 		}
 		rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION,
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 36/42] net/tap: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (34 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 35/42] net/sfc: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 37/42] net/vhost: " Dengdui Huang
                       ` (7 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/tap/rte_eth_tap.c | 28 ++++++++++++++--------------
 drivers/net/tap/tap_flow.c    | 14 +++++++-------
 drivers/net/tap/tap_netlink.c |  5 +++--
 drivers/net/tap/tap_tcmsgs.c  |  6 ++++--
 4 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 36b06b3ac5..629f577f7b 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -198,7 +198,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	/* Set the TUN/TAP configuration and set the name if needed */
 	if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) {
 		TAP_LOG(WARNING, "Unable to set TUNSETIFF for %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -206,7 +206,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (persistent && ioctl(fd, TUNSETPERSIST, 1) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set persist %s: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -226,7 +226,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		if (ioctl(fd, TUNSETQUEUE, (void *)&ifr) < 0) {
 			TAP_LOG(WARNING,
 				"Unable to detach keep-alive queue for %s: %s",
-				ifr.ifr_name, strerror(errno));
+				ifr.ifr_name, rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -234,7 +234,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	flags = fcntl(fd, F_GETFL);
 	if (flags == -1) {
 		TAP_LOG(WARNING, "Unable to get %s current flags: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -243,7 +243,7 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 	if (fcntl(fd, F_SETFL, flags) < 0) {
 		TAP_LOG(WARNING,
 			"Unable to set %s to nonblocking: %s",
-			ifr.ifr_name, strerror(errno));
+			ifr.ifr_name, rte_strerror(errno));
 		goto error;
 	}
 
@@ -296,18 +296,18 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
 		/* Enable signal on file descriptor */
 		if (fcntl(fd, F_SETSIG, signo) < 0) {
 			TAP_LOG(WARNING, "Unable to set signo %d for fd %d: %s",
-				signo, fd, strerror(errno));
+				signo, fd, rte_strerror(errno));
 			goto error;
 		}
 		if (fcntl(fd, F_SETFL, flags | O_ASYNC) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl flags: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 
 		if (fcntl(fd, F_SETOWN, getpid()) < 0) {
 			TAP_LOG(WARNING, "Unable to set fcntl owner: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			goto error;
 		}
 	}
@@ -822,7 +822,7 @@ tap_ioctl(struct pmd_internals *pmd, unsigned long request,
 
 error:
 	TAP_LOG(DEBUG, "%s(%s) failed: %s(%d)", ifr->ifr_name,
-		tap_ioctl_req2str(request), strerror(errno), errno);
+		tap_ioctl_req2str(request), rte_strerror(errno), errno);
 	return -errno;
 }
 
@@ -1946,7 +1946,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 	if (pmd->ioctl_sock == -1) {
 		TAP_LOG(ERR,
 			"%s Unable to get a socket for management: %s",
-			tuntap_name, strerror(errno));
+			tuntap_name, rte_strerror(errno));
 		goto error_exit;
 	}
 
@@ -2109,7 +2109,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 
 disable_rte_flow:
 	TAP_LOG(ERR, " Disabling rte flow support: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	if (strlen(remote_iface)) {
 		TAP_LOG(ERR, "Remote feature requires flow support.");
 		goto error_exit;
@@ -2120,7 +2120,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name,
 #ifdef HAVE_TCA_FLOWER
 error_remote:
 	TAP_LOG(ERR, " Can't set up remote feature: %s(%d)",
-		strerror(errno), errno);
+		rte_strerror(errno), errno);
 	tap_flow_implicit_flush(pmd, NULL);
 #endif
 
@@ -2454,7 +2454,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 			ret = rte_mp_action_register(TAP_MP_REQ_START_RXTX, tap_mp_req_start_rxtx);
 			if (ret < 0 && rte_errno != ENOTSUP) {
 				TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-					strerror(rte_errno));
+					rte_strerror(rte_errno));
 				return -1;
 			}
 		}
@@ -2514,7 +2514,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev)
 		ret = rte_mp_action_register(TAP_MP_KEY, tap_mp_sync_queues);
 		if (ret < 0 && rte_errno != ENOTSUP) {
 			TAP_LOG(ERR, "tap: Failed to register IPC callback: %s",
-				strerror(rte_errno));
+				rte_strerror(rte_errno));
 			goto leave;
 		}
 	}
diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c
index 51ec07eb5a..0c9a643492 100644
--- a/drivers/net/tap/tap_flow.c
+++ b/drivers/net/tap/tap_flow.c
@@ -1317,7 +1317,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 	if (err < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(error, EEXIST, RTE_FLOW_ERROR_TYPE_HANDLE,
 				   NULL,
 				   "overlapping rules or Kernel too old for flower support");
@@ -1362,7 +1362,7 @@ tap_flow_create(struct rte_eth_dev *dev,
 		if (err < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule creation (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL,
@@ -1416,7 +1416,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 	if (ret < 0) {
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule deletion (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"couldn't receive kernel ack to our request");
@@ -1440,7 +1440,7 @@ tap_flow_destroy_pmd(struct pmd_internals *pmd,
 		if (ret < 0) {
 			TAP_LOG(ERR,
 				"Kernel refused TC filter rule deletion (%d): %s",
-				errno, strerror(errno));
+				errno, rte_strerror(errno));
 			rte_flow_error_set(
 				error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,
 				NULL, "Failure trying to receive nl ack");
@@ -1664,7 +1664,7 @@ int tap_flow_implicit_create(struct pmd_internals *pmd,
 			goto success;
 		TAP_LOG(ERR,
 			"Kernel refused TC filter rule creation (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		goto fail;
 	}
 	LIST_INSERT_HEAD(&pmd->implicit_flows, remote_flow, next);
@@ -1754,7 +1754,7 @@ static int rss_enable(struct pmd_internals *pmd, struct rte_flow_error *error)
 	/* Load the BPF program (defined in tap_bpf.h from skeleton) */
 	pmd->rss = tap_rss__open_and_load();
 	if (pmd->rss == NULL) {
-		TAP_LOG(ERR, "Failed to load BPF object: %s", strerror(errno));
+		TAP_LOG(ERR, "Failed to load BPF object: %s", rte_strerror(errno));
 		rte_flow_error_set(error, errno, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"BPF object could not be loaded");
 		return -errno;
@@ -1885,7 +1885,7 @@ static int rss_add_actions(struct rte_flow *flow, struct pmd_internals *pmd,
 	if (err) {
 		TAP_LOG(ERR,
 			"Failed to update BPF map entry %#x (%d): %s",
-			handle,  errno, strerror(errno));
+			handle,  errno, rte_strerror(errno));
 		rte_flow_error_set(
 			error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 			"Kernel too old or not configured "
diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c
index 35c491ac37..6011f6c61d 100644
--- a/drivers/net/tap/tap_netlink.c
+++ b/drivers/net/tap/tap_netlink.c
@@ -14,6 +14,7 @@
 #include <rte_malloc.h>
 #include <tap_netlink.h>
 #include <rte_random.h>
+#include <rte_errno.h>
 
 #include "tap_log.h"
 
@@ -98,7 +99,7 @@ tap_nl_final(int nlsk_fd)
 {
 	if (close(nlsk_fd)) {
 		TAP_LOG(ERR, "Failed to close netlink socket: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return 0;
@@ -130,7 +131,7 @@ tap_nl_send(int nlsk_fd, struct nlmsghdr *nh)
 			goto retry;
 
 		TAP_LOG(ERR, "Failed to send netlink message: %s (%d)",
-			strerror(errno), errno);
+			rte_strerror(errno), errno);
 		return -1;
 	}
 	return send_bytes;
diff --git a/drivers/net/tap/tap_tcmsgs.c b/drivers/net/tap/tap_tcmsgs.c
index a3aae3c814..28d4809360 100644
--- a/drivers/net/tap/tap_tcmsgs.c
+++ b/drivers/net/tap/tap_tcmsgs.c
@@ -8,6 +8,8 @@
 #include <net/if.h>
 #include <string.h>
 
+#include <rte_errno.h>
+
 #include <rte_log.h>
 #include <tap_tcmsgs.h>
 #include "tap_log.h"
@@ -263,7 +265,7 @@ qdisc_create_multiq(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_multiq(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add multiq qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -289,7 +291,7 @@ qdisc_create_ingress(int nlsk_fd, unsigned int ifindex)
 	err = qdisc_add_ingress(nlsk_fd, ifindex);
 	if (err < 0 && errno != -EEXIST) {
 		TAP_LOG(ERR, "Could not add ingress qdisc (%d): %s",
-			errno, strerror(errno));
+			errno, rte_strerror(errno));
 		return -1;
 	}
 	return 0;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 37/42] net/vhost: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (35 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 36/42] net/tap: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 38/42] net/virtio: " Dengdui Huang
                       ` (6 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 87c05caccd..d1bb124a69 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -568,7 +568,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd >= 0 && vq->kickfd != vring.kickfd) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 			VHOST_LOG_LINE(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s",
-				vq->kickfd, rxq_idx, strerror(errno));
+				vq->kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			VHOST_LOG_LINE(DEBUG, "Unregistered %d from rxq-%d epoll",
 				vq->kickfd, rxq_idx);
@@ -580,7 +580,7 @@ eth_vhost_update_intr(struct rte_eth_dev *eth_dev, uint16_t rxq_idx)
 	if (vq->kickfd != vring.kickfd && vring.kickfd >= 0) {
 		if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_ADD, vring.kickfd, &vq->ev) < 0) {
 			VHOST_LOG_LINE(ERR, "Failed to register %d in rxq-%d epoll: %s",
-				vring.kickfd, rxq_idx, strerror(errno));
+				vring.kickfd, rxq_idx, rte_strerror(errno));
 		} else {
 			vq->kickfd = vring.kickfd;
 			VHOST_LOG_LINE(DEBUG, "Registered %d in rxq-%d epoll",
@@ -731,7 +731,7 @@ eth_vhost_unconfigure_intr(struct rte_eth_dev *eth_dev)
 		if (vq->kickfd >= 0) {
 			if (epoll_ctl(vq->ev.data.fd, EPOLL_CTL_DEL, vq->kickfd, &vq->ev) < 0) {
 				VHOST_LOG_LINE(DEBUG, "Failed to unregister %d from rxq-%d epoll: %s",
-					vq->kickfd, i, strerror(errno));
+					vq->kickfd, i, rte_strerror(errno));
 			} else {
 				VHOST_LOG_LINE(DEBUG, "Unregistered %d from rxq-%d epoll",
 					vq->kickfd, i);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 38/42] net/virtio: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (36 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 37/42] net/vhost: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 39/42] raw/ifpga: " Dengdui Huang
                       ` (5 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel.c |  8 +++---
 .../net/virtio/virtio_user/vhost_kernel_tap.c | 25 ++++++++++---------
 drivers/net/virtio/virtio_user/vhost_user.c   | 20 +++++++--------
 drivers/net/virtio/virtio_user/vhost_vdpa.c   | 12 ++++-----
 .../net/virtio/virtio_user/virtio_user_dev.c  |  8 +++---
 drivers/net/virtio/virtio_user_ethdev.c       |  6 ++---
 6 files changed, 40 insertions(+), 39 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c
index e42bb35935..b1dec119fc 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c
@@ -92,7 +92,7 @@ vhost_kernel_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-kernel ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -428,7 +428,7 @@ vhost_kernel_setup(struct virtio_user_dev *dev)
 	for (i = 0; i < dev->max_queue_pairs; ++i) {
 		vhostfd = open(dev->path, O_RDWR);
 		if (vhostfd < 0) {
-			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, strerror(errno));
+			PMD_DRV_LOG(ERR, "fail to open %s, %s", dev->path, rte_strerror(errno));
 			goto err_tapfds;
 		}
 		data->vhostfds[i] = vhostfd;
@@ -511,14 +511,14 @@ vhost_kernel_set_backend(int vhostfd, int tapfd)
 	f.index = 0;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	f.index = 1;
 	if (ioctl(vhostfd, VHOST_NET_SET_BACKEND, &f) < 0) {
 		PMD_DRV_LOG(ERR, "VHOST_NET_SET_BACKEND fails, %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
index 611e2e25ec..4542ccbf04 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -13,6 +13,7 @@
 #include <limits.h>
 
 #include <rte_ether.h>
+#include <rte_errno.h>
 
 #include "vhost_kernel_tap.h"
 #include "../virtio_logs.h"
@@ -27,12 +28,12 @@ tap_support_features(unsigned int *tap_features)
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
 		PMD_DRV_LOG(ERR, "fail to open %s: %s",
-			    PATH_NET_TUN, strerror(errno));
+			    PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNGETFEATURES, tap_features) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETFEATURES failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -49,11 +50,11 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 
 	tapfd = open(PATH_NET_TUN, O_RDWR);
 	if (tapfd < 0) {
-		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, strerror(errno));
+		PMD_DRV_LOG(ERR, "fail to open %s: %s", PATH_NET_TUN, rte_strerror(errno));
 		return -1;
 	}
 	if (fcntl(tapfd, F_SETFL, O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl tapfd failed: %s", rte_strerror(errno));
 		close(tapfd);
 		return -1;
 	}
@@ -68,12 +69,12 @@ tap_open(const char *ifname, unsigned int r_flags, bool multi_queue)
 		if (multi_queue) {
 			PMD_DRV_LOG(DEBUG,
 				"TUNSETIFF failed (will retry without IFF_MULTI_QUEUE): %s",
-				strerror(errno));
+				rte_strerror(errno));
 			multi_queue = false;
 			goto retry_mono_q;
 		}
 
-		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", rte_strerror(errno));
 		close(tapfd);
 		tapfd = -1;
 	}
@@ -88,7 +89,7 @@ tap_get_name(int tapfd, char **name)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	ret = asprintf(name, "%s", ifr.ifr_name);
@@ -104,7 +105,7 @@ tap_get_flags(int tapfd, unsigned int *tap_flags)
 
 	memset(&ifr, 0, sizeof(ifr));
 	if (ioctl(tapfd, TUNGETIFF, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNGETIFF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	*tap_flags = ifr.ifr_flags;
@@ -120,7 +121,7 @@ tap_set_mac(int tapfd, uint8_t *mac)
 	ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
 	memcpy(ifr.ifr_hwaddr.sa_data, mac, RTE_ETHER_ADDR_LEN);
 	if (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) {
-		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "SIOCSIFHWADDR failed: %s", rte_strerror(errno));
 		return -1;
 	}
 	return 0;
@@ -155,7 +156,7 @@ vhost_kernel_tap_set_offload(int fd, uint64_t features)
 		offload &= ~TUN_F_UFO;
 		if (ioctl(fd, TUNSETOFFLOAD, offload) != 0) {
 			PMD_DRV_LOG(ERR, "TUNSETOFFLOAD ioctl() failed: %s",
-				strerror(errno));
+				rte_strerror(errno));
 			return -1;
 		}
 	}
@@ -175,12 +176,12 @@ vhost_kernel_tap_setup(int tapfd, int hdr_size, uint64_t features)
 	 * max_mem_regions, supported in newer version linux kernel
 	 */
 	if (ioctl(tapfd, TUNSETVNETHDRSZ, &hdr_size) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETVNETHDRSZ failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
 	if (ioctl(tapfd, TUNSETSNDBUF, &sndbuf) < 0) {
-		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "TUNSETSNDBUF failed: %s", rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c
index c10252506b..d3742c6c62 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -136,7 +136,7 @@ vhost_user_write(int fd, struct vhost_user_msg *msg, int *fds, int fd_num)
 	} while (r < 0 && errno == EINTR);
 
 	if (r < 0)
-		PMD_DRV_LOG(ERR, "Failed to send msg: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to send msg: %s", rte_strerror(errno));
 
 	return r;
 }
@@ -149,7 +149,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 
 	ret = recv(fd, (void *)msg, sz_hdr, 0);
 	if (ret < 0) {
-		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "Failed to recv msg header: %s", rte_strerror(errno));
 		return -1;
 	} else if (ret < sz_hdr) {
 		PMD_DRV_LOG(ERR, "Failed to recv msg hdr: %d instead of %d.",
@@ -175,7 +175,7 @@ vhost_user_read(int fd, struct vhost_user_msg *msg)
 	if (sz_payload) {
 		ret = recv(fd, (void *)((char *)msg + sz_hdr), sz_payload, 0);
 		if (ret < 0) {
-			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %s", rte_strerror(errno));
 			return -1;
 		} else if (ret < sz_payload) {
 			PMD_DRV_LOG(ERR, "Failed to recv msg payload: %d instead of %u.",
@@ -750,7 +750,7 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	ret = bind(fd, (struct sockaddr *)un, sizeof(*un));
 	if (ret < 0) {
 		PMD_DRV_LOG(ERR, "failed to bind to %s: %s; remove it and try again",
-			    dev->path, strerror(errno));
+			    dev->path, rte_strerror(errno));
 		return -1;
 	}
 	ret = listen(fd, MAX_VIRTIO_USER_BACKLOG);
@@ -761,13 +761,13 @@ vhost_user_start_server(struct virtio_user_dev *dev, struct sockaddr_un *un)
 	data->vhostfd = accept(fd, NULL, NULL);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to accept initial client connection (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
 	flag = fcntl(fd, F_GETFL);
 	if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) {
-		PMD_DRV_LOG(ERR, "fcntl failed, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "fcntl failed, %s", rte_strerror(errno));
 		return -1;
 	}
 
@@ -835,15 +835,15 @@ vhost_user_setup(struct virtio_user_dev *dev)
 
 	fd = socket(AF_UNIX, SOCK_STREAM, 0);
 	if (fd < 0) {
-		PMD_DRV_LOG(ERR, "socket() error, %s", strerror(errno));
+		PMD_DRV_LOG(ERR, "socket() error, %s", rte_strerror(errno));
 		goto err_data;
 	}
 
 	flag = fcntl(fd, F_GETFD);
 	if (flag == -1)
-		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl get fd failed, %s", rte_strerror(errno));
 	else if (fcntl(fd, F_SETFD, flag | FD_CLOEXEC) < 0)
-		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", strerror(errno));
+		PMD_DRV_LOG(WARNING, "fcntl set fd failed, %s", rte_strerror(errno));
 
 	memset(&un, 0, sizeof(un));
 	un.sun_family = AF_UNIX;
@@ -857,7 +857,7 @@ vhost_user_setup(struct virtio_user_dev *dev)
 		}
 	} else {
 		if (connect(fd, (struct sockaddr *)&un, sizeof(un)) < 0) {
-			PMD_DRV_LOG(ERR, "connect error, %s", strerror(errno));
+			PMD_DRV_LOG(ERR, "connect error, %s", rte_strerror(errno));
 			goto err_socket;
 		}
 		data->vhostfd = fd;
diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c
index bc3e2a9af5..f8c883ee64 100644
--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
@@ -93,7 +93,7 @@ vhost_vdpa_ioctl(int fd, uint64_t request, void *arg)
 	ret = ioctl(fd, request, arg);
 	if (ret) {
 		PMD_DRV_LOG(ERR, "Vhost-vDPA ioctl %"PRIu64" failed (%s)",
-				request, strerror(errno));
+				request, rte_strerror(errno));
 		return -1;
 	}
 
@@ -187,7 +187,7 @@ vhost_vdpa_iotlb_batch_begin(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch begin (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -213,7 +213,7 @@ vhost_vdpa_iotlb_batch_end(struct virtio_user_dev *dev)
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB batch end (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -244,7 +244,7 @@ vhost_vdpa_dma_map(struct virtio_user_dev *dev, void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB update (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -273,7 +273,7 @@ vhost_vdpa_dma_unmap(struct virtio_user_dev *dev, __rte_unused void *addr,
 
 	if (write(data->vhostfd, &msg, sizeof(msg)) != sizeof(msg)) {
 		PMD_DRV_LOG(ERR, "Failed to send IOTLB invalidate (%s)",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -531,7 +531,7 @@ vhost_vdpa_setup(struct virtio_user_dev *dev)
 	data->vhostfd = open(dev->path, O_RDWR);
 	if (data->vhostfd < 0) {
 		PMD_DRV_LOG(ERR, "Failed to open %s: %s",
-				dev->path, strerror(errno));
+				dev->path, rte_strerror(errno));
 		free(data);
 		return -1;
 	}
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 2997d2bd26..33389c702e 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -60,13 +60,13 @@ virtio_user_init_notify_queue(struct virtio_user_dev *dev, uint32_t queue_sel)
 	dev->callfds[queue_sel] = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 	if (dev->callfds[queue_sel] < 0) {
 		PMD_DRV_LOG(ERR, "(%s) Failed to setup callfd for queue %u: %s",
-				dev->path, queue_sel, strerror(errno));
+				dev->path, queue_sel, rte_strerror(errno));
 		return -1;
 	}
 	dev->kickfds[queue_sel] = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
 	if (dev->kickfds[queue_sel] < 0) {
 		PMD_DRV_LOG(ERR, "(%s) Failed to setup kickfd for queue %u: %s",
-				dev->path, queue_sel, strerror(errno));
+				dev->path, queue_sel, rte_strerror(errno));
 		return -1;
 	}
 
@@ -1113,7 +1113,7 @@ virtio_user_control_queue_notify(struct virtqueue *vq, void *cookie)
 	if (!dev->notify_area) {
 		if (write(dev->kickfds[vq->vq_queue_index], &notify_data, sizeof(notify_data)) < 0)
 			PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-				    strerror(errno));
+				    rte_strerror(errno));
 		return;
 	} else if (!virtio_with_feature(&dev->hw, VIRTIO_F_NOTIFICATION_DATA)) {
 		rte_write16(vq->vq_queue_index, vq->notify_addr);
@@ -1358,7 +1358,7 @@ virtio_user_dev_server_reconnect(struct virtio_user_dev *dev)
 
 	if (dev->ops->get_features(dev, &dev->device_features) < 0) {
 		PMD_INIT_LOG(ERR, "get_features failed: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 747dddeb2e..5a23d63012 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -285,7 +285,7 @@ virtio_user_notify_queue(struct virtio_hw *hw, struct virtqueue *vq)
 		if (write(dev->kickfds[vq->vq_queue_index], &notify_data,
 			  sizeof(notify_data)) < 0)
 			PMD_DRV_LOG(ERR, "failed to kick backend: %s",
-				    strerror(errno));
+				    rte_strerror(errno));
 		return;
 	} else if (!virtio_with_feature(hw, VIRTIO_F_NOTIFICATION_DATA)) {
 		rte_write16(vq->vq_queue_index, vq->notify_addr);
@@ -417,7 +417,7 @@ vdpa_dynamic_major_num(void)
 	fp = fopen("/proc/devices", "r");
 	if (fp == NULL) {
 		PMD_INIT_LOG(ERR, "Cannot open /proc/devices: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return UNNAMED_MAJOR;
 	}
 
@@ -444,7 +444,7 @@ virtio_user_backend_type(const char *path)
 			return VIRTIO_USER_BACKEND_VHOST_USER;
 
 		PMD_INIT_LOG(ERR, "Stat fails: %s (%s)", path,
-			     strerror(errno));
+			     rte_strerror(errno));
 		return VIRTIO_USER_BACKEND_UNKNOWN;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 39/42] raw/ifpga: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (37 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 38/42] net/virtio: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 40/42] vdpa/ifc: " Dengdui Huang
                       ` (4 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/raw/ifpga/afu_pmd_n3000.c      |  5 +++--
 drivers/raw/ifpga/base/ifpga_fme_rsu.c | 12 +++++++-----
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 6aae1b224e..a67a427985 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -21,6 +21,7 @@
 #include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
+#include <rte_errno.h>
 
 #include "afu_pmd_core.h"
 #include "afu_pmd_n3000.h"
@@ -693,7 +694,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 	pfd.events = POLLIN;
 	poll_ret = poll(&pfd, 1, DMA_TIMEOUT_MSEC);
 	if (poll_ret < 0) {
-		IFPGA_RAWDEV_PMD_ERR("Error %s", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Error %s", rte_strerror(errno));
 		ret = -EFAULT;
 		goto out;
 	} else if (poll_ret == 0) {
@@ -708,7 +709,7 @@ static int poll_interrupt(struct dma_afu_ctx *ctx)
 			ret = 0;
 		} else {
 			IFPGA_RAWDEV_PMD_ERR("Failed %s", bytes_read > 0 ?
-				strerror(errno) : "zero bytes read");
+				rte_strerror(errno) : "zero bytes read");
 			ret = -EIO;
 		}
 	}
diff --git a/drivers/raw/ifpga/base/ifpga_fme_rsu.c b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
index f147aaa1e8..8e8a611f9a 100644
--- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c
+++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
@@ -7,6 +7,8 @@
 #include <unistd.h>
 #include "ifpga_sec_mgr.h"
 
+#include <rte_errno.h>
+
 static struct ifpga_sec_mgr *sec_mgr;
 
 static void set_rsu_control(struct ifpga_sec_mgr *smgr, uint32_t ctrl)
@@ -112,7 +114,7 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 
@@ -130,14 +132,14 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
 			IFPGA_RSU_DATA_BLK_SIZE : length;
 		if (lseek(fd, offset, SEEK_SET) < 0) {
 			dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
 		read_size = read(fd, buf, to_transfer);
 		if (read_size < 0) {
 			dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n",
-				image, strerror(errno));
+				image, rte_strerror(errno));
 			ret = -EIO;
 			goto end;
 		}
@@ -316,7 +318,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (fd < 0) {
 		dev_err(smgr,
 			"Failed to open \'%s\' for RD [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	len = lseek(fd, 0, SEEK_END);
@@ -325,7 +327,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, const char *image,
 	if (len < 0) {
 		dev_err(smgr,
 			"Failed to get file length of \'%s\' [e:%s]\n",
-			image, strerror(errno));
+			image, rte_strerror(errno));
 		return -EIO;
 	}
 	if (len == 0) {
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 5b9b596435..5982621373 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -848,7 +848,7 @@ rte_fpga_do_pr(struct rte_rawdev *rawdev, int port_id,
 	if (file_fd < 0) {
 		IFPGA_RAWDEV_PMD_ERR("%s: open file error: %s",
 				__func__, file_name);
-		IFPGA_RAWDEV_PMD_ERR("Message : %s", strerror(errno));
+		IFPGA_RAWDEV_PMD_ERR("Message : %s", rte_strerror(errno));
 		return -EINVAL;
 	}
 	ret = stat(file_name, &file_stat);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 40/42] vdpa/ifc: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (38 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 39/42] raw/ifpga: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 41/42] vdpa/mlx5: " Dengdui Huang
                       ` (3 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 65de383b95..8cea354674 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -23,6 +23,7 @@
 #include <rte_log.h>
 #include <rte_kvargs.h>
 #include <rte_devargs.h>
+#include <rte_errno.h>
 
 #include "base/ifcvf.h"
 
@@ -446,7 +447,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 			fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
 			if (fd < 0) {
 				DRV_LOG(ERR, "can't setup eventfd: %s",
-					strerror(errno));
+					rte_strerror(errno));
 				return -1;
 			}
 			internal->intr_fd[i] = fd;
@@ -457,7 +458,7 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error enabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -489,7 +490,7 @@ vdpa_disable_vfio_intr(struct ifcvf_internal *internal)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);
 	if (ret) {
 		DRV_LOG(ERR, "Error disabling MSI-X interrupts: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
@@ -526,7 +527,7 @@ notify_relay(void *arg)
 		rte_vhost_get_vhost_vring(internal->vid, qid, &vring);
 		ev.data.u64 = qid | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -552,7 +553,7 @@ notify_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -628,7 +629,7 @@ intr_relay(void *arg)
 	ev.data.fd = rte_intr_fd_get(internal->pdev->intr_handle);
 	if (epoll_ctl(csc_epfd, EPOLL_CTL_ADD,
 		rte_intr_fd_get(internal->pdev->intr_handle), &ev) < 0) {
-		DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+		DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 		goto out;
 	}
 
@@ -653,7 +654,7 @@ intr_relay(void *arg)
 					continue;
 				DRV_LOG(ERR, "Error reading from file descriptor %d: %s",
 					csc_event.data.fd,
-					strerror(errno));
+					rte_strerror(errno));
 				goto out;
 			} else if (nbytes == 0) {
 				DRV_LOG(ERR, "Read nothing from file descriptor %d",
@@ -947,7 +948,7 @@ vring_relay(void *arg)
 		rte_vhost_get_vhost_vring(vid, qid, &vring);
 		ev.data.u64 = qid << 1 | (uint64_t)vring.kickfd << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, vring.kickfd, &ev) < 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 	}
@@ -961,7 +962,7 @@ vring_relay(void *arg)
 			(uint64_t)internal->intr_fd[qid] << 32;
 		if (epoll_ctl(epfd, EPOLL_CTL_ADD, internal->intr_fd[qid], &ev)
 				< 0) {
-			DRV_LOG(ERR, "epoll add error: %s", strerror(errno));
+			DRV_LOG(ERR, "epoll add error: %s", rte_strerror(errno));
 			return 1;
 		}
 		update_used_ring(internal, qid);
@@ -992,7 +993,7 @@ vring_relay(void *arg)
 						continue;
 					DRV_LOG(INFO, "Error reading "
 						"kickfd: %s",
-						strerror(errno));
+						rte_strerror(errno));
 				}
 				break;
 			} while (1);
@@ -1265,7 +1266,7 @@ ifcvf_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(internal->vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret) {
 		DRV_LOG(ERR, "Get not get device region info: %s",
-				strerror(errno));
+				rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 41/42] vdpa/mlx5: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (39 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 40/42] vdpa/ifc: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23  8:28     ` [PATCH v4 42/42] vdpa/sfc: " Dengdui Huang
                       ` (2 subsequent siblings)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 093cdd08d2..d1069088a4 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -44,7 +44,7 @@ mlx5_vdpa_virtq_kick_handler(void *cb_arg)
 			    errno == EAGAIN)
 				continue;
 			DRV_LOG(ERR,  "Failed to read kickfd of virtq %d: %s.",
-				virtq->index, strerror(errno));
+				virtq->index, rte_strerror(errno));
 		}
 		break;
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* [PATCH v4 42/42] vdpa/sfc: use rte strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (40 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 41/42] vdpa/mlx5: " Dengdui Huang
@ 2024-10-23  8:28     ` Dengdui Huang
  2024-10-23 15:42     ` [PATCH v4 00/42] replace strerror Stephen Hemminger
  2024-10-29  1:16     ` lihuisong (C)
  43 siblings, 0 replies; 190+ messages in thread
From: Dengdui Huang @ 2024-10-23  8:28 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/vdpa/sfc/sfc_vdpa_ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index 00f9a4b04c..56fb7f96d8 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -137,7 +137,7 @@ sfc_vdpa_enable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error enabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -165,7 +165,7 @@ sfc_vdpa_disable_vfio_intr(struct sfc_vdpa_ops_data *ops_data)
 	if (rc) {
 		sfc_vdpa_err(ops_data->dev_handle,
 			     "error disabling MSI-X interrupts: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return -1;
 	}
 
@@ -841,7 +841,7 @@ sfc_vdpa_get_notify_area(int vid, int qid, uint64_t *offset, uint64_t *size)
 	ret = ioctl(vfio_dev_fd, VFIO_DEVICE_GET_REGION_INFO, &reg);
 	if (ret != 0) {
 		sfc_vdpa_err(dev, "could not get device region info: %s",
-			     strerror(errno));
+			     rte_strerror(errno));
 		return ret;
 	}
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH v4 00/42] replace strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (41 preceding siblings ...)
  2024-10-23  8:28     ` [PATCH v4 42/42] vdpa/sfc: " Dengdui Huang
@ 2024-10-23 15:42     ` Stephen Hemminger
  2024-10-24  6:47       ` huangdengdui
  2024-10-29  1:16     ` lihuisong (C)
  43 siblings, 1 reply; 190+ messages in thread
From: Stephen Hemminger @ 2024-10-23 15:42 UTC (permalink / raw)
  To: Dengdui Huang
  Cc: dev, ferruh.yigit, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

On Wed, 23 Oct 2024 16:28:10 +0800
Dengdui Huang <huangdengdui@huawei.com> wrote:

> The function strerror() is insecure in a multi-thread environment.
> It is better to use rte_strerror() instead of strerror().
> In this patchset, only the libs and drivers are modified.
> 
> chang log:
> v3->v4 fix ci error
> v2->v3 drop patch "telemetry: replace strerror" due to compile fail
> v1-v2 fix ci error

Even rte_strerror is not completely safe. It depends on the calling
thread being a registered lcore.

It would be better to use a coccinelle script to do direct replacement
with strerror_r().

Also, rte_strerror is not signal safe.

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH v4 21/42] net/bnxt: use rte strerror
  2024-10-23  8:28     ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang
@ 2024-10-23 20:24       ` Ajit Khaparde
  0 siblings, 0 replies; 190+ messages in thread
From: Ajit Khaparde @ 2024-10-23 20:24 UTC (permalink / raw)
  To: Dengdui Huang
  Cc: dev, ferruh.yigit, stephen, mb, david.marchand, iboukris,
	lihuisong, fengchengwen, haijie1, liuyonglong

[-- Attachment #1: Type: text/plain, Size: 140719 bytes --]

On Wed, Oct 23, 2024 at 1:32 AM Dengdui Huang <huangdengdui@huawei.com> wrote:
>
> The function strerror() is insecure in a multi-thread environment.
> This patch uses rte_strerror() to replace it.
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
>  drivers/net/bnxt/bnxt_stats.c                 |   2 +-
>  drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
>  drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
>  drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
>  .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
>  drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
>  drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
>  drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
>  drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
>  drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
>  drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
>  drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
>  drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
>  drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
>  drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
>  drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
>  drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
>  17 files changed, 360 insertions(+), 360 deletions(-)
>
> diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
> index 5e59afe79f..3f89f42bbb 100644
> --- a/drivers/net/bnxt/bnxt_stats.c
> +++ b/drivers/net/bnxt/bnxt_stats.c
> @@ -1187,7 +1187,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
>         ret = bnxt_hwrm_port_clr_stats(bp);
>         if (ret != 0)
>                 PMD_DRV_LOG_LINE(ERR, "Failed to reset xstats: %s",
> -                           strerror(-ret));
> +                           rte_strerror(-ret));
>
>         bnxt_clear_prev_stat(bp);
>
> diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
> index e9b5739050..fedea23a74 100644
> --- a/drivers/net/bnxt/rte_pmd_bnxt.c
> +++ b/drivers/net/bnxt/rte_pmd_bnxt.c
> @@ -149,7 +149,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -191,7 +191,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -249,7 +249,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -308,7 +308,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -365,7 +365,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -409,7 +409,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -600,7 +600,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -636,7 +636,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -670,7 +670,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id)
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -705,7 +705,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -744,7 +744,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -827,7 +827,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> @@ -871,7 +871,7 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on)
>         if (rc != 0) {
>                 PMD_DRV_LOG_LINE(ERR,
>                         "Error during getting device (port %u) info: %s",
> -                       port, strerror(-rc));
> +                       port, rte_strerror(-rc));
>
>                 return rc;
>         }
> diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
> index 3a812bee3a..2c7ee09888 100644
> --- a/drivers/net/bnxt/tf_core/tf_core.c
> +++ b/drivers/net/bnxt/tf_core/tf_core.c
> @@ -205,7 +205,7 @@ int tf_insert_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -215,7 +215,7 @@ int tf_insert_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -232,7 +232,7 @@ int tf_insert_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: EM insert failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -261,7 +261,7 @@ int tf_delete_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -271,7 +271,7 @@ int tf_delete_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -285,7 +285,7 @@ int tf_delete_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: EM delete failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -313,7 +313,7 @@ int tf_get_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -323,7 +323,7 @@ int tf_get_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -338,7 +338,7 @@ int tf_get_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -347,7 +347,7 @@ int tf_get_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Global Cfg get failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -375,7 +375,7 @@ int tf_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -385,7 +385,7 @@ int tf_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -400,7 +400,7 @@ int tf_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -409,7 +409,7 @@ int tf_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Global Cfg set failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -437,7 +437,7 @@ tf_alloc_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -447,7 +447,7 @@ tf_alloc_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -456,7 +456,7 @@ tf_alloc_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -468,7 +468,7 @@ tf_alloc_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Identifier allocation failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -497,7 +497,7 @@ tf_free_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -507,7 +507,7 @@ tf_free_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -516,7 +516,7 @@ tf_free_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -529,7 +529,7 @@ tf_free_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Identifier free failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -556,7 +556,7 @@ tf_search_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -566,7 +566,7 @@ tf_search_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -575,7 +575,7 @@ tf_search_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -589,7 +589,7 @@ tf_search_identifier(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Identifier search failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -615,7 +615,7 @@ tf_search_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -625,7 +625,7 @@ tf_search_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -634,7 +634,7 @@ tf_search_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -656,7 +656,7 @@ tf_search_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: TCAM allocation failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -688,7 +688,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -698,7 +698,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -707,7 +707,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -720,7 +720,7 @@ tf_alloc_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: TCAM allocation failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -748,7 +748,7 @@ tf_set_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -758,7 +758,7 @@ tf_set_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -768,7 +768,7 @@ tf_set_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -786,7 +786,7 @@ tf_set_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: TCAM set failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         TFP_DRV_LOG(DEBUG,
> @@ -816,7 +816,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -826,7 +826,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -835,7 +835,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -853,7 +853,7 @@ tf_get_tcam_entry(struct tf *tfp __rte_unused,
>                 TFP_DRV_LOG(ERR,
>                             "%s: TCAM get failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         parms->key_sz_in_bits = gparms.key_size * 8;
> @@ -881,7 +881,7 @@ tf_free_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -891,7 +891,7 @@ tf_free_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -900,7 +900,7 @@ tf_free_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -912,7 +912,7 @@ tf_free_tcam_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: TCAM free failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -935,7 +935,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -945,7 +945,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -954,7 +954,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -963,7 +963,7 @@ tf_move_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: TCAM shared entries move failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -986,7 +986,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -996,7 +996,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1005,7 +1005,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1014,7 +1014,7 @@ tf_clear_tcam_shared_entries(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: TCAM shared entries clear failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1042,7 +1042,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1052,7 +1052,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1067,7 +1067,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Operation not supported, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return -EOPNOTSUPP;
>                 }
>
> @@ -1076,7 +1076,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: External table allocation failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
> @@ -1085,7 +1085,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: SRAM table allocation failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         } else {
> @@ -1094,7 +1094,7 @@ tf_alloc_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Table allocation failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         }
> @@ -1124,7 +1124,7 @@ tf_free_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1134,7 +1134,7 @@ tf_free_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1149,7 +1149,7 @@ tf_free_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Operation not supported, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return -EOPNOTSUPP;
>                 }
>
> @@ -1158,7 +1158,7 @@ tf_free_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Table free failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
> @@ -1167,7 +1167,7 @@ tf_free_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: SRAM table free failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         } else {
> @@ -1177,7 +1177,7 @@ tf_free_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Table free failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         }
> @@ -1204,7 +1204,7 @@ tf_set_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1214,7 +1214,7 @@ tf_set_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1231,7 +1231,7 @@ tf_set_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Operation not supported, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return -EOPNOTSUPP;
>                 }
>
> @@ -1240,7 +1240,7 @@ tf_set_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Table set failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         }  else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
> @@ -1249,7 +1249,7 @@ tf_set_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: SRAM table set failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         } else {
> @@ -1258,7 +1258,7 @@ tf_set_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Operation not supported, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return -EOPNOTSUPP;
>                 }
>
> @@ -1267,7 +1267,7 @@ tf_set_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Table set failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         }
> @@ -1295,7 +1295,7 @@ tf_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1305,7 +1305,7 @@ tf_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         gparms.dir = parms->dir;
> @@ -1320,7 +1320,7 @@ tf_get_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: SRAM table get failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         } else {
> @@ -1329,7 +1329,7 @@ tf_get_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Operation not supported, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return -EOPNOTSUPP;
>                 }
>
> @@ -1338,7 +1338,7 @@ tf_get_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: Table get failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         }
> @@ -1366,7 +1366,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1376,7 +1376,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1393,7 +1393,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s, External table type not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>
>                 return rc;
>         } else if (dev->ops->tf_dev_is_sram_managed(tfp, parms->type)) {
> @@ -1402,7 +1402,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s: SRAM table bulk get failed, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                 }
>                 return rc;
>         }
> @@ -1412,7 +1412,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -1421,7 +1421,7 @@ tf_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Table get bulk failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         return rc;
> @@ -1442,7 +1442,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1452,7 +1452,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1463,7 +1463,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -1472,7 +1472,7 @@ int tf_get_shared_tbl_increment(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Get table increment not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1494,7 +1494,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1503,7 +1503,7 @@ tf_alloc_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1532,7 +1532,7 @@ tf_map_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1541,7 +1541,7 @@ tf_map_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1571,7 +1571,7 @@ tf_free_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1580,7 +1580,7 @@ tf_free_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1612,7 +1612,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1622,7 +1622,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1631,7 +1631,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1646,7 +1646,7 @@ tf_set_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: If_tbl set failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1670,7 +1670,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1680,7 +1680,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1689,7 +1689,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1704,7 +1704,7 @@ tf_get_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: If_tbl get failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1725,7 +1725,7 @@ int tf_get_session_info(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1734,7 +1734,7 @@ int tf_get_session_info(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1744,7 +1744,7 @@ int tf_get_session_info(struct tf *tfp,
>                 rc = -EOPNOTSUPP;
>                 TFP_DRV_LOG(ERR,
>                             "Operation not supported, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1752,14 +1752,14 @@ int tf_get_session_info(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Ident get resc info failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         if (dev->ops->tf_dev_get_tbl_resc_info == NULL) {
>                 rc = -EOPNOTSUPP;
>                 TFP_DRV_LOG(ERR,
>                             "Operation not supported, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1767,14 +1767,14 @@ int tf_get_session_info(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Tbl get resc info failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         if (dev->ops->tf_dev_get_tcam_resc_info == NULL) {
>                 rc = -EOPNOTSUPP;
>                 TFP_DRV_LOG(ERR,
>                             "Operation not supported, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1782,14 +1782,14 @@ int tf_get_session_info(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "TCAM get resc info failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         if (dev->ops->tf_dev_get_em_resc_info == NULL) {
>                 rc = -EOPNOTSUPP;
>                 TFP_DRV_LOG(ERR,
>                             "Operation not supported, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1797,7 +1797,7 @@ int tf_get_session_info(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "EM get resc info failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return 0;
> @@ -1861,7 +1861,7 @@ int tf_query_sram_resources(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -1870,7 +1870,7 @@ int tf_query_sram_resources(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Get SRAM resc info failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1901,7 +1901,7 @@ int tf_query_sram_resources(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EOPNOTSUPP;
>         }
>
> @@ -1911,7 +1911,7 @@ int tf_query_sram_resources(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Get SRAM resc info failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1943,7 +1943,7 @@ int tf_set_sram_policy(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1952,7 +1952,7 @@ int tf_set_sram_policy(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: SRAM policy set failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1984,7 +1984,7 @@ int tf_get_sram_policy(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1993,7 +1993,7 @@ int tf_get_sram_policy(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: SRAM policy get failed, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c
> index c518150d1f..162bc275b9 100644
> --- a/drivers/net/bnxt/tf_core/tf_em_common.c
> +++ b/drivers/net/bnxt/tf_core/tf_em_common.c
> @@ -51,7 +51,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
>
>         if (tfp_calloc(&parms) != 0) {
>                 TFP_DRV_LOG(ERR, "%s: TBL: external pool failure %s\n",
> -                           tf_dir_2_str(dir), strerror(ENOMEM));
> +                           tf_dir_2_str(dir), rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -61,7 +61,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
>
>         if (rc != 0) {
>                 TFP_DRV_LOG(ERR, "%s: TBL: stack init failure %s\n",
> -                           tf_dir_2_str(dir), strerror(-rc));
> +                           tf_dir_2_str(dir), rte_strerror(-rc));
>                 goto cleanup;
>         }
>
> @@ -78,7 +78,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
>                 rc = stack_push(pool, j);
>                 if (rc != 0) {
>                         TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
> -                                   tf_dir_2_str(dir), strerror(-rc));
> +                                   tf_dir_2_str(dir), rte_strerror(-rc));
>                         goto cleanup;
>                 }
>
> @@ -93,7 +93,7 @@ tf_create_tbl_pool_external(enum tf_dir dir,
>         if (!stack_is_full(pool)) {
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR, "%s TBL: stack failure %s\n",
> -                           tf_dir_2_str(dir), strerror(-rc));
> +                           tf_dir_2_str(dir), rte_strerror(-rc));
>                 goto cleanup;
>         }
>         return 0;
> @@ -921,7 +921,7 @@ tf_em_ext_common_bind(struct tf *tfp,
>         cparms.alignment = 0;
>         if (tfp_calloc(&cparms) != 0) {
>                 TFP_DRV_LOG(ERR, "em_ext_db alloc error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -980,7 +980,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
>         rc = tf_session_get_session_internal(tfp, &tfs);
>         if (rc) {
>                 TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
> -               strerror(-rc));
> +               rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -989,7 +989,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -997,7 +997,7 @@ tf_em_ext_common_unbind(struct tf *tfp)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1157,7 +1157,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
>                 rc = -EOPNOTSUPP;
>                 TFP_DRV_LOG(ERR,
>                             "Map table scope operation not supported, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1167,14 +1167,14 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
>
>         if (tfp_calloc(&aparms) != 0) {
>                 TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>         data = aparms.mem_va;
>
>         if (tfp_calloc(&aparms) != 0) {
>                 TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 rc = -ENOMEM;
>                 goto clean;
>         }
> @@ -1188,7 +1188,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Map table scope config failure, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 goto cleaner;
>         }
>
> @@ -1203,7 +1203,7 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Map tbl scope, set failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>  cleaner:
>         tfp_free(mask);
> diff --git a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
> index 9c527e152d..92dba8c4f9 100644
> --- a/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
> +++ b/drivers/net/bnxt/tf_core/tf_em_hash_internal.c
> @@ -130,7 +130,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -165,7 +165,7 @@ tf_em_move_int_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c
> index 9efffe4ee5..55d27b88a2 100644
> --- a/drivers/net/bnxt/tf_core/tf_em_host.c
> +++ b/drivers/net/bnxt/tf_core/tf_em_host.c
> @@ -182,7 +182,7 @@ tf_em_alloc_page_table(struct hcapi_cfa_em_table *tbl)
>                         TFP_DRV_LOG(WARNING,
>                                 "Failed to allocate page table: lvl: %d, rc:%s\n",
>                                 i,
> -                               strerror(-rc));
> +                               rte_strerror(-rc));
>                         goto cleanup;
>                 }
>
> @@ -379,7 +379,7 @@ tf_em_ext_alloc(struct tf *tfp,
>         rc = tf_session_get_session_internal(tfp, &tfs);
>         if (rc) {
>                 TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
> -               strerror(-rc));
> +               rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -387,7 +387,7 @@ tf_em_ext_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                         "Failed to get em_ext_db from session, rc:%s\n",
> -                       strerror(-rc));
> +                       rte_strerror(-rc));
>                 return rc;
>         }
>         ext_db = (struct em_ext_db *)ext_ptr;
> @@ -396,7 +396,7 @@ tf_em_ext_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "EEM: PF query error rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 goto cleanup;
>         }
>
> @@ -420,7 +420,7 @@ tf_em_ext_alloc(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                         "Failed to allocate session table scope, rc:%s\n",
> -                       strerror(-rc));
> +                       rte_strerror(-rc));
>                 goto cleanup;
>         }
>
> @@ -436,7 +436,7 @@ tf_em_ext_alloc(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "EEM: Unable to query for EEM capability,"
>                                     " rc:%s\n",
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         goto cleanup_ts;
>                 }
>         }
> @@ -456,7 +456,7 @@ tf_em_ext_alloc(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "EEM: Unable to register for EEM ctx,"
>                                     " rc:%s\n",
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         goto cleanup_ts;
>                 }
>
> @@ -473,7 +473,7 @@ tf_em_ext_alloc(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "TBL: Unable to configure EEM in firmware"
>                                     " rc:%s\n",
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         goto cleanup_full;
>                 }
>
> @@ -485,7 +485,7 @@ tf_em_ext_alloc(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "EEM: Unable to enable EEM in firmware"
>                                     " rc:%s\n",
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         goto cleanup_full;
>                 }
>
> @@ -501,7 +501,7 @@ tf_em_ext_alloc(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "%s TBL: Unable to allocate idx pools %s\n",
>                                     tf_dir_2_str(dir),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         goto cleanup_full;
>                 }
>         }
> @@ -547,7 +547,7 @@ tf_em_ext_free(struct tf *tfp,
>         rc = tf_session_get_session_internal(tfp, &tfs);
>         if (rc) {
>                 TFP_DRV_LOG(ERR, "Failed to get tf_session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EINVAL;
>         }
>
> @@ -555,7 +555,7 @@ tf_em_ext_free(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                         "Failed to get em_ext_db from session, rc:%s\n",
> -                       strerror(-rc));
> +                       rte_strerror(-rc));
>                 return rc;
>         }
>         ext_db = (struct em_ext_db *)ext_ptr;
> diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c
> index 7f7a663789..2fea8adb4b 100644
> --- a/drivers/net/bnxt/tf_core/tf_em_internal.c
> +++ b/drivers/net/bnxt/tf_core/tf_em_internal.c
> @@ -49,7 +49,7 @@ tf_em_insert_int_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -113,7 +113,7 @@ tf_em_delete_int_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -153,7 +153,7 @@ tf_em_move_callback(void *user_data,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(parms.dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -163,7 +163,7 @@ tf_em_move_callback(void *user_data,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(parms.dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -202,7 +202,7 @@ tf_em_int_bind(struct tf *tfp,
>         cparms.alignment = 0;
>         if (tfp_calloc(&cparms) != 0) {
>                 TFP_DRV_LOG(ERR, "em_rm_db alloc error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -232,7 +232,7 @@ tf_em_int_bind(struct tf *tfp,
>                                     "%s, EM Allocation must be in blocks of %d, failure %s\n",
>                                     tf_dir_2_str(i),
>                                     TF_SESSION_EM_ENTRY_SIZE,
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>
>                         return rc;
>                 }
> @@ -278,7 +278,7 @@ tf_em_int_bind(struct tf *tfp,
>                                 TFP_DRV_LOG(ERR,
>                                          "%s, EM stack allocation failure %s\n",
>                                          tf_dir_2_str(i),
> -                                        strerror(-rc));
> +                                        rte_strerror(-rc));
>                                 return rc;
>                         }
>
> diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c
> index 3a8030a2fb..ba748fdc23 100644
> --- a/drivers/net/bnxt/tf_core/tf_global_cfg.c
> +++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c
> @@ -83,7 +83,7 @@ tf_global_cfg_bind(struct tf *tfp,
>         cparms.alignment = 0;
>         if (tfp_calloc(&cparms) != 0) {
>                 TFP_DRV_LOG(ERR, "global_rm_db alloc error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -141,7 +141,7 @@ tf_global_cfg_set(struct tf *tfp,
>                             "%s, Failed type lookup, type:%d, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             parms->type,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -151,7 +151,7 @@ tf_global_cfg_set(struct tf *tfp,
>                             "%s, Set failed, type:%d, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             parms->type,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return 0;
> @@ -185,7 +185,7 @@ tf_global_cfg_get(struct tf *tfp,
>                             "%s, Failed type lookup, type:%d, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             parms->type,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -196,7 +196,7 @@ tf_global_cfg_get(struct tf *tfp,
>                             "%s, Get failed, type:%d, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             parms->type,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return 0;
> diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c
> index 7d9d9595dd..21e60a8ad5 100644
> --- a/drivers/net/bnxt/tf_core/tf_identifier.c
> +++ b/drivers/net/bnxt/tf_core/tf_identifier.c
> @@ -39,7 +39,7 @@ tf_ident_bind(struct tf *tfp,
>         cparms.alignment = 0;
>         if (tfp_calloc(&cparms) != 0) {
>                 TFP_DRV_LOG(ERR, "ident_rm_db alloc error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -124,7 +124,7 @@ tf_ident_alloc(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get ident_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         ident_db = (struct ident_rm_db *)ident_db_ptr;
> @@ -164,7 +164,7 @@ tf_ident_free(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get ident_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         ident_db = (struct ident_rm_db *)ident_db_ptr;
> @@ -222,7 +222,7 @@ tf_ident_search(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get ident_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         ident_db = (struct ident_rm_db *)ident_db_ptr;
> diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c
> index 578d361417..4d85b77b4e 100644
> --- a/drivers/net/bnxt/tf_core/tf_if_tbl.c
> +++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c
> @@ -65,7 +65,7 @@ tf_if_tbl_bind(struct tf *tfp,
>         cparms.alignment = 0;
>         if (tfp_calloc(&cparms) != 0) {
>                 TFP_DRV_LOG(ERR, "if_tbl_rm_db alloc error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -143,7 +143,7 @@ tf_if_tbl_set(struct tf *tfp,
>                             "%s, If Tbl set failed, type:%d, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             parms->type,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return 0;
> @@ -187,7 +187,7 @@ tf_if_tbl_get(struct tf *tfp,
>                             "%s, If Tbl get failed, type:%d, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             parms->type,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return 0;
> diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c
> index 1c66c7e01a..5e180813d8 100644
> --- a/drivers/net/bnxt/tf_core/tf_msg.c
> +++ b/drivers/net/bnxt/tf_core/tf_msg.c
> @@ -216,7 +216,7 @@ tf_msg_session_client_register(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -224,7 +224,7 @@ tf_msg_session_client_register(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Unable to lookup FW id, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -291,7 +291,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -299,7 +299,7 @@ tf_msg_session_client_unregister(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Unable to lookup FW id, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -361,7 +361,7 @@ tf_msg_session_qcfg(struct tf *tfp)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -370,7 +370,7 @@ tf_msg_session_qcfg(struct tf *tfp)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -378,7 +378,7 @@ tf_msg_session_qcfg(struct tf *tfp)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Unable to lookup FW id, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -447,7 +447,7 @@ tf_msg_session_resc_qcaps(struct tf *tfp,
>                 TFP_DRV_LOG(WARNING,
>                             "%s: QCAPS message size error, rc:%s, request %d vs response %d\n",
>                             tf_dir_2_str(dir),
> -                           strerror(EINVAL),
> +                           rte_strerror(EINVAL),
>                             size,
>                             resp.size);
>         }
> @@ -498,7 +498,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -509,7 +509,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -559,7 +559,7 @@ tf_msg_session_resc_alloc(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Alloc message size error, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(EINVAL));
> +                           rte_strerror(EINVAL));
>                 rc = -EINVAL;
>                 goto cleanup;
>         }
> @@ -605,7 +605,7 @@ tf_msg_session_resc_info(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -616,7 +616,7 @@ tf_msg_session_resc_info(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -666,7 +666,7 @@ tf_msg_session_resc_info(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Alloc message size error, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(EINVAL));
> +                           rte_strerror(EINVAL));
>                 rc = -EINVAL;
>                 goto cleanup;
>         }
> @@ -712,7 +712,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -722,7 +722,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -731,7 +731,7 @@ tf_msg_session_resc_flush(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -797,7 +797,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -807,7 +807,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -816,7 +816,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -830,7 +830,7 @@ tf_msg_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Invalid parameters for msg type, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -893,7 +893,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -903,7 +903,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -912,7 +912,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -927,7 +927,7 @@ tf_msg_hash_insert_em_internal_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Record size to large, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -982,7 +982,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -992,7 +992,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1001,7 +1001,7 @@ tf_msg_delete_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1050,7 +1050,7 @@ tf_msg_move_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1060,7 +1060,7 @@ tf_msg_move_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1069,7 +1069,7 @@ tf_msg_move_em_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(em_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1120,7 +1120,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1129,7 +1129,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         /* Retrieve the session information */
> @@ -1149,7 +1149,7 @@ int tf_msg_ext_em_ctxt_mem_alloc(struct tf *tfp,
>                 rc = tfp_send_msg_direct(tf_session_get_bp(tfp), &parms);
>                 if (rc) {
>                         TFP_DRV_LOG(ERR, "Failed ext_em_alloc error rc:%s\n",
> -                               strerror(-rc));
> +                               rte_strerror(-rc));
>                         return rc;
>                 }
>
> @@ -1180,7 +1180,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1189,7 +1189,7 @@ int tf_msg_ext_em_ctxt_mem_free(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         /* Retrieve the session information */
> @@ -1231,7 +1231,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1240,7 +1240,7 @@ tf_msg_em_mem_rgtr(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         fw_se_id = tfs->session_id.internal.fw_session_id;
> @@ -1284,7 +1284,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1293,7 +1293,7 @@ tf_msg_em_mem_unrgtr(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1334,7 +1334,7 @@ tf_msg_em_qcaps(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         fw_se_id = tfs->session_id.internal.fw_session_id;
> @@ -1345,7 +1345,7 @@ tf_msg_em_qcaps(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1401,7 +1401,7 @@ tf_msg_em_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1411,7 +1411,7 @@ tf_msg_em_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1465,7 +1465,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1475,7 +1475,7 @@ tf_msg_ext_em_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         fw_se_id = tfs->session_id.internal.fw_session_id;
> @@ -1534,7 +1534,7 @@ tf_msg_em_op(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1544,7 +1544,7 @@ tf_msg_em_op(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1585,7 +1585,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1594,7 +1594,7 @@ tf_msg_tcam_entry_set(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1664,7 +1664,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1673,7 +1673,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1705,7 +1705,7 @@ tf_msg_tcam_entry_get(struct tf *tfp,
>                             tf_dir_2_str(parms->dir),
>                             parms->key_size,
>                             resp.key_size,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         parms->key_size = resp.key_size;
> @@ -1734,7 +1734,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1743,7 +1743,7 @@ tf_msg_tcam_entry_free(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(in_parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1793,7 +1793,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1803,7 +1803,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1812,7 +1812,7 @@ tf_msg_set_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1877,7 +1877,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1887,7 +1887,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1896,7 +1896,7 @@ tf_msg_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         flags = (dir == TF_DIR_TX ?
> @@ -1964,7 +1964,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1974,7 +1974,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1983,7 +1983,7 @@ tf_msg_get_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2043,7 +2043,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2053,7 +2053,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2062,7 +2062,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2082,7 +2082,7 @@ tf_msg_set_global_cfg(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Invalid parameters for msg type, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2140,7 +2140,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2150,7 +2150,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2159,7 +2159,7 @@ tf_msg_bulk_get_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Unable to lookup FW id, rc:%s\n",
>                             tf_dir_2_str(dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         flags = (dir == TF_DIR_TX ?
> @@ -2217,7 +2217,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2227,7 +2227,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup device, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2278,7 +2278,7 @@ tf_msg_set_if_tbl_entry(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Failed to lookup session, rc:%s\n",
>                             tf_dir_2_str(params->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2366,7 +2366,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2375,7 +2375,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2383,7 +2383,7 @@ tf_msg_session_set_hotup_state(struct tf *tfp, uint16_t state)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Unable to lookup FW id, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2421,7 +2421,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2430,7 +2430,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup device, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -2438,7 +2438,7 @@ tf_msg_session_get_hotup_state(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Unable to lookup FW id, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c
> index 9b85f5397d..05d05befaa 100644
> --- a/drivers/net/bnxt/tf_core/tf_rm.c
> +++ b/drivers/net/bnxt/tf_core/tf_rm.c
> @@ -1059,7 +1059,7 @@ tf_rm_get_pool(struct tf_rm_new_db *rm_db,
>                             "%s: Invalid pool for this type:%d, rc:%s\n",
>                             tf_dir_2_str(rm_db->dir),
>                             tmp_subtype,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         *new_subtype = tmp_subtype;
> @@ -1106,7 +1106,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
>                 TFP_DRV_LOG(ERR,
>                             "%s: Allocation failed, rc:%s\n",
>                             tf_dir_2_str(rm_db->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1120,7 +1120,7 @@ tf_rm_allocate(struct tf_rm_allocate_parms *parms)
>                 TFP_DRV_LOG(ERR,
>                             "%s: Alloc adjust of base index failed, rc:%s\n",
>                             tf_dir_2_str(rm_db->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return -EINVAL;
>         }
>
> diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c
> index 253d716572..a1f9848aed 100644
> --- a/drivers/net/bnxt/tf_core/tf_session.c
> +++ b/drivers/net/bnxt/tf_core/tf_session.c
> @@ -78,11 +78,11 @@ tf_session_create(struct tf *tfp,
>                 if (rc == -EEXIST)
>                         TFP_DRV_LOG(ERR,
>                                     "Session is already open, rc:%s\n",
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                 else
>                         TFP_DRV_LOG(ERR,
>                                     "Open message send failed, rc:%s\n",
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>
>                 parms->open_cfg->session_id.id = TF_FW_SESSION_ID_INVALID;
>                 return rc;
> @@ -97,7 +97,7 @@ tf_session_create(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Failed to allocate session info, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 goto cleanup;
>         }
>         tfp->session = (struct tf_session_info *)cparms.mem_va;
> @@ -111,7 +111,7 @@ tf_session_create(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Failed to allocate session data, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 goto cleanup;
>         }
>         tfp->session->core_data = cparms.mem_va;
> @@ -154,7 +154,7 @@ tf_session_create(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Failed to allocate session client, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 goto cleanup;
>         }
>         client = cparms.mem_va;
> @@ -226,7 +226,7 @@ tf_session_create(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "FW Session close failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>         if (tfp->session) {
>                 tfp_free(tfp->session->core_data);
> @@ -268,7 +268,7 @@ tf_session_client_create(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -289,7 +289,7 @@ tf_session_client_create(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to create client on session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -303,7 +303,7 @@ tf_session_client_create(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to allocate session client, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 goto cleanup;
>         }
>         client = cparms.mem_va;
> @@ -320,7 +320,7 @@ tf_session_client_create(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Session Firmware id lookup failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -373,7 +373,7 @@ tf_session_client_destroy(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to lookup session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -405,7 +405,7 @@ tf_session_client_destroy(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Client destroy on FW Failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         ll_delete(&tfs->client_ll, &client->ll_entry);
> @@ -435,7 +435,7 @@ tf_session_open_session(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "Failed to create session, ctrl_chan_name:%s, rc:%s\n",
>                                     parms->open_cfg->ctrl_chan_name,
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>
> @@ -457,7 +457,7 @@ tf_session_open_session(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                               "Failed to create client on session 0x%x, rc:%s\n",
>                               parms->open_cfg->session_id.id,
> -                             strerror(-rc));
> +                             rte_strerror(-rc));
>                         return rc;
>                 }
>
> @@ -480,7 +480,7 @@ tf_session_attach_session(struct tf *tfp __rte_unused,
>
>         TFP_DRV_LOG(ERR,
>                     "Attach not yet supported, rc:%s\n",
> -                   strerror(-rc));
> +                   rte_strerror(-rc));
>         return rc;
>  }
>
> @@ -503,7 +503,7 @@ tf_session_close_session(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Session lookup failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -511,7 +511,7 @@ tf_session_close_session(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Invalid session id, unable to close, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -531,7 +531,7 @@ tf_session_close_session(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Client not part of the session, unable to close, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -556,7 +556,7 @@ tf_session_close_session(struct tf *tfp,
>                         TFP_DRV_LOG(ERR,
>                                     "Failed to unregister Client %d, rc:%s\n",
>                                     client->session_client_id.id,
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>
> @@ -576,7 +576,7 @@ tf_session_close_session(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Device lookup failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -586,7 +586,7 @@ tf_session_close_session(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Unable to lookup FW id, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -596,7 +596,7 @@ tf_session_close_session(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Device unbind failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         rc = tf_msg_session_close(tfp, fw_session_id, mailbox);
> @@ -604,7 +604,7 @@ tf_session_close_session(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "FW Session close failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         /* Final cleanup as we're last user of the session thus we
> @@ -658,7 +658,7 @@ tf_session_get_session_internal(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Session not created, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -689,7 +689,7 @@ tf_session_get_session(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Internal FID lookup\n, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -698,7 +698,7 @@ tf_session_get_session(struct tf *tfp,
>                 TFP_DRV_LOG
>                         (ERR,
>                         "Ctrl channel not registered with session\n, rc:%s\n",
> -                       strerror(-rc));
> +                       rte_strerror(-rc));
>                 return -EINVAL;
>         }
>
> @@ -810,7 +810,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Session not created, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -818,7 +818,7 @@ tf_session_get_fw_session_id(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Invalid Argument(s), rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -842,7 +842,7 @@ tf_session_get_session_id(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Session not created, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -850,7 +850,7 @@ tf_session_get_session_id(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Invalid Argument(s), rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1152,7 +1152,7 @@ tf_session_set_hotup_state(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Session lookup failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1160,7 +1160,7 @@ tf_session_set_hotup_state(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Only shared session able to set state, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1169,7 +1169,7 @@ tf_session_set_hotup_state(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Set session hot upgrade state failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return rc;
> @@ -1186,7 +1186,7 @@ tf_session_get_hotup_state(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Session lookup failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1194,7 +1194,7 @@ tf_session_get_hotup_state(struct tf *tfp,
>                 rc = -EINVAL;
>                 TFP_DRV_LOG(ERR,
>                             "Only shared session able to get state, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -1203,7 +1203,7 @@ tf_session_get_hotup_state(struct tf *tfp,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Get session hot upgrade state failed, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return rc;
> diff --git a/drivers/net/bnxt/tf_core/tf_sram_mgr.c b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
> index 87e8882fed..afbc3a3e46 100644
> --- a/drivers/net/bnxt/tf_core/tf_sram_mgr.c
> +++ b/drivers/net/bnxt/tf_core/tf_sram_mgr.c
> @@ -494,7 +494,7 @@ static struct tf_sram_block
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Failed to allocate block, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return NULL;
>         }
>         block = (struct tf_sram_block *)cparms.mem_va;
> @@ -588,7 +588,7 @@ tf_sram_mgr_bind(void **sram_handle)
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "Failed to allocate SRAM mgmt data, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         sram = (struct tf_sram *)cparms.mem_va;
> @@ -628,7 +628,7 @@ tf_sram_mgr_unbind(void *sram_handle)
>                                         /* Log error */
>                                         TFP_DRV_LOG(ERR,
>                                                   "No SRAM slice list, rc:%s\n",
> -                                                 strerror(-rc));
> +                                                 rte_strerror(-rc));
>                                         return rc;
>                                 }
>                                 if (tf_sram_get_block_cnt(slice_list))
> @@ -670,7 +670,7 @@ int tf_sram_mgr_alloc(void *sram_handle,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "No SRAM slice list, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -759,7 +759,7 @@ tf_sram_mgr_free(void *sram_handle,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "No SRAM slice list, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -781,7 +781,7 @@ tf_sram_mgr_free(void *sram_handle,
>         rc = tf_sram_free_slice(parms->slice_size, slice_offset,
>                                 block, &block_is_empty);
>         if (rc) {
> -               TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", strerror(-rc));
> +               TFP_DRV_LOG(ERR, "Error freeing slice (%s)\n", rte_strerror(-rc));
>                 return rc;
>         }
>  #if (STATS_CLEAR_ON_READ_SUPPORT == 0)
> @@ -805,7 +805,7 @@ tf_sram_mgr_free(void *sram_handle,
>                                     "%s, Failed type lookup, type:%s, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
>                                     tf_tbl_type_2_str(parms->tbl_type),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>                 /* Clear the counter
> @@ -821,7 +821,7 @@ tf_sram_mgr_free(void *sram_handle,
>                                     "%s, Set failed, type:%s, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
>                                     tf_tbl_type_2_str(parms->tbl_type),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         }
> @@ -836,14 +836,14 @@ tf_sram_mgr_free(void *sram_handle,
>
>                 if (rc) {
>                         TFP_DRV_LOG(ERR, "Free block_id(%d) failed error(%s)\n",
> -                                   block_id, strerror(-rc));
> +                                   block_id, rte_strerror(-rc));
>                 }
>                 fparms.index = block_id + 1;
>                 rc = tf_rm_free(&fparms);
>
>                 if (rc) {
>                         TFP_DRV_LOG(ERR, "Free next block_id(%d) failed error(%s)\n",
> -                                   block_id + 1, strerror(-rc));
> +                                   block_id + 1, rte_strerror(-rc));
>                 }
>                 /* Free local entry regardless */
>                 tf_sram_free_block(slice_list, block);
> @@ -937,7 +937,7 @@ int tf_sram_mgr_is_allocated(void *sram_handle,
>                 /* Log error */
>                 TFP_DRV_LOG(ERR,
>                             "No SRAM slice list, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c
> index f5f3889934..0fbcba6c76 100644
> --- a/drivers/net/bnxt/tf_core/tf_tbl.c
> +++ b/drivers/net/bnxt/tf_core/tf_tbl.c
> @@ -45,7 +45,7 @@ tf_tbl_bind(struct tf *tfp,
>         cparms.alignment = 0;
>         if (tfp_calloc(&cparms) != 0) {
>                 TFP_DRV_LOG(ERR, "tbl_rm_db alloc error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -143,7 +143,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get tbl_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -195,7 +195,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -234,7 +234,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
>                                     "%s, Failed type lookup, type:%s, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
>                                     tf_tbl_type_2_str(parms->type),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>                 /* Clear the counter
> @@ -250,7 +250,7 @@ tf_tbl_free(struct tf *tfp __rte_unused,
>                                     "%s, Set failed, type:%s, rc:%s\n",
>                                     tf_dir_2_str(parms->dir),
>                                     tf_tbl_type_2_str(parms->type),
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         return rc;
>                 }
>         }
> @@ -302,7 +302,7 @@ tf_tbl_set(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -341,7 +341,7 @@ tf_tbl_set(struct tf *tfp,
>                             "%s, Failed type lookup, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -356,7 +356,7 @@ tf_tbl_set(struct tf *tfp,
>                             "%s, Set failed, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -393,7 +393,7 @@ tf_tbl_get(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -432,7 +432,7 @@ tf_tbl_get(struct tf *tfp,
>                             "%s, Failed type lookup, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -449,7 +449,7 @@ tf_tbl_get(struct tf *tfp,
>                             "%s, Get failed, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -485,7 +485,7 @@ tf_tbl_bulk_get(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -517,7 +517,7 @@ tf_tbl_bulk_get(struct tf *tfp,
>                             "%s, Failed type lookup, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -535,7 +535,7 @@ tf_tbl_bulk_get(struct tf *tfp,
>                             "%s, Bulk get failed, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>
>         return rc;
> diff --git a/drivers/net/bnxt/tf_core/tf_tbl_sram.c b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
> index 3a6f1c68c7..39dbe11610 100644
> --- a/drivers/net/bnxt/tf_core/tf_tbl_sram.c
> +++ b/drivers/net/bnxt/tf_core/tf_tbl_sram.c
> @@ -114,7 +114,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
>                             "%s: Failed to get hcapi_type %s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->tbl_type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         parms->bank_id = tf_tbl_sram_hcapi_2_bank[hcapi_type];
> @@ -129,7 +129,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
>                             "%s: Failed to get slice cnt %s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->tbl_type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         if (slices)
> @@ -168,7 +168,7 @@ tf_tbl_sram_unbind(struct tf *tfp __rte_unused)
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get sram_handle from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         if (sram_handle)
> @@ -204,7 +204,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get tbl_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -214,7 +214,7 @@ tf_tbl_sram_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get sram_handle from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -290,7 +290,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -299,7 +299,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get sram_handle from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -345,7 +345,7 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
>                             parms->idx,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 rc = -ENOMEM;
>                 return rc;
>         }
> @@ -417,7 +417,7 @@ tf_tbl_sram_set(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -426,7 +426,7 @@ tf_tbl_sram_set(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get sram_handle from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -489,7 +489,7 @@ tf_tbl_sram_set(struct tf *tfp,
>                                     tf_dir_2_str(parms->dir),
>                                     tf_tbl_type_2_str(parms->type),
>                                     parms->idx,
> -                                   strerror(-rc));
> +                                   rte_strerror(-rc));
>                         rc = -ENOMEM;
>                         return rc;
>                 }
> @@ -504,7 +504,7 @@ tf_tbl_sram_set(struct tf *tfp,
>                             "%s, Failed type lookup, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -519,7 +519,7 @@ tf_tbl_sram_set(struct tf *tfp,
>                             "%s, Set failed, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         return rc;
> @@ -553,7 +553,7 @@ tf_tbl_sram_get(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -562,7 +562,7 @@ tf_tbl_sram_get(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get sram_handle from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -592,7 +592,7 @@ tf_tbl_sram_get(struct tf *tfp,
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
>                             parms->idx,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 rc = -ENOMEM;
>                 return rc;
>         }
> @@ -607,7 +607,7 @@ tf_tbl_sram_get(struct tf *tfp,
>                             "%s, Failed type lookup, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         if (parms->type == TF_TBL_TYPE_ACT_STATS_64)
> @@ -626,7 +626,7 @@ tf_tbl_sram_get(struct tf *tfp,
>                             "%s, Get failed, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         return rc;
> @@ -661,7 +661,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tbl_db = (struct tbl_rm_db *)tbl_db_ptr;
> @@ -670,7 +670,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get sram_handle from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -703,7 +703,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
>                             parms->starting_idx,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 rc = -ENOMEM;
>                 return rc;
>         }
> @@ -716,7 +716,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
>                             idx,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 rc = -ENOMEM;
>                 return rc;
>         }
> @@ -730,7 +730,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
>                             "%s, Failed type lookup, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -751,7 +751,7 @@ tf_tbl_sram_bulk_get(struct tf *tfp,
>                             "%s, Bulk get failed, type:%s, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
>                             tf_tbl_type_2_str(parms->type),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>         }
>         return rc;
>  }
> diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c
> index 9e0671d47b..5924c5e6c1 100644
> --- a/drivers/net/bnxt/tf_core/tf_tcam.c
> +++ b/drivers/net/bnxt/tf_core/tf_tcam.c
> @@ -57,7 +57,7 @@ tf_tcam_bind(struct tf *tfp,
>                 rc = -EOPNOTSUPP;
>                 TFP_DRV_LOG(ERR,
>                             "Operation not supported, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -91,7 +91,7 @@ tf_tcam_bind(struct tf *tfp,
>         cparms.alignment = 0;
>         if (tfp_calloc(&cparms) != 0) {
>                 TFP_DRV_LOG(ERR, "tcam_rm_db alloc error %s\n",
> -                           strerror(ENOMEM));
> +                           rte_strerror(ENOMEM));
>                 return -ENOMEM;
>         }
>
> @@ -301,7 +301,7 @@ tf_tcam_alloc(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -320,7 +320,7 @@ tf_tcam_alloc(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get tcam_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
> @@ -385,7 +385,7 @@ tf_tcam_free(struct tf *tfp,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -417,7 +417,7 @@ tf_tcam_free(struct tf *tfp,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
> @@ -477,7 +477,7 @@ tf_tcam_free(struct tf *tfp,
>                             tf_dir_2_str(parms->dir),
>                             tf_tcam_tbl_2_str(parms->type),
>                             parms->idx,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -515,7 +515,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
>                 TFP_DRV_LOG(ERR,
>                             "%s: Operation not supported, rc:%s\n",
>                             tf_dir_2_str(parms->dir),
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> @@ -535,7 +535,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
> @@ -579,7 +579,7 @@ tf_tcam_set(struct tf *tfp __rte_unused,
>                             tf_dir_2_str(parms->dir),
>                             tf_tcam_tbl_2_str(parms->type),
>                             parms->idx,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         return 0;
> @@ -618,7 +618,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
>         if (rc) {
>                 TFP_DRV_LOG(ERR,
>                             "Failed to get em_ext_db from session, rc:%s\n",
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>         tcam_db = (struct tcam_rm_db *)tcam_db_ptr;
> @@ -662,7 +662,7 @@ tf_tcam_get(struct tf *tfp __rte_unused,
>                             tf_dir_2_str(parms->dir),
>                             tf_tcam_tbl_2_str(parms->type),
>                             parms->idx,
> -                           strerror(-rc));
> +                           rte_strerror(-rc));
>                 return rc;
>         }
>
> --
> 2.33.0
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH v4 00/42] replace strerror
  2024-10-23 15:42     ` [PATCH v4 00/42] replace strerror Stephen Hemminger
@ 2024-10-24  6:47       ` huangdengdui
  2024-10-25 21:56         ` Thomas Monjalon
  0 siblings, 1 reply; 190+ messages in thread
From: huangdengdui @ 2024-10-24  6:47 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: dev, ferruh.yigit, mb, david.marchand, iboukris, lihuisong,
	fengchengwen, haijie1, liuyonglong

Hi, Stephen Hemminger

On 2024/10/23 23:42, Stephen Hemminger wrote:
> On Wed, 23 Oct 2024 16:28:10 +0800
> Dengdui Huang <huangdengdui@huawei.com> wrote:
> 
>> The function strerror() is insecure in a multi-thread environment.
>> It is better to use rte_strerror() instead of strerror().
>> In this patchset, only the libs and drivers are modified.
>>
>> chang log:
>> v3->v4 fix ci error
>> v2->v3 drop patch "telemetry: replace strerror" due to compile fail
>> v1-v2 fix ci error
> 
> Even rte_strerror is not completely safe. It depends on the calling
> thread being a registered lcore.

As discussed earlier, it is still safe if used from non-DPDK registered threads[1]:

#define RTE_DEFINE_PER_LCORE(type, name)			\
	__thread __typeof__(type) per_lcore_##name

[1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37

> 
> It would be better to use a coccinelle script to do direct replacement
> with strerror_r().
> 
> Also, rte_strerror is not signal safe.

Can we use strerror_r() in the signal processing context and replace it with rte_strerror() everywhere else?

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH v4 22/42] net/af_xdp: use rte strerror
  2024-10-23  8:28     ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang
@ 2024-10-24 17:05       ` Maryam Tahhan
  0 siblings, 0 replies; 190+ messages in thread
From: Maryam Tahhan @ 2024-10-24 17:05 UTC (permalink / raw)
  To: dev

> The function strerror() is insecure in a multi-thread environment.
> This patch uses rte_strerror() to replace it.
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>

Acked-by: Maryam Tahhan <mtahhan@redhat.com>


^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH v4 00/42] replace strerror
  2024-10-24  6:47       ` huangdengdui
@ 2024-10-25 21:56         ` Thomas Monjalon
  2024-11-01  9:16           ` huangdengdui
  0 siblings, 1 reply; 190+ messages in thread
From: Thomas Monjalon @ 2024-10-25 21:56 UTC (permalink / raw)
  To: huangdengdui
  Cc: Stephen Hemminger, dev, ferruh.yigit, mb, david.marchand,
	iboukris, lihuisong, fengchengwen, haijie1, liuyonglong

24/10/2024 08:47, huangdengdui:
> On 2024/10/23 23:42, Stephen Hemminger wrote:
> > On Wed, 23 Oct 2024 16:28:10 +0800
> > Dengdui Huang <huangdengdui@huawei.com> wrote:
> > 
> >> The function strerror() is insecure in a multi-thread environment.
> >> It is better to use rte_strerror() instead of strerror().
> >> In this patchset, only the libs and drivers are modified.
> > 
> > Even rte_strerror is not completely safe. It depends on the calling
> > thread being a registered lcore.
> 
> As discussed earlier, it is still safe if used from non-DPDK registered threads[1]:
> 
> #define RTE_DEFINE_PER_LCORE(type, name)			\
> 	__thread __typeof__(type) per_lcore_##name
> 
> [1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37
> 
> > 
> > It would be better to use a coccinelle script to do direct replacement
> > with strerror_r().
> > 
> > Also, rte_strerror is not signal safe.
> 
> Can we use strerror_r() in the signal processing context and replace it with rte_strerror() everywhere else?

It does not make sense to use rte_strerror after libc functions.
Please restrict the use of rte_strerror for error numbers from DPDK functions.



^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH v4 00/42] replace strerror
  2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
                       ` (42 preceding siblings ...)
  2024-10-23 15:42     ` [PATCH v4 00/42] replace strerror Stephen Hemminger
@ 2024-10-29  1:16     ` lihuisong (C)
  43 siblings, 0 replies; 190+ messages in thread
From: lihuisong (C) @ 2024-10-29  1:16 UTC (permalink / raw)
  To: Dengdui Huang, dev
  Cc: ferruh.yigit, stephen, mb, david.marchand, iboukris,
	fengchengwen, haijie1, liuyonglong

For series,
Acked-by: Huisong Li <lihuisong@huawei.com>


在 2024/10/23 16:28, Dengdui Huang 写道:
> The function strerror() is insecure in a multi-thread environment.
> It is better to use rte_strerror() instead of strerror().
> In this patchset, only the libs and drivers are modified.
>
> chang log:
> v3->v4 fix ci error
> v2->v3 drop patch "telemetry: replace strerror" due to compile fail
> v1-v2 fix ci error
>
> Dengdui Huang (42):
>    devtools: forbid use of strerror
>    eal: use rte strerror
>    eventdev: use rte strerror
>    latency: use rte strerror
>    node: use rte strerror
>    pdump: use rte strerror
>    power: use rte strerror
>    vhost: use rte strerror
>    bpf: use rte strerror
>    bus/cdx: use rte strerror
>    bus/dpaa: use rte strerror
>    bus/fslmc: use rte strerror
>    bus/pci: use rte strerror
>    bus/vdev: use rte strerror
>    bus/vmbus: use rte strerror
>    common/cnxk: use rte strerror
>    common/mlx5: use rte strerror
>    crypto/caam_jr: use rte strerror
>    dma/idxd: use rte strerror
>    net/af_packet: use rte strerror
>    net/bnxt: use rte strerror
>    net/af_xdp: use rte strerror
>    net/bonding: use rte strerror
>    net/dpaa: use rte strerror
>    net/dpaa2: use rte strerror
>    net/enetfec: use rte strerror
>    net/failsafe: use rte strerror
>    net/i40e: use rte strerror
>    net/ice: use rte strerror
>    net/ixgbe: use rte strerror
>    net/memif: use rte strerror
>    net/mlx4: use rte strerror
>    net/mlx5: use rte strerror
>    net/qede: use rte strerror
>    net/sfc: use rte strerror
>    net/tap: use rte strerror
>    net/vhost: use rte strerror
>    net/virtio: use rte strerror
>    raw/ifpga: use rte strerror
>    vdpa/ifc: use rte strerror
>    vdpa/mlx5: use rte strerror
>    vdpa/sfc: use rte strerror
>
>   devtools/checkpatches.sh                      |   8 +
>   drivers/bus/cdx/cdx.c                         |   2 +-
>   drivers/bus/cdx/cdx_vfio.c                    |  13 +-
>   drivers/bus/dpaa/base/fman/fman.c             |   2 +-
>   drivers/bus/dpaa/dpaa_bus.c                   |   2 +-
>   drivers/bus/fslmc/fslmc_vfio.c                |  12 +-
>   drivers/bus/pci/bsd/pci.c                     |   8 +-
>   drivers/bus/pci/linux/pci.c                   |   7 +-
>   drivers/bus/pci/linux/pci_uio.c               |  23 +-
>   drivers/bus/pci/linux/pci_vfio.c              |  23 +-
>   drivers/bus/pci/pci_common_uio.c              |   3 +-
>   drivers/bus/vdev/vdev.c                       |   2 +-
>   drivers/bus/vmbus/linux/vmbus_bus.c           |   7 +-
>   drivers/bus/vmbus/linux/vmbus_uio.c           |  21 +-
>   drivers/bus/vmbus/vmbus_common.c              |   4 +-
>   drivers/bus/vmbus/vmbus_common_uio.c          |   3 +-
>   drivers/common/cnxk/roc_dev.c                 |   6 +-
>   drivers/common/cnxk/roc_model.c               |   4 +-
>   drivers/common/cnxk/roc_utils.c               |   4 +-
>   drivers/common/mlx5/linux/mlx5_nl.c           |  12 +-
>   drivers/common/mlx5/mlx5_common.c             |   6 +-
>   drivers/crypto/caam_jr/caam_jr_uio.c          |   5 +-
>   drivers/dma/idxd/idxd_bus.c                   |  15 +-
>   drivers/net/af_packet/rte_eth_af_packet.c     |   2 +-
>   drivers/net/af_xdp/rte_eth_af_xdp.c           |  12 +-
>   drivers/net/bnxt/bnxt_stats.c                 |   2 +-
>   drivers/net/bnxt/rte_pmd_bnxt.c               |  26 +-
>   drivers/net/bnxt/tf_core/tf_core.c            | 240 +++++++++---------
>   drivers/net/bnxt/tf_core/tf_em_common.c       |  26 +-
>   .../net/bnxt/tf_core/tf_em_hash_internal.c    |   4 +-
>   drivers/net/bnxt/tf_core/tf_em_host.c         |  24 +-
>   drivers/net/bnxt/tf_core/tf_em_internal.c     |  14 +-
>   drivers/net/bnxt/tf_core/tf_global_cfg.c      |  10 +-
>   drivers/net/bnxt/tf_core/tf_identifier.c      |   8 +-
>   drivers/net/bnxt/tf_core/tf_if_tbl.c          |   6 +-
>   drivers/net/bnxt/tf_core/tf_msg.c             | 160 ++++++------
>   drivers/net/bnxt/tf_core/tf_rm.c              |   6 +-
>   drivers/net/bnxt/tf_core/tf_session.c         |  72 +++---
>   drivers/net/bnxt/tf_core/tf_sram_mgr.c        |  22 +-
>   drivers/net/bnxt/tf_core/tf_tbl.c             |  28 +-
>   drivers/net/bnxt/tf_core/tf_tbl_sram.c        |  48 ++--
>   drivers/net/bnxt/tf_core/tf_tcam.c            |  24 +-
>   drivers/net/bonding/bonding_testpmd.c         |   4 +-
>   drivers/net/bonding/rte_eth_bond_api.c        |   2 +-
>   drivers/net/bonding/rte_eth_bond_flow.c       |   4 +-
>   drivers/net/bonding/rte_eth_bond_pmd.c        |   6 +-
>   drivers/net/dpaa/dpaa_ethdev.c                |   4 +-
>   drivers/net/dpaa/fmlib/fm_lib.c               |   6 +-
>   drivers/net/dpaa2/dpaa2_ethdev.c              |   4 +-
>   drivers/net/enetfec/enet_uio.c                |   2 +-
>   drivers/net/failsafe/failsafe.c               |   8 +-
>   drivers/net/failsafe/failsafe_args.c          |   4 +-
>   drivers/net/failsafe/failsafe_eal.c           |   4 +-
>   drivers/net/failsafe/failsafe_flow.c          |   4 +-
>   drivers/net/failsafe/failsafe_ops.c           |   2 +-
>   drivers/net/failsafe/failsafe_private.h       |   6 +-
>   drivers/net/i40e/i40e_testpmd.c               |  42 +--
>   drivers/net/ice/ice_testpmd.c                 |   4 +-
>   drivers/net/ixgbe/ixgbe_testpmd.c             |  12 +-
>   drivers/net/memif/memif_socket.c              |   4 +-
>   drivers/net/memif/rte_eth_memif.c             |  20 +-
>   drivers/net/mlx4/mlx4.c                       |  14 +-
>   drivers/net/mlx4/mlx4_ethdev.c                |  18 +-
>   drivers/net/mlx4/mlx4_rxq.c                   |  10 +-
>   drivers/net/mlx4/mlx4_txq.c                   |  10 +-
>   drivers/net/mlx5/hws/mlx5dr_matcher.c         |   2 +-
>   drivers/net/mlx5/linux/mlx5_ethdev_os.c       |  22 +-
>   drivers/net/mlx5/linux/mlx5_os.c              |  18 +-
>   drivers/net/mlx5/linux/mlx5_socket.c          |  16 +-
>   drivers/net/mlx5/linux/mlx5_verbs.c           |   8 +-
>   drivers/net/mlx5/mlx5.c                       |   8 +-
>   drivers/net/mlx5/mlx5_devx.c                  |   4 +-
>   drivers/net/mlx5/mlx5_mac.c                   |   2 +-
>   drivers/net/mlx5/mlx5_rxmode.c                |   8 +-
>   drivers/net/mlx5/mlx5_rxq.c                   |   4 +-
>   drivers/net/mlx5/mlx5_rxtx.c                  |   2 +-
>   drivers/net/mlx5/mlx5_stats.c                 |   4 +-
>   drivers/net/mlx5/mlx5_testpmd.c               |  26 +-
>   drivers/net/mlx5/mlx5_trigger.c               |  12 +-
>   drivers/net/mlx5/mlx5_vlan.c                  |   2 +-
>   drivers/net/mlx5/windows/mlx5_ethdev_os.c     |   2 +-
>   drivers/net/mlx5/windows/mlx5_os.c            |  12 +-
>   drivers/net/qede/qede_regs.c                  |   4 +-
>   drivers/net/sfc/sfc_flow.c                    |   2 +-
>   drivers/net/sfc/sfc_flow_tunnel.c             |   2 +-
>   drivers/net/sfc/sfc_mae.c                     |  58 ++---
>   drivers/net/tap/rte_eth_tap.c                 |  28 +-
>   drivers/net/tap/tap_flow.c                    |  14 +-
>   drivers/net/tap/tap_netlink.c                 |   5 +-
>   drivers/net/tap/tap_tcmsgs.c                  |   6 +-
>   drivers/net/vhost/rte_eth_vhost.c             |   6 +-
>   drivers/net/virtio/virtio_user/vhost_kernel.c |   8 +-
>   .../net/virtio/virtio_user/vhost_kernel_tap.c |  25 +-
>   drivers/net/virtio/virtio_user/vhost_user.c   |  20 +-
>   drivers/net/virtio/virtio_user/vhost_vdpa.c   |  12 +-
>   .../net/virtio/virtio_user/virtio_user_dev.c  |   8 +-
>   drivers/net/virtio/virtio_user_ethdev.c       |   6 +-
>   drivers/raw/ifpga/afu_pmd_n3000.c             |   5 +-
>   drivers/raw/ifpga/base/ifpga_fme_rsu.c        |  12 +-
>   drivers/raw/ifpga/ifpga_rawdev.c              |   2 +-
>   drivers/vdpa/ifc/ifcvf_vdpa.c                 |  23 +-
>   drivers/vdpa/mlx5/mlx5_vdpa_virtq.c           |   2 +-
>   drivers/vdpa/sfc/sfc_vdpa_ops.c               |   6 +-
>   lib/bpf/bpf_load_elf.c                        |   2 +-
>   lib/eal/common/eal_common_fbarray.c           |   2 +-
>   lib/eal/common/eal_common_options.c           |   7 +-
>   lib/eal/common/eal_common_proc.c              |  12 +-
>   lib/eal/common/eal_common_trace_utils.c       |   6 +-
>   lib/eal/freebsd/eal.c                         |   4 +-
>   lib/eal/freebsd/eal_interrupts.c              |   8 +-
>   lib/eal/freebsd/eal_memory.c                  |   2 +-
>   lib/eal/freebsd/eal_timer.c                   |   7 +-
>   lib/eal/linux/eal.c                           |  10 +-
>   lib/eal/linux/eal_dev.c                       |   2 +-
>   lib/eal/linux/eal_hugepage_info.c             |   5 +-
>   lib/eal/linux/eal_interrupts.c                |  18 +-
>   lib/eal/linux/eal_memalloc.c                  |  47 ++--
>   lib/eal/linux/eal_memory.c                    |  42 +--
>   lib/eal/linux/eal_timer.c                     |   2 +-
>   lib/eal/linux/eal_vfio.c                      |  42 +--
>   lib/eal/unix/eal_filesystem.c                 |   5 +-
>   lib/eal/unix/eal_unix_memory.c                |   6 +-
>   lib/eal/unix/rte_thread.c                     |   6 +-
>   lib/eventdev/rte_event_eth_rx_adapter.c       |   2 +-
>   lib/latencystats/rte_latencystats.c           |   4 +-
>   lib/node/kernel_tx.c                          |   2 +-
>   lib/pdump/rte_pdump.c                         |   6 +-
>   lib/power/guest_channel.c                     |   7 +-
>   lib/power/power_kvm_vm.c                      |   3 +-
>   lib/power/power_pstate_cpufreq.c              |   7 +-
>   lib/power/rte_power_pmd_mgmt.c                |   2 +-
>   lib/vhost/fd_man.c                            |   7 +-
>   lib/vhost/socket.c                            |  13 +-
>   lib/vhost/vduse.c                             |  45 ++--
>   lib/vhost/vhost_user.c                        |  10 +-
>   135 files changed, 956 insertions(+), 913 deletions(-)
>

^ permalink raw reply	[flat|nested] 190+ messages in thread

* Re: [PATCH v4 00/42] replace strerror
  2024-10-25 21:56         ` Thomas Monjalon
@ 2024-11-01  9:16           ` huangdengdui
  0 siblings, 0 replies; 190+ messages in thread
From: huangdengdui @ 2024-11-01  9:16 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Stephen Hemminger, dev, ferruh.yigit, mb, david.marchand,
	iboukris, lihuisong, fengchengwen, haijie1, liuyonglong


On 2024/10/26 5:56, Thomas Monjalon wrote:
> 24/10/2024 08:47, huangdengdui:
>> On 2024/10/23 23:42, Stephen Hemminger wrote:
>>> On Wed, 23 Oct 2024 16:28:10 +0800
>>> Dengdui Huang <huangdengdui@huawei.com> wrote:
>>>
>>>> The function strerror() is insecure in a multi-thread environment.
>>>> It is better to use rte_strerror() instead of strerror().
>>>> In this patchset, only the libs and drivers are modified.
>>>
>>> Even rte_strerror is not completely safe. It depends on the calling
>>> thread being a registered lcore.
>>
>> As discussed earlier, it is still safe if used from non-DPDK registered threads[1]:
>>
>> #define RTE_DEFINE_PER_LCORE(type, name)			\
>> 	__thread __typeof__(type) per_lcore_##name
>>
>> [1]: https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_per_lcore.h#L37
>>
>>>
>>> It would be better to use a coccinelle script to do direct replacement
>>> with strerror_r().
>>>
>>> Also, rte_strerror is not signal safe.
>>
>> Can we use strerror_r() in the signal processing context and replace it with rte_strerror() everywhere else?
> 
> It does not make sense to use rte_strerror after libc functions.
> Please restrict the use of rte_strerror for error numbers from DPDK functions.
> 
> 

The Windows platform does not support strerror_r(). Using strerror_r() instead of strerror() is not a good idea,
Platform differences have been handled in rte_strerror()[1].
The rte_strerror() can also handle errno from libc functions[2][3].
So is it better to use rte_strerror() instead of strerror()?

[1]https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L15
[2]https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/common/eal_common_errno.c#L49
[3]https://elixir.bootlin.com/dpdk/v23.11-rc3/source/lib/eal/include/rte_errno.h#L32

^ permalink raw reply	[flat|nested] 190+ messages in thread

end of thread, other threads:[~2024-11-01  9:16 UTC | newest]

Thread overview: 190+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14  8:24 [PATCH 00/43] replace strerror Dengdui Huang
2023-11-14  8:24 ` [PATCH 01/43] devtools: forbid use of strerror Dengdui Huang
2023-11-14  8:24 ` [PATCH 02/43] eal: use rte strerror Dengdui Huang
2023-11-15  0:18   ` Stephen Hemminger
2023-11-15 11:16     ` Morten Brørup
2024-02-01 21:49       ` Stephen Hemminger
2023-11-15  0:22   ` Stephen Hemminger
2023-11-15 11:23     ` Morten Brørup
2023-11-15 15:06       ` Stephen Hemminger
2023-11-14  8:24 ` [PATCH 03/43] eventdev: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 04/43] latency: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 05/43] node: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 06/43] pdump: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 07/43] power: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 08/43] telemetry: replace strerror Dengdui Huang
2023-11-14  8:25 ` [PATCH 09/43] vhost: use rte strerror Dengdui Huang
2023-11-14  8:25 ` [PATCH 10/43] bpf: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 11/43] bus/cdx: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 12/43] bus/dpaa: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 13/43] bus/fslmc: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 14/43] bus/pci: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 15/43] bus/vdev: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 16/43] bus/vmbus: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 17/43] common/cnxk: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 18/43] common/mlx5: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 19/43] crypto/caam_jr: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 20/43] dma/idxd: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 21/43] net/af_packet: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 22/43] net/bnxt: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 23/43] net/af_xdp: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 24/43] net/bonding: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 25/43] net/dpaa: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 26/43] net/dpaa2: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 27/43] net/enetfec: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 28/43] net/failsafe: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 29/43] net/i40e: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 30/43] net/ice: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 31/43] net/ixgbe: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 32/43] net/memif: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 33/43] net/mlx4: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 34/43] net/mlx5: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 35/43] net/qede: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 36/43] net/sfc: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 37/43] net/tap: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 38/43] net/vhost: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 39/43] net/virtio: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 40/43] raw/ifpga: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 41/43] vdpa/ifc: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 42/43] vdpa/mlx5: " Dengdui Huang
2023-11-14  8:25 ` [PATCH 43/43] vdpa/sfc: " Dengdui Huang
2023-11-14 11:23   ` [PATCH v2 00/43] replace strerror Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 01/43] devtools: forbid use of strerror Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 02/43] eal: use rte strerror Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 03/43] eventdev: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 04/43] latency: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 05/43] node: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 06/43] pdump: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 07/43] power: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 08/43] telemetry: replace strerror Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 09/43] vhost: use rte strerror Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 10/43] bpf: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 11/43] bus/cdx: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 12/43] bus/dpaa: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 13/43] bus/fslmc: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 14/43] bus/pci: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 15/43] bus/vdev: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 16/43] bus/vmbus: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 17/43] common/cnxk: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 18/43] common/mlx5: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 19/43] crypto/caam_jr: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 20/43] dma/idxd: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 21/43] net/af_packet: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 22/43] net/bnxt: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 23/43] net/af_xdp: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 24/43] net/bonding: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 25/43] net/dpaa: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 26/43] net/dpaa2: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 27/43] net/enetfec: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 28/43] net/failsafe: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 29/43] net/i40e: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 30/43] net/ice: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 31/43] net/ixgbe: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 32/43] net/memif: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 33/43] net/mlx4: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 34/43] net/mlx5: " Dengdui Huang
2023-11-14 11:23     ` [PATCH v2 35/43] net/qede: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 36/43] net/sfc: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 37/43] net/tap: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 38/43] net/vhost: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 39/43] net/virtio: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 40/43] raw/ifpga: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 41/43] vdpa/ifc: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 42/43] vdpa/mlx5: " Dengdui Huang
2023-11-14 11:24     ` [PATCH v2 43/43] vdpa/sfc: " Dengdui Huang
2023-11-14 12:35   ` [PATCH v3 00/42] replace strerror Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 01/42] devtools: forbid use of strerror Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 02/42] eal: use rte strerror Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 03/42] eventdev: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 04/42] latency: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 05/42] node: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 06/42] pdump: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 07/42] power: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 08/42] vhost: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 09/42] bpf: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 10/42] bus/cdx: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 11/42] bus/dpaa: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 12/42] bus/fslmc: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 13/42] bus/pci: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 14/42] bus/vdev: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 15/42] bus/vmbus: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 16/42] common/cnxk: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 17/42] common/mlx5: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 18/42] crypto/caam_jr: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 19/42] dma/idxd: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 20/42] net/af_packet: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 21/42] net/bnxt: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 22/42] net/af_xdp: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 23/42] net/bonding: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 24/42] net/dpaa: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 25/42] net/dpaa2: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 26/42] net/enetfec: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 27/42] net/failsafe: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 28/42] net/i40e: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 29/42] net/ice: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 30/42] net/ixgbe: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 31/42] net/memif: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 32/42] net/mlx4: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 33/42] net/mlx5: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 34/42] net/qede: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 35/42] net/sfc: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 36/42] net/tap: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 37/42] net/vhost: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 38/42] net/virtio: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 39/42] raw/ifpga: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 40/42] vdpa/ifc: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 41/42] vdpa/mlx5: " Dengdui Huang
2023-11-14 12:35     ` [PATCH v3 42/42] vdpa/sfc: " Dengdui Huang
2024-10-23  8:28   ` [PATCH v4 00/42] replace strerror Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 01/42] devtools: forbid use of strerror Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 02/42] eal: use rte strerror Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 03/42] eventdev: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 04/42] latency: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 05/42] node: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 06/42] pdump: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 07/42] power: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 08/42] vhost: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 09/42] bpf: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 10/42] bus/cdx: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 11/42] bus/dpaa: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 12/42] bus/fslmc: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 13/42] bus/pci: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 14/42] bus/vdev: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 15/42] bus/vmbus: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 16/42] common/cnxk: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 17/42] common/mlx5: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 18/42] crypto/caam_jr: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 19/42] dma/idxd: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 20/42] net/af_packet: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 21/42] net/bnxt: " Dengdui Huang
2024-10-23 20:24       ` Ajit Khaparde
2024-10-23  8:28     ` [PATCH v4 22/42] net/af_xdp: " Dengdui Huang
2024-10-24 17:05       ` Maryam Tahhan
2024-10-23  8:28     ` [PATCH v4 23/42] net/bonding: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 24/42] net/dpaa: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 25/42] net/dpaa2: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 26/42] net/enetfec: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 27/42] net/failsafe: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 28/42] net/i40e: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 29/42] net/ice: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 30/42] net/ixgbe: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 31/42] net/memif: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 32/42] net/mlx4: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 33/42] net/mlx5: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 34/42] net/qede: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 35/42] net/sfc: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 36/42] net/tap: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 37/42] net/vhost: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 38/42] net/virtio: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 39/42] raw/ifpga: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 40/42] vdpa/ifc: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 41/42] vdpa/mlx5: " Dengdui Huang
2024-10-23  8:28     ` [PATCH v4 42/42] vdpa/sfc: " Dengdui Huang
2024-10-23 15:42     ` [PATCH v4 00/42] replace strerror Stephen Hemminger
2024-10-24  6:47       ` huangdengdui
2024-10-25 21:56         ` Thomas Monjalon
2024-11-01  9:16           ` huangdengdui
2024-10-29  1:16     ` lihuisong (C)
2023-11-15  0:16 ` [PATCH 00/43] " Stephen Hemminger
2024-02-01 11:03   ` David Marchand
2024-10-22 10:48   ` Morten Brørup

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).