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 79ED845C9D; Wed, 6 Nov 2024 19:57:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91717402BC; Wed, 6 Nov 2024 19:57:12 +0100 (CET) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id 7436740289 for ; Wed, 6 Nov 2024 19:57:11 +0100 (CET) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-71e4244fdc6so66587b3a.0 for ; Wed, 06 Nov 2024 10:57:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1730919430; x=1731524230; 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=yAKo5Qjq89FFUsM/ZTHPtByzXHDW3pm4RdrBJnRJVjI=; b=VLNFaSmc780O/xzQJ76RbbAONpZ5wLPJQlKYF+E6ko89VaYloAHY2DcikOYtCtJjQY UINcP5K2cqmsX2hgZnCPGRvG8WrChQrWV5pSKlyCYHJ1OwS1gTMdhSfPgPMd24iKbI++ /Luq1jUjnJF2gNt52HxJYNoG3XYVYmeTbux9mlASX2kLJnCe9ACr103mNoGXgNXDc8zn d5RKFxLkTKWDHuDTTdemn9EVII8GAzvaZ3XyCXvqOMlhHSwbDCEL3c3MvCKr+8yme6rT qk9mdpS90ZofapC0/lFKX/h3AmLt68SZi5GGgCeTlov5NZ0kt2Mch/e1DfA2ElqiGWsK dhkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730919430; x=1731524230; 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=yAKo5Qjq89FFUsM/ZTHPtByzXHDW3pm4RdrBJnRJVjI=; b=AfS1tLJkRXiyjLfasCL8VLwbVBuweW8DRYnvDtvLRg+JUF0tysBcereM8dzUpVZkeg B5HSn7wmhdY5GcvBN8JPYFAU1nPpjjSvsX8ooiyMgSwYovBiZz01kSMrIB4zW4njiIRy ztQqhCCxkPAscy1aEHZJD+4VmTgzGdLj7YSkyJTeMUWROPX3Q7Nw5cdkCA19ivZlEA87 Xkh8n98EAUbWcPcq+HuSjxHtUf4tTXoSUCCjrYpi2u+KCZES/LPRMXvz2bl05W0pTYbg 9WUeJaIf7/KogXN0TlxcX34UJixbln7jtg1LYzM0Fag3Xm8fAnnhCbve7nKAXiUHNcKL wbbw== X-Gm-Message-State: AOJu0YxtMiHm+sJP7YvcAoi/yZwmR//BB5zp5LWbkY90qnK7dRU9YkEc lr5XbfeaX/E7/svryTrCQRa0bzrLbl1XxhiVntFtHqrDBCIJjWb2r0fcTIKU2Sc= X-Google-Smtp-Source: AGHT+IFY+qejwLh/QJFs/cLQkFldKseSPgJdaBVt/zfQ+RAenOT0JYZ6me1MGLQt6AMDkavUMTPOMg== X-Received: by 2002:a05:6a00:188d:b0:71e:14c:8d31 with SMTP id d2e1a72fcca58-720c991f71dmr29687232b3a.16.1730919430369; Wed, 06 Nov 2024 10:57:10 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-720bc2ecb8esm12422042b3a.177.2024.11.06.10.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2024 10:57:10 -0800 (PST) Date: Wed, 6 Nov 2024 10:57:08 -0800 From: Stephen Hemminger To: Dengdui Huang Cc: , , , , Subject: Re: [PATCH 00/43] replace strerror Message-ID: <20241106105708.2891c287@hermes.local> In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-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 Tue, 14 Nov 2023 16:24:56 +0800 Dengdui Huang 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));