From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D9BDF45C79; Mon, 4 Nov 2024 19:22:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A95E40281; Mon, 4 Nov 2024 19:22:26 +0100 (CET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id AB7044025F for ; Mon, 4 Nov 2024 19:22:25 +0100 (CET) Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2e56750bb0dso3164000a91.0 for ; Mon, 04 Nov 2024 10:22:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1730744545; x=1731349345; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=fLe6SjJ7+IdjoEiOhk0k6TgAkt4MKW4z1KRVnDyS2/I=; b=zgL9kouVDQF8URM8HagSDhn7oBqopj6LaDmrhr67BXHSuYa1b74wE2zpgoWOLnVFkd +ozfpe5nmgQMmKZ5iI+MVvDkyr6sbIWeIhx+0xNYfeOkWhhyJOc7pSp/8rGVkffu5XjR j7PbdkSrNl3d+fvidz80o5u8dxltENZqTHGAwNrXAwpypvjBqih6euYKL/Bw/Wsv6RtH eImbs6QBwvjg0ih2aMtAllqX3aM2xtnj4ncNSOwZ3I8K+0u3aaaGL7VUfbB75bFoiV34 SQOfgojWFSO2hjjWFkfubIB4rw5zR1TTPVEczw02zCe4g2BcEa0+ELx2FmsMgKWEu8yt nVgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730744545; x=1731349345; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fLe6SjJ7+IdjoEiOhk0k6TgAkt4MKW4z1KRVnDyS2/I=; b=rUHXwKkbsxyRorhcENKVZNZY2oTqm/QRpNxsns3JxY/XHSR0HFt7nAAJoYGC7p2ECb m5moPDkovU+T5F4Wmk+70RbQG4Pac+1qF8cR+pbj2g9S1Z4hnZ40E/ySpRDJjhMzFD3g uHKGP/AcDJ38SmBecVJa5qhv8FEFrcuoD+LPHgDVtEf61A3cqiyclS9aOysTSWMnwN0N BPKip2GSSG7LhMcfCCwLrz9bNfkpmCRqdxyQy9pxLFOwvbkhiQTN9tNtVs/+ILy39AJ/ 7KDtpUW3Fv1UkGVv4YpS7LVnIg+/XGJSHNzSI1f5jpmLDpQ/7bF0e4aCM9yA+MszTrJ+ ZI1g== X-Gm-Message-State: AOJu0Ywz/AhaqYgOKv60X1RyhWwYzYZId5ed2mKYC5ssYtCIBih9sLH2 KX4fDVZmLzWER2qBYbbRRWmohM0h635afEOrBNUBXNlHYJvxdK7zWkKSN8ddfWc= X-Google-Smtp-Source: AGHT+IE1bld11KJmyKSFnV8fekM6XVaCwfGe0VoUzabDQOxIDcdGr7kSWfdHlOcnXgy6Pq+2Qa7irw== X-Received: by 2002:a17:90b:4d04:b0:2e0:8719:5f00 with SMTP id 98e67ed59e1d1-2e94c2e20a7mr19173636a91.22.1730744544661; Mon, 04 Nov 2024 10:22:24 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-211318b562fsm41317585ad.169.2024.11.04.10.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 10:22:24 -0800 (PST) Date: Mon, 4 Nov 2024 10:22:22 -0800 From: Stephen Hemminger To: Dengdui Huang Cc: , , , , , , , , Subject: Re: [PATCH v4 00/42] replace strerror Message-ID: <20241104102222.602de854@hermes.local> In-Reply-To: <20241023082852.2780488-1-huangdengdui@huawei.com> References: <20231114082539.1858594-44-huangdengdui@huawei.com> <20241023082852.2780488-1-huangdengdui@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, 23 Oct 2024 16:28:10 +0800 Dengdui Huang 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 > > 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(-) > I don't think this is necessary because strerror() does not have the same problems as strtok does. The function is documented to return a pointer to an immutable string; there is no thread safety issue here. Internally, Glibc uses TLS to make sure that it either returns a value from the error list, or it a pointer to an internal TLS error buffer. Can't see the justification.