From nobody Mon Oct 07 14:49:16 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 4XMhqw3xyXz5YHjQ; Mon, 07 Oct 2024 14:49:16 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XMhqw3N59z4LWX; Mon, 7 Oct 2024 14:49:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728312556; 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=WAG5RNw6CxPuAyvWFifGZ9OKs8JnZAAuxDJKKjueGDs=; b=GwK7dLWvmbwRCaIpxOmAADfR5Tjn/jeUISgv7U3aE0wq3vCsjfWgZlVlx8qWS26K+9DkEF LKb6SvVfYgV9djWxEc76/0PIXp+/zD+2Nxhy/9Hycv9Hke71C2jtVQ4tupDvdyNq/FhkTf oSBezLDUm0cGoL7CobAittNPCV/usTyvZIMX7Vg9ZvcCuRFcYTyDbyTU6rW0YNds//YLQO AGp6zE0OqfUx7jqfsnEWrr4aOoQ+eNiTtPAWHs6W6D0cCGGWVgOe9M1lswWgrYCH1mkkAR juuHckZ02alAeUacxDl41mhvZBUPfsX7gOEYVVZXcM0wBPdzvzRbzX09gdKs7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728312556; 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=WAG5RNw6CxPuAyvWFifGZ9OKs8JnZAAuxDJKKjueGDs=; b=OrBVL+O5LzN75nqgRPQd9cIxhscWNbqJwJ7hU99OyFwVnUOFKS92jUkwqI5j3nhlQNsYar s+k//5SYIRJLehzzKhBqQq1L8go335NWA0x0lyH0BAxAtIId+ac/5txyQGG0vmTBKxxG+V 4l5dzUIolAQbNVkYrYjWDjjoP3zKDDZhtThixxA7aiGTBgWfbjqR4Z04kOkLcDEqMdNRWW 3mICaGdu/0xqvLJXstu4fAWWiOhpAkLeXy+uE5ANIMRM2+e15QlWUSnVk7i406tzvtw6jG Se43RgvRC96RiyVcNxmmqAVrIioih2Mg/nygt8SumW/AZmKgCRQMK5vKn8tisg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728312556; a=rsa-sha256; cv=none; b=g2h7w5yF59ns2KKkhEoLncn3WC1B8REfb+Ii8NnNwHBunvGAhFn6JUl2Kn1cvDP3GMD1Bj L2jM4ULzJvcX5kfuHcpw1nD8TM8VCmZmZXlAIU1LJHiGZ5Pfn78Pe19xF/jJ/ivMi1YZZC ZTBBNiUpfmqo5PUuLSL71kV9LA2pY2GD5z6nebJjQkPgGMfXM5W0cd26ZyvQekMb5OrmBS JEcMVZhRtJ6mIj35Qo3xzajxaWdOM0JcN7Yyvz/7dS9MngbFZHMJ/MQYK118P/SpJ41SZ2 CvMMYwvxEzqm357q4eiLcWj3HZiDVVD1vpPqCSxDXTapXLUmAQVDX/dtW/rwmQ== 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 4XMhqw2zLVzqlx; Mon, 7 Oct 2024 14:49:16 +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 497EnGgP081584; Mon, 7 Oct 2024 14:49:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 497EnGKw081581; Mon, 7 Oct 2024 14:49:16 GMT (envelope-from git) Date: Mon, 7 Oct 2024 14:49:16 GMT Message-Id: <202410071449.497EnGKw081581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 3326ab87cc22 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 3326ab87cc22cb70a41e13aefd8684ff0feed01f Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=3326ab87cc22cb70a41e13aefd8684ff0feed01f commit 3326ab87cc22cb70a41e13aefd8684ff0feed01f Author: Michael Tuexen AuthorDate: 2024-10-07 14:46:41 +0000 Commit: Michael Tuexen CommitDate: 2024-10-07 14:46:41 +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 MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46881 --- 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 189e8ca5b498..a139a9d1f301 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -4117,23 +4117,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: @@ -4190,15 +4198,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: