NetBSD Problem Report #58510
From www@netbsd.org Mon Jul 29 01:48:00 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 6942F1A923C
for <gnats-bugs@gnats.NetBSD.org>; Mon, 29 Jul 2024 01:48:00 +0000 (UTC)
Message-Id: <20240729014759.26E711A923E@mollari.NetBSD.org>
Date: Mon, 29 Jul 2024 01:47:59 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: experimental wg(4) lacks memory ordering between wg_count_dec and module unload
X-Send-Pr-Version: www-1.0
>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: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 29 01:50:00 +0000 2024
>Closed-Date:
>Last-Modified: Mon Jul 29 02:40:20 +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
>Release-Note:
>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/58510 CVS commit: src/sys/net
Date: Mon, 29 Jul 2024 02:34:27 +0000
Module Name: src
Committed By: riastradh
Date: Mon Jul 29 02:34:27 UTC 2024
Modified Files:
src/sys/net: if_wg.c
Log Message:
wg(4): Fix memory ordering in detach.
PR kern/58510: experimental wg(4) lacks memory ordering between
wg_count_dec and module unload
To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/net/if_wg.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 29 Jul 2024 02:40:20 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-10
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.