From nobody Thu Oct 31 17:00:02 2024 X-Original-To: dev-commits-src-branches@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 4XfVbk5Z0Rz5c2bN; Thu, 31 Oct 2024 17:00:02 +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 4XfVbk4C8fz4m2x; Thu, 31 Oct 2024 17:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730394002; 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=pfJQ9mJ3a+AKf2c3Zx7nNrl7c5ucvrZizhzBw+LEjT8=; b=jGT/P3eHtuuS4h4ToljZXmOQy4vwC0FMXl7xlfCzIpI3eRuANb1jHk5m6nZVS6tc1hJk4W t0lm0W54GcrGWW4kIiDUGRYzM/Z9KSh4QZ6NtiMGYNzLkzDow3jYXeRWYXicoThR70ZzaN DXhdk9M86BBBwsmU6jE0N1u2HYt/AKqjIwXeiIX5REDaMJ7CIyXhvWDUdhY0P45ReZIuzx xGeUO7Oxl3FL4ue1RmBrZRNfVm0Jd7B0Sz1SLJCxSieai/Zw7+Zo3lfETcaBzNA1yY2xCc vXecwvKEhlHYxuVaYZgGMRQ8uxkaQqYqAbyBQ+IdIcW+yz2Nl0gZG5la+ogffQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730394002; 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=pfJQ9mJ3a+AKf2c3Zx7nNrl7c5ucvrZizhzBw+LEjT8=; b=mFErq6jeCuYa/7DWFghkYvWVsOoRR3yrX+/qeGJIJwHfXecdTcaRzSRyPnuixn75M3NQiQ JyT9VuejiyZ/RlBv+jkPkGUPhwT3yjBZIHNvD88ic5VQEcQw2KEa6+YBEV0g+VlZxz0jUH PYaVzsOaozz2MKPLnD5dERevI0+F5d65YwRtIVJUbx9q5Q7xUClUM5KfqzRx2PKofv+JAM uJMJPxjmHH5LfsOTJo9LfhkebKFIoGexXv5YslgOm392Iq7o4LZ/DM0touPskXlUCc0GMR tIIkeSxezQtTsCWcZGddyViuMbH23L36v+CKBZSnqTNQrXc8gnYvjQOKspp0Nw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730394002; a=rsa-sha256; cv=none; b=DNcXXHZSY2Q6Nw/4CioFA4QT7QQr6UpdujOw6JsCheax2AOXH3cTM4kRs7ljrg1NymfYDJ C3L+NI0bi9UtcCpUTq2icvtbXL4RxWg9PcZ+Zv7wZo+aR/Xl7KBE0nEB4dLJN+1W6vXL+H 574O+O8kUsLSgJWXfA5tAchfi+ho7FGdS940HDsotLTVjoC6A85JeYip6JrJjpC+znDcpq IRTS27nqS42h1F1e/Wdmnkk+6kaBu6iz0w+kLVD6Z+lIMF0xIyFqIfOgQUZis+fH1fqAmP zjR4ErjalJKqjP3Bpy78EwjLrqrACpFVwwns6lIJxlaT2nNy7G4nyeqQE7Q/5Q== 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 4XfVbk3hw9zkq3; Thu, 31 Oct 2024 17:00:02 +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 49VH02bu075496; Thu, 31 Oct 2024 17:00:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VH02S7075488; Thu, 31 Oct 2024 17:00:02 GMT (envelope-from git) Date: Thu, 31 Oct 2024 17:00:02 GMT Message-Id: <202410311700.49VH02S7075488@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: 6fb92db1b362 - stable/13 - getsockopt: improve locking for SOL_SOCKET level socket options List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 6fb92db1b36221e7025f36085ea04aca1561ca58 Auto-Submitted: auto-generated The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6fb92db1b36221e7025f36085ea04aca1561ca58 commit 6fb92db1b36221e7025f36085ea04aca1561ca58 Author: Michael Tuexen AuthorDate: 2024-10-07 14:46:41 +0000 Commit: Michael Tuexen CommitDate: 2024-10-31 16:59:34 +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 9cbc5c1f2f7a..81145ff1e1ac 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -3331,23 +3331,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: @@ -3404,15 +3412,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: