[PATCH 02/43] eal: use rte strerror
Morten Brørup
mb at smartsharesystems.com
Wed Nov 15 12:16:18 CET 2023
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Wednesday, 15 November 2023 01.18
>
> On Tue, 14 Nov 2023 16:24:58 +0800
> Dengdui Huang <huangdengdui at huawei.com> wrote:
>
> > The function strerror() is insecure in a multi-thread environment.
> > This patch uses rte_strerror() to replace it.
> >
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
> > Acked-by: Chengwen Feng <fengchengwen at 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.
More information about the dev
mailing list