From nobody Thu Dec 7 12:39:25 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 4SmDNt1hGjz52w3J; Thu, 7 Dec 2023 12:39:26 +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 4SmDNt0x9rz3TTw; Thu, 7 Dec 2023 12:39:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701952766; 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=8BA/+CUkFKhF4+ZlPFa8mh0CJu9Gqzfk5uT4dR6nU2Y=; b=FIdIwYFilVr3kF/IU3t0yvyvBrKKfyfPhk4pqWTt/Gxb1fOx6FhUji/BCl17tVLUBB0DQZ 8R1VrnQwqxyLllM5dtTdagqbI0NYqEG4cX5mefXrdqNRnKy9NX11Cq34KI6Lu8TwaaonOv cNnG+Rexks7fInNdWzmF4t4ehdBUsy4euof45hai0kQtxyeehCyAUC5n8d/yHVuWLM5D8l a8ciBoy5Kh5OFusd5Jpr2LX1BWqBOgDQXHorcJ3EXi0DFmsyCUpUdBpsev9XFRCnWVESnX nY6Oy2fmT9ZkMUNlAMCbNw6p+l+/yWmD/aH2+taL+1Vv1lZ4dDxL9IVnY7/1Kg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701952766; a=rsa-sha256; cv=none; b=en+eRUTFMe09wz/kqor1RpuWUdxEOQOHb3mlDJovmv4FDK7LEJ0nQjtb6UL2mzA8vtt4JV udIa/UKvkhclAR/U8EpcnOm+4137h6pHWOMpGIvoLMyZ0Z6WH5+8p1h2YJrOK4W/tvpQWq uL+0ZX19oMdn9cKWkbPVuNbgSDOI4Psw7txfX4+12WMxjo6M70PSn3V701zfSc4LYPdD2A K2UKxc0O0lzbySGkfREU8op1r7U3qiNvUt79XQ5SdyMU3M04qupH3SDdE4AdCcCPzgma7g 1QCcyTGwyQQsietRR3m9+WqVYXV3FuKcL7P+Sx0Pfe3hHL+aYZ57vF/y4ToTRQ== 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=1701952766; 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=8BA/+CUkFKhF4+ZlPFa8mh0CJu9Gqzfk5uT4dR6nU2Y=; b=RYLcsVeCN9mncbgytBryEp7IyA7T3ZWAJ0aaSx56Plcz8VAQNJudAzEN0ryx2/6TzTNl9p YhL2/XihKLFa5vTaOP5spDL7s6OaqRVrfsFWTKaUh3aynfPBI2BSiBio5spex85W75Va+D /vEp8IttoWcnzWOyO+FE7mo8WwSA50PVVIbCsHcDQDN2mnIBkPc9l4KXJqxwEpUuf4BZvm 9QtHDQA4mwA4GCSS0qY9Hehv9FWWSsb872F8Py66tvzWOiN91GQi5PGq0GC9PwGNe6t4DF 5whvXCINDPM/AaCJHzv76D6E3oyInBouw8fE/GizgzJoeMCKz2VCaw9ZQMZC1w== 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 4SmDNt00WQzcf0; Thu, 7 Dec 2023 12:39:26 +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 3B7CdP8n049144; Thu, 7 Dec 2023 12:39:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B7CdPfq049141; Thu, 7 Dec 2023 12:39:25 GMT (envelope-from git) Date: Thu, 7 Dec 2023 12:39:25 GMT Message-Id: <202312071239.3B7CdPfq049141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: bd7b2f95019e - main - 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/main X-Git-Reftype: branch X-Git-Commit: bd7b2f95019e9715150c34736279805de0818d09 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bd7b2f95019e9715150c34736279805de0818d09 commit bd7b2f95019e9715150c34736279805de0818d09 Author: Kristof Provost AuthorDate: 2023-12-05 19:08:11 +0000 Commit: Kristof Provost CommitDate: 2023-12-07 12:34:47 +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 --- sys/net/vnet.c | 4 ++++ sys/netinet/ip_reass.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sys/net/vnet.c b/sys/net/vnet.c index ac937125a19d..9668471633f4 100644 --- a/sys/net/vnet.c +++ b/sys/net/vnet.c @@ -536,11 +536,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(); } @@ -592,6 +594,7 @@ vnet_deregister_sysuninit(void *arg) * deregistered. */ VNET_SYSINIT_WLOCK(); + VNET_LIST_RLOCK(); VNET_FOREACH(vnet) { CURVNET_SET_QUIET(vnet); vs->func(vs->arg); @@ -601,6 +604,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(); } /* diff --git a/sys/netinet/ip_reass.c b/sys/netinet/ip_reass.c index 219a869c5139..a95780aa2f27 100644 --- a/sys/netinet/ip_reass.c +++ b/sys/netinet/ip_reass.c @@ -661,11 +661,13 @@ ipreass_drain(void) { VNET_ITERATOR_DECL(vnet_iter); + VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); ipreass_drain_vnet(); CURVNET_RESTORE(); } + VNET_LIST_RUNLOCK(); }