From nobody Thu Dec 14 11:20:40 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SrVJm51lyz53qZf; Thu, 14 Dec 2023 11:20:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SrVJm30dGz4Vgt; Thu, 14 Dec 2023 11:20:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702552840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n1pkKDeauOgbxq59fadfEmIic7baAiNq4RZdxMuIOSE=; b=xqORuhg5dpN50VvwyPJg37V3QySWAGXYRtjK741uXnETsgCS8mC/drGtmAVe+bUTZxHZZA wIIv71Qzx0NjbcY+uaPGAID0kAoIfO+MFUmSdXmugiS9hkU4Xr0amvhfcZ9Kr7mnvEWIYi R9Gxlso5sOH9LjEe8EINtpkqtZLOHus1uMtx6pHllq6y7d8uSxZm6LvlW7gEgSEYHeu0nK 2VX2S4VkfGKZcKcu4CqktzXK0BBiHdoKEZNH5mqu+EvBaiJ1+olr2rIhC/P1lOIkt4THDi w9SlSfkU35QoJRKGL/dt1wI2392dfPnuyYfgApMUiPvWI/e8QOn0gMkCvvxYHQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702552840; a=rsa-sha256; cv=none; b=MvsqgaeIhSrYhOPN7aBl3emwa9XIxepRHNDyrvCUD5fRo8rK4TSoCLQwrLKt33zN0V7z8m QAQidbaydpfJMip0f/a7P32YyyQcn7CMb6pF2P91OVwciPTwjCq4YpXOMNwaeRm15yV0Bj imM2QZMSIx07j+i50GcYR+Rojn9ohAY7+i9J+GQAHlyn2ZjjHD82ZEkfZ9XczjLEIdWzn8 NsZPMUGA4BQacAfQ+K2fGo7n1T0tq8eU11NRrztTL+LSdhhqqJpNex09Z9AqTqfUJVZcr2 KYjLA4gWVMDWs0JlfNX+I8lV+Rj7BAMkxJy5GwzCeh0g7gRQ2oQyMnl+lm7aeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702552840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n1pkKDeauOgbxq59fadfEmIic7baAiNq4RZdxMuIOSE=; b=tXfYQOlLd2aaur/ewJpzY3tKU4UqUCEV2/UTS2UCj78eK0ovFEXSuMAgwqnkkAJxuc8dDn MsBK5pZ9GNVsCBJ5mzfchJjfr/x3s49nRIU72leIjXvHvq+qaQVMmYKGj8AgUwHOIqYjzG 9cldr6IjCjuZuVYxy6Iy1KHAQgxr3BCvFwRCVu+tXn4OfQ360HCYFZF6ieYHn/lQBZRxUG tKZknO2QJIN8+BkRPkLZZuzZ8qbT9LdgA6qZOLhg59qD0TUD3ysIIfOsJq5E19zZa7v3G4 npilCv2u+YDse8O+wenRqMR33MTReTSktfojY5UYlY3Wh1im5xYRLbyQhaefPg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SrVJm234bz9Sg; Thu, 14 Dec 2023 11:20:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BEBKeIB036762; Thu, 14 Dec 2023 11:20:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BEBKeX3036759; Thu, 14 Dec 2023 11:20:40 GMT (envelope-from git) Date: Thu, 14 Dec 2023 11:20:40 GMT Message-Id: <202312141120.3BEBKeX3036759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4102ee128b9f - stable/13 - vnet: (read) lock the vnet list while iterating it List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4102ee128b9f0159f00e48c2f00f1b3b80cd0f1a Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4102ee128b9f0159f00e48c2f00f1b3b80cd0f1a commit 4102ee128b9f0159f00e48c2f00f1b3b80cd0f1a Author: Kristof Provost AuthorDate: 2023-12-05 19:08:11 +0000 Commit: Kristof Provost CommitDate: 2023-12-14 08:34:32 +0000 vnet: (read) lock the vnet list while iterating it Ensure that the vnet list cannot be modified while we're running through it. Reviewed by: mjg (previous version), zlei (previous version) MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42927 (cherry picked from commit bd7b2f95019e9715150c34736279805de0818d09) --- sys/net/vnet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/net/vnet.c b/sys/net/vnet.c index 4f61061853da..9bcc0a779d59 100644 --- a/sys/net/vnet.c +++ b/sys/net/vnet.c @@ -503,11 +503,13 @@ vnet_register_sysinit(void *arg) * Invoke the constructor on all the existing vnets when it is * registered. */ + VNET_LIST_RLOCK(); VNET_FOREACH(vnet) { CURVNET_SET_QUIET(vnet); vs->func(vs->arg); CURVNET_RESTORE(); } + VNET_LIST_RUNLOCK(); VNET_SYSINIT_WUNLOCK(); } @@ -559,6 +561,7 @@ vnet_deregister_sysuninit(void *arg) * deregistered. */ VNET_SYSINIT_WLOCK(); + VNET_LIST_RLOCK(); VNET_FOREACH(vnet) { CURVNET_SET_QUIET(vnet); vs->func(vs->arg); @@ -568,6 +571,7 @@ vnet_deregister_sysuninit(void *arg) /* Remove the destructor from the global list of vnet destructors. */ TAILQ_REMOVE(&vnet_destructors, vs, link); VNET_SYSINIT_WUNLOCK(); + VNET_LIST_RUNLOCK(); } /*