[PATCH v4 00/42] replace strerror
huangdengdui
huangdengdui at huawei.com
Thu Oct 24 08:47:28 CEST 2024
Hi, Stephen Hemminger
On 2024/10/23 23:42, Stephen Hemminger wrote:
> On Wed, 23 Oct 2024 16:28:10 +0800
> Dengdui Huang <huangdengdui at 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?
More information about the dev
mailing list