On Thu, Feb 26, 2026 at 6:00 AM Eelco Chaudron via dev <
[email protected]> wrote:
> Coverity reports a data race condition where call_hooks() accesses
> h->hook_cb without holding the mutex (as is done elsewhere 1 out of 1
> times when writing to hook_cb).
>
> The function fatal_signal_add_hook() writes to hooks[] with the mutex
> held, but fatal_signal_atexit_handler() calls call_hooks() without
> acquiring the mutex. While this is unlikely to cause issues in practice
> (hooks are registered during initialization and the atexit handler runs
> single-threaded at exit), there's no memory barrier guaranteeing
> visibility of hook data.
>
> Add mutex locking to fatal_signal_atexit_handler() and add OVS_REQUIRES
> annotations to call_hooks() to enforce proper locking. Since the mutex
> is recursive, this is safe even if called from signal context.
>
> Fixes: b847adc62006 ("fatal-signal: Make thread-safe.")
> Signed-off-by: Eelco Chaudron <[email protected]>
>
This seems like a reasonable solution to the warning.
Acked-by: Mike Pattrick <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev