From nobody Thu Oct 31 13:59:23 2024 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 4XfQbH4hJnz5blT7; Thu, 31 Oct 2024 13:59:23 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XfQbH49P9z4162; Thu, 31 Oct 2024 13:59:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730383163; 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=WY81bY1TNl3KUaYBaRdXwwD7XOgRPXE7q8W2UzEyTTE=; b=X7sGCxhMOT1VRq1o6lF574r6azcvEY6k53YM9LFLGKh3vJ+U0kDgvN2supoN6Ui/ViHD4E kFytnUobDgI1Q9VQ5CrdEJjQtDCR5FEFXN3YB5KQiovoUYKAVl7U8KoNoW0zfzGtOuETIP IyPfNPnCZY/ZAkRaz6IIRnNHf784n5YtHdSp17UYyL0vHtSLnld1fE59SWaMj+Ie0bMLBp t5rMpOdj341Tr0pavYHBq/TxJn9FF70x/j92JZpAgfUHzlXNHFadidV9hbke9wC00F7Flt tufYtbI1bftTmBU/H38KfP4Oj8Xv2z3WPDcDOCnP5NzwBq9RbmltnO5jHvnsoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730383163; 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=WY81bY1TNl3KUaYBaRdXwwD7XOgRPXE7q8W2UzEyTTE=; b=mKSO+e56JA8JXK9sA+qnt+FGioBB05uEbG7nSeJiqeMGBcu1InHvCKPcTfP3LpSyP7H4dc g0Dl+Y9Vzt8hH6DGob9eCvLKFkIVQ+r6IQ57jlTOYy5Ea5HXdciPNGJj59PLrXtXoUKg9A gUd19/9bY253SkWs41YCe+PP35qUdg0ThEcpjvXAcN8h8Xytb0asK4IJsGV3QrXkCI8fb+ /swCs2WY50Q0bISRFrjcGGtcXIt8dc/HRiAnDychTSQNZX/ibBKAHxeXuLyucRJITQ7bZQ /IOLhEySs+pM0WoD3RWRs3N+serPcz/VCC2r4Kz0CataUa2W/hH7ZFNbRtI5mA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730383163; a=rsa-sha256; cv=none; b=KHTwNsWgQddoidizu8dvkiMTCzTSLY8sqZsUI3HbT03gXdyXP7bBzr9FV+jcOGMZmCem8Q bXVaNWpqEvnaAyLM9XLCqKHE+QJqZD3edxlZlCmVIOS5jYv6MUacW1Rr8FQemjGTPg7nGG +7ELoGyJHAIuTTkTQbYM/0FpXDtyV6yoXP2gmYfDYALAITTdP7ZC4Klmi/vz99zz7O0x7B uavw6+guthPMYxLLLPlKyt1ia64npcdXis1O5fW4fX3s+2vmdlj1Er7h6fkg3qAb3Q+RZy bepVAzkzOLzp222gZ6gCR8S/qizDX+QpG7kFTJm4r1OFcFRxyfneJ94ZHtqIxA== 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 4XfQbH3f9Gzf4v; Thu, 31 Oct 2024 13:59:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49VDxNKV030281; Thu, 31 Oct 2024 13:59:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VDxNt1030278; Thu, 31 Oct 2024 13:59:23 GMT (envelope-from git) Date: Thu, 31 Oct 2024 13:59:23 GMT Message-Id: <202410311359.49VDxNt1030278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 1e980fdf7ade - stable/14 - getsockopt: improve locking for SOL_SOCKET level socket options 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1e980fdf7adee2d3ad53b29e192d134bb46d3e6c Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=1e980fdf7adee2d3ad53b29e192d134bb46d3e6c commit 1e980fdf7adee2d3ad53b29e192d134bb46d3e6c Author: Michael Tuexen AuthorDate: 2024-10-07 14:46:41 +0000 Commit: Michael Tuexen CommitDate: 2024-10-31 11:37:55 +0000 getsockopt: improve locking for SOL_SOCKET level socket options Ensure SOLISTENING() is done inside SOCK_LOCK()/SOCK_UNLOCK() for getsockopt() handling of SOL_SOCKET-level socket options. Reviewed by: markj, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46881 (cherry picked from commit 3326ab87cc22cb70a41e13aefd8684ff0feed01f) --- sys/kern/uipc_socket.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 4621339c4429..84d817c9ada1 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -4112,23 +4112,31 @@ integer: goto integer; case SO_SNDBUF: + SOCK_LOCK(so); optval = SOLISTENING(so) ? so->sol_sbsnd_hiwat : so->so_snd.sb_hiwat; + SOCK_UNLOCK(so); goto integer; case SO_RCVBUF: + SOCK_LOCK(so); optval = SOLISTENING(so) ? so->sol_sbrcv_hiwat : so->so_rcv.sb_hiwat; + SOCK_UNLOCK(so); goto integer; case SO_SNDLOWAT: + SOCK_LOCK(so); optval = SOLISTENING(so) ? so->sol_sbsnd_lowat : so->so_snd.sb_lowat; + SOCK_UNLOCK(so); goto integer; case SO_RCVLOWAT: + SOCK_LOCK(so); optval = SOLISTENING(so) ? so->sol_sbrcv_lowat : so->so_rcv.sb_lowat; + SOCK_UNLOCK(so); goto integer; case SO_SNDTIMEO: @@ -4185,15 +4193,21 @@ integer: break; case SO_LISTENQLIMIT: + SOCK_LOCK(so); optval = SOLISTENING(so) ? so->sol_qlimit : 0; + SOCK_UNLOCK(so); goto integer; case SO_LISTENQLEN: + SOCK_LOCK(so); optval = SOLISTENING(so) ? so->sol_qlen : 0; + SOCK_UNLOCK(so); goto integer; case SO_LISTENINCQLEN: + SOCK_LOCK(so); optval = SOLISTENING(so) ? so->sol_incqlen : 0; + SOCK_UNLOCK(so); goto integer; case SO_TS_CLOCK: