From nobody Thu Dec 14 11:20:44 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 4SrVJr6Jzzz53qX5; Thu, 14 Dec 2023 11:20:44 +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 4SrVJr5vnnz4WSH; Thu, 14 Dec 2023 11:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702552844; 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=UviZVb5Pz1j/3GoUHf3gvNKx5Q2bMM9mXEKRLCD/G2o=; b=UCK9eiAbz02Nd7Mr0xk81Hsz4TtAmZm87lFsqqW05NTN1O0LExR1Dm7qnUGTcovAwnDCSh VESmjKjAOIE8jZ33uV2Qih4+VqOoZCnWQvsloSc3Kh6gIaasx9d9yGboljubchjybKaK7S fZCZZXmK2WXoekL+J/1oJM8IbJV0qGDukggMBUMopsDBhcgt6Ch2TaL2ZpxfCFfWr0O0du OnYyqjIlylVO+/4SoH0QJ7MiQlv5sFObItrxZO53q6m6xbjflVi8e2mEJumpq1S03wDI8A VPU7trqHpDH6Ci4GFthZtW1jHA6Sc3Gz9mqD3Q8eBDnxJ433duPup7AN3Y2Hjg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702552844; a=rsa-sha256; cv=none; b=W9//95YJD12U7WbgcmgT7U3gzZZLYQ6CuzDZ/uHiwd3DHvegqF2aQLGctOgzMsdNEnSk3X 3Hv2xfG2b5+phq8LS291SPFydHGP7D06xFJO4EmyNinALEr2cbzDszq4gjx/+K8/DYJtzL u6XWnwb7zc9TAOn5Q04+uhTRnKknAosRuRktjkRwP45E3dm3MFqT9Gzd7pp3+cMowxaNB5 Ld/7hrDy3WLQTQDSEffmv4dPnzEK7+QmOhYS72omZtVTm7w7+n2kMupD8sgXjbOsoRe/Kb wvhLqmwO8ZW0sewEjZBsGcFD8oyNETQ6kNKbQhY5r1UxyEf488GuargVwHtkzA== 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=1702552844; 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=UviZVb5Pz1j/3GoUHf3gvNKx5Q2bMM9mXEKRLCD/G2o=; b=vtfJPAkfQOKKHZpPpx/WzmeXqI6MvNleH1icRNxkSyPr3gA9+Jo66T9rJ1VAbMNQKSukOZ KKHOnIhSI19kW3fgNHjSF52iNhTJ4k+sNKmfayFPTKLjIujL82mL1/uwIut1s04UilNcIe ib7Cu1ROOLivQ1KPsfeJHQBO7FUNsUL4hF+ZhRFzQTkbYYH0WtMntJHZyMiGVNz0c8pmIO Tz6wEvFPHSYILpfVwourZCDLj6uW+Um29+8BMKaWs7Gl5557wn488xTZ/pg+WN7ELPU76X JhF4GwDJgtIwnNornENfLj2DqfsJwN214mJSdVRDPphLcV/vwjruBXIf60inSQ== 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 4SrVJr51LYz9gX; Thu, 14 Dec 2023 11:20:44 +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 3BEBKibW036905; Thu, 14 Dec 2023 11:20:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BEBKiX8036902; Thu, 14 Dec 2023 11:20:44 GMT (envelope-from git) Date: Thu, 14 Dec 2023 11:20:44 GMT Message-Id: <202312141120.3BEBKiX8036902@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: daaaeb3051bf - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: daaaeb3051bfb9b1a030b7623778c3ec251b2b2b Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=daaaeb3051bfb9b1a030b7623778c3ec251b2b2b commit daaaeb3051bfb9b1a030b7623778c3ec251b2b2b Author: Kristof Provost AuthorDate: 2023-12-05 19:08:11 +0000 Commit: Kristof Provost CommitDate: 2023-12-14 11:20:25 +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 ++++ sys/netinet/ip_reass.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sys/net/vnet.c b/sys/net/vnet.c index c4a623698341..5dec0433d31a 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(); } /* diff --git a/sys/netinet/ip_reass.c b/sys/netinet/ip_reass.c index 6f33c7a8a54b..2876e5bfdcdc 100644 --- a/sys/netinet/ip_reass.c +++ b/sys/netinet/ip_reass.c @@ -663,11 +663,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(); }