[PATCH 00/43] replace strerror

Stephen Hemminger stephen at networkplumber.org
Wed Nov 6 19:57:08 CET 2024


On Tue, 14 Nov 2023 16:24:56 +0800
Dengdui Huang <huangdengdui at 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.

strerror is ok in multi-threaded environment, look at what glibc does.

The bigger problem is where DPDK code is calling strerror() on rte_errno.
This should be flagged by checkpatch (but isn't now).

Examples:
$ git grep 'strerror(rte_errno)' | grep -v rte_strerror
app/dumpcap/main.c:				 strerror(rte_errno));
app/test/test_bpf.c:			__func__, __LINE__, rte_errno, strerror(rte_errno));
app/test/test_bpf.c:		       __func__, __LINE__, str, rte_errno, strerror(rte_errno));
app/test/test_bpf.c:			__func__, __LINE__, rte_errno, strerror(rte_errno));
app/test/test_bpf.c:		       __func__, __LINE__, s, rte_errno, strerror(rte_errno));
app/test/test_bpf.c:			__func__, __LINE__, rte_errno, strerror(rte_errno));
drivers/bus/vdev/vdev.c:					 devname, strerror(rte_errno));
drivers/common/mlx5/linux/mlx5_nl.c:		iface_idx, strerror(rte_errno));
drivers/common/mlx5/linux/mlx5_nl.c:			add ? "add" : "remove", m, strerror(rte_errno));
drivers/common/mlx5/linux/mlx5_nl.c:		strerror(rte_errno));
drivers/common/mlx5/linux/mlx5_nl.c:			strerror(rte_errno));
drivers/common/mlx5/linux/mlx5_nl.c:			strerror(rte_errno));
drivers/common/mlx5/mlx5_common.c:			strerror(rte_errno));
drivers/common/mlx5/mlx5_common.c:			strerror(rte_errno));
drivers/common/mlx5/mlx5_common.c:				strerror(rte_errno));
drivers/net/af_xdp/rte_eth_af_xdp.c:				   name, strerror(rte_errno));
drivers/net/bonding/rte_eth_bond_flow.c:			     strerror(rte_errno));
drivers/net/bonding/rte_eth_bond_flow.c:			     strerror(rte_errno));
drivers/net/failsafe/failsafe.c:		      strerror(rte_errno));
drivers/net/failsafe/failsafe_eal.c:				      rte_errno ? strerror(rte_errno) : "",
drivers/net/failsafe/failsafe_flow.c:		      strerror(rte_errno));
drivers/net/failsafe/failsafe_flow.c:		      strerror(rte_errno));
drivers/net/memif/rte_eth_memif.c:			strerror(rte_errno));
drivers/net/mlx4/mlx4.c:		      strerror(rte_errno));
drivers/net/mlx4/mlx4_ethdev.c:	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
drivers/net/mlx4/mlx4_ethdev.c:	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
drivers/net/mlx4/mlx4_ethdev.c:	      index, rte_errno, strerror(rte_errno), error.type, error.cause,
drivers/net/mlx4/mlx4_ethdev.c:	      rte_errno, strerror(rte_errno), error.type, error.cause,
drivers/net/mlx4/mlx4_ethdev.c:	      rte_errno, strerror(rte_errno), error.type, error.cause,
drivers/net/mlx4/mlx4_ethdev.c:		WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(rte_errno));
drivers/net/mlx4/mlx4_ethdev.c:		     strerror(rte_errno));
drivers/net/mlx4/mlx4_ethdev.c:		     strerror(rte_errno));
drivers/net/mlx4/mlx4_ethdev.c:		     strerror(rte_errno));
drivers/net/mlx4/mlx4_rxq.c:			      (void *)dev, strerror(rte_errno));
drivers/net/mlx4/mlx4_rxq.c:			      (void *)dev, strerror(rte_errno));
drivers/net/mlx4/mlx4_txq.c:		      (void *)dev, strerror(rte_errno));
drivers/net/mlx4/mlx4_txq.c:		      (void *)dev, strerror(rte_errno));
drivers/net/mlx4/mlx4_txq.c:		      (void *)dev, strerror(rte_errno));
drivers/net/mlx4/mlx4_txq.c:		      (void *)dev, strerror(rte_errno));
drivers/net/mlx4/mlx4_txq.c:		      (void *)dev, strerror(rte_errno));
drivers/net/mlx5/hws/mlx5dr_matcher.c:		       strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:				dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:				dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			bond->ifname, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:				strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:				strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:			strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:			eth_dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:				strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:			strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:			strerror(rte_errno));
drivers/net/mlx5/linux/mlx5_os.c:			strerror(rte_errno));
drivers/net/mlx5/mlx5.c:				strerror(rte_errno));
drivers/net/mlx5/mlx5.c:			strerror(rte_errno));
drivers/net/mlx5/mlx5.c:				strerror(rte_errno));
drivers/net/mlx5/mlx5.c:			strerror(rte_errno));
drivers/net/mlx5/mlx5_mac.c:				dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_rxmode.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_rxmode.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_rxmode.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_rxmode.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_stats.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_testpmd.c:			tlv_mng.nb_options, strerror(rte_errno));
drivers/net/mlx5/mlx5_testpmd.c:		fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno));
drivers/net/mlx5/mlx5_testpmd.c:		fprintf(stderr, "Unable to dump SQ/CQ HW Context (%s)\n", strerror(rte_errno));
drivers/net/mlx5/mlx5_testpmd.c:		fprintf(stderr, "File Access Error (%s)\n", strerror(rte_errno));
drivers/net/mlx5/mlx5_testpmd.c:		fprintf(stderr, "Unable to dump RQ/CQ HW Context (%s)\n", strerror(rte_errno));
drivers/net/mlx5/mlx5_trigger.c:				dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_trigger.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_trigger.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_trigger.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_trigger.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_trigger.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/mlx5_vlan.c:			" %s", dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/windows/mlx5_ethdev_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/windows/mlx5_os.c:				strerror(rte_errno));
drivers/net/mlx5/windows/mlx5_os.c:			strerror(rte_errno));
drivers/net/mlx5/windows/mlx5_os.c:			eth_dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/windows/mlx5_os.c:			dev->data->port_id, strerror(rte_errno));
drivers/net/mlx5/windows/mlx5_os.c:			strerror(rte_errno));
drivers/net/tap/rte_eth_tap.c:					strerror(rte_errno));
drivers/net/tap/rte_eth_tap.c:				strerror(rte_errno));
lib/eal/linux/eal_dev.c:			 "(rte_errno: %s)!", strerror(rte_errno));
lib/eal/unix/eal_unix_memory.c:				virt, size, flags, strerror(rte_errno));
lib/pdump/rte_pdump.c:			  strerror(rte_errno));


More information about the dev mailing list