[PATCH v2 0/6] fix process shared pthread mutexes
Konstantin Ananyev
konstantin.ananyev at huawei.com
Thu Apr 23 19:29:52 CEST 2026
> Several drivers and the ethdev layer initialize pthread mutexes
> in shared memory with default (process-private) attributes.
> This is undefined behavior when secondary processes use them.
>
> This series adds PTHREAD_PROCESS_SHARED to all affected mutexes.
> All are on control paths (firmware mailbox, hotplug, flow ops,
> PHY negotiation) where sleeping is acceptable.
>
> See POSIX spec:
> https://pubs.opengroup.org/onlinepubs/009696899/functions/pthread_mutexat
> tr_getpshared.html
>
> Bugzilla ID: 662
>
> v2 - fix build on Windows which does not need this.
>
> Stephen Hemminger (6):
> ethdev: fix flow_ops_mutex for multi-process
> net/failsafe: fix hotplug_mutex for multi-process
> net/atlantic: fix mbox_mutex for multi-process
> net/axgbe: fix mutexes for multi-process
> net/bnxt: fix mutexes for multi-process
> net/hinic: fix mutexes for multi-process
>
> drivers/net/atlantic/atl_ethdev.c | 14 +++++++++++++-
> drivers/net/axgbe/axgbe_ethdev.c | 19 +++++++++++++++----
> drivers/net/bnxt/bnxt_ethdev.c | 11 ++++++-----
> drivers/net/bnxt/bnxt_txq.c | 3 ++-
> drivers/net/bnxt/bnxt_util.c | 13 +++++++++++++
> drivers/net/bnxt/bnxt_util.h | 2 ++
> drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 2 +-
> drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c | 2 +-
> drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c | 2 +-
> drivers/net/failsafe/failsafe.c | 15 ++++++++++++---
> drivers/net/hinic/base/hinic_compat.h | 13 ++++++++++++-
> lib/ethdev/ethdev_driver.c | 22 +++++++++++++++++++++-
> 12 files changed, 99 insertions(+), 19 deletions(-)
>
> --
LGTM
Just as a generic thought :
- as these new functions is practically identical in all drivers, would it make sense
to create some helper function in drivcers/common or somewhere in other place
and use it everywhere.
With or without suggested change:
Series-Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
> 2.53.0
More information about the dev
mailing list