NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/58510: experimental wg(4) lacks memory ordering between wg_count_dec and module unload



>Number:         58510
>Category:       kern
>Synopsis:       experimental wg(4) lacks memory ordering between wg_count_dec and module unload
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 29 01:50:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10
>Organization:
The wgunload Foundation
>Environment:
>Description:
All memory operations in wg_clone_destroy program-before wg_count_dec() must (globally) happen-before module unload.

However, although wgdetach (which is called by MODULE_CMD_FINI) checks wg_count program-before module unload, there are no memory barriers to guarantee this happens-before ordering.
>How-To-Repeat:
code inspection
>Fix:
membar_release before atomic_dec_uint_nv in wg_count_dec
atomic_load_acquire(&wg_count) in wgdetach



Home | Main Index | Thread Index | Old Index