From nobody Mon Oct 6 16:22:46 2025 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 4cgPgp4HQWz69cG9; Mon, 06 Oct 2025 16:22:46 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cgPgp3M5Kz3n8K; Mon, 06 Oct 2025 16:22:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759767766; 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=KCau6xOUuIskp5FeIBGsGWYvoH7JXocJrI4T9qMPlic=; b=Tk9kgXZzwXgVJxCMxmaJKrFltI769Y6KBICEcenoRUTD6FtlJG1XnZmDHr55Pg0FmfTh1e URZQS/VqGKkSKSaf+zerupAN7WzfSyBCai6zPBCS45p/7TWFpay3w6ynKpSrg9P2p42E+k sDkKeswrX7oGD3Yb28HSi2tgDlAnTNm8buWExzwpXRgqRrJgaUEJnIx4Ex8QwjeWS/AKJS CHYBDKyaNaKq6vyj3OCVdKXfd2ssD1+0OVcVyolO1BlNEfxr6EIwqUeD7c7a8SS4aAnHr4 mMb27PEeE8N5I/9/oKFSyL0nkqXVQTxz/B5tLLmjZdEHREWtLw3esz69U5ZvPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759767766; 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=KCau6xOUuIskp5FeIBGsGWYvoH7JXocJrI4T9qMPlic=; b=JrUUshhzIv7BMwzA43yUbUWf1jQcePrmNe4gAJ2vfrkP1NM6ORKCs8BWnlJWWfkM7VAN62 ymrL5Dqkr7igwGPM/tEVdDLTNNrYEyhn5h9WAeojwaJJDeMbhoK8BmzZO28VWqyVVE/muI G9X6fY0vNkFD+yA7EY7dRiPa7E2qzHGqkHovhA2UE9OFgAuET+45vEmMne7t9mBJDzah2w T5BvEHWkk1y88rONYSFfMumM2g1NdEDeb+DpfXa59qJUliTtaym0SrslynA+J3wx0WAbJ2 5NwpZMoZjHYTHTVz5nLzDE4zPUhq++wKrpoyv9U8jruPO4iBUdBM3GB/K+Or3A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759767766; a=rsa-sha256; cv=none; b=RmEWztsVj03BwonBfoTRGhXny8ArdT0485B3lqbK3yd0OWGoZ2btD2/0BQrH01wQixFZzV +4rsD+g0pxdlRaP/tq/TQFcTZUQijk05AJ+3NjILTWNpmxy+bZXR1Ppk9jPeKd9ceHlMfC 5UckbbMbbBA8Qz4iJVYd/VvZPJ/dyYa9Q6z+4TXV+Ts0A6S6C+t45xlfJqBxSv3ml/UK9p TLVkXlheFXJ39KatQIQzWS0eUNDsuxJkBZ5V/A0+mRMiL7ENAqanJq+Fc7oDnNvGJrWJuB 4wqORbJWf+RrfD2ADgWgOIk4PM78xj/1Zn6MqyBZ90wAdNIiepixg/jvQLlFVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cgPgp2r2Sz165H; Mon, 06 Oct 2025 16:22:46 +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 596GMkLT057565; Mon, 6 Oct 2025 16:22:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 596GMkLl057562; Mon, 6 Oct 2025 16:22:46 GMT (envelope-from git) Date: Mon, 6 Oct 2025 16:22:46 GMT Message-Id: <202510061622.596GMkLl057562@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Jonathan T. Looney" Subject: git: a1f20ce89403 - stable/15 - tcp: close two minor races with debug messages 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: jtl X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: a1f20ce8940363bab22839ab27fd32e87413987b Auto-Submitted: auto-generated The branch stable/15 has been updated by jtl: URL: https://cgit.FreeBSD.org/src/commit/?id=a1f20ce8940363bab22839ab27fd32e87413987b commit a1f20ce8940363bab22839ab27fd32e87413987b Author: Jonathan T. Looney AuthorDate: 2025-10-02 17:26:03 +0000 Commit: Jonathan T. Looney CommitDate: 2025-10-06 16:20:33 +0000 tcp: close two minor races with debug messages The syncache entry is locked by the hash bucket lock. After running SCH_UNLOCK(), we have no guarantee that the syncache entry still exists. Resolve the race by moving SCH_UNLOCK() after the log() call which reads variables from the syncache entry. Reviewed by: rrs, tuexen, Nick Banks Sponsored by: Netflix MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52868 (cherry picked from commit ad38f6a0b466bf05a0d40ce1daa8c7bce0936271) --- sys/netinet/tcp_syncache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 7f842512858d..def6bc886617 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1201,7 +1201,6 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, */ if (sc->sc_flags & SCF_TIMESTAMP && to->to_flags & TOF_TS && TSTMP_LT(to->to_tsval, sc->sc_tsreflect)) { - SCH_UNLOCK(sch); if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: SEG.TSval %u < TS.Recent %u, " @@ -1209,6 +1208,7 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, to->to_tsval, sc->sc_tsreflect); free(s, M_TCPLOG); } + SCH_UNLOCK(sch); return (-1); /* Do not send RST */ } @@ -1280,11 +1280,11 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, * SEG.ACK must match our initial send sequence number + 1. */ if (th->th_ack != sc->sc_iss + 1) { - SCH_UNLOCK(sch); if ((s = tcp_log_addrs(inc, th, NULL, NULL))) log(LOG_DEBUG, "%s; %s: ACK %u != ISS+1 %u, " "segment rejected\n", s, __func__, th->th_ack, sc->sc_iss + 1); + SCH_UNLOCK(sch); goto failed; }