From nobody Thu Oct 2 20:09:46 2025 X-Original-To: dev-commits-src-main@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 4cd2vZ6GZGz69xFG; Thu, 02 Oct 2025 20:09: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 4cd2vZ5WKRz3QCZ; Thu, 02 Oct 2025 20:09:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759435786; 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=h4m1mFSxHBBcY06e16d5oZ/jGtceQTPERr7s028Rb1c=; b=N0jc7hxAzfUzEfm99PUUqlHTzJTlWttypperNHcFDF9LmYYSsrsl1i5ql8ZFL+DCWUzarg JQAOdJOu9Nkk+F6OhyzaLxRdMJl8HBrxkzVKqYAN22UuuYdMSevT1oS3qo56GcseSN/NAu FkYWpmgCqEVpaNdhOTOPeAg2O40iZVCcnvzbajy1WNC6ZQGvNVupLHFSTc1Kvmufwpz5iz 8AMV16Q4UC5b0PEy3iQrO2kZUqLaLCtSnAJb5tRyg1kE/iLjx8Vgr2tNY03tFB0DQDVTqg qNJR3UNSF437g3f0mSHbJC2qeH0ORnLrqRzh2VzoxUGc/JgAiP4J9z5r4iKbtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759435786; 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=h4m1mFSxHBBcY06e16d5oZ/jGtceQTPERr7s028Rb1c=; b=c3PaY9SxFDbJDCcC2YURrXELrcavwQiCxt4WQTEGJ8hOUs3pBw64N82d/JPoHILd3ytxxm 82Ag8ncVxYnDQcH0fF12MVEA45qL4yivkToCcTm5ckvWbDwxs4vRENxnPal9idpk13OKo/ pzWXHBhS+2bwRt7Qtyomz2c+iRNVmlshtzCQrfMx0f+8iKGNu7e9oAGGz8znj62Z3vNC1I wY4MhGJ9o8QqvqvC3fvmub0uvNmunLBvm6I4NfIvgixUDU+KNHe0jdOToVedC6CkNkHHMF FjzEZj7YweRm2AS9GYoxqVZMx9GFV8L+7A75Df56ERFdOYCWWBd2gv0girtK3g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759435786; a=rsa-sha256; cv=none; b=wP3nVGP9lhcWkeKUu+aYHLAe1VheByltRCx6/mJfIKDcRKLIAM9iWJ9gTJTRNbaQZzq0dR inJxYvh+X1RB6a5A5IHtYY5vlhSYyxi2nS23CSkQ7LhXSTn3hbnwVxCyW6M5c9Xvl3ULZY xItTOd2njHjmbAcAeYW61L4TBVZuk08xtRO0nVU/cHAjOvcjR34x1MUuFx9ODE8+HzXaC6 AXhCn0OMkdj1pvoFXodIvFR7ihNaVOmw4X/dq6CrnyObudO1oXKP10q2vseQxOwU8rnUsk Pqglw5vzZxFw4mHf7fCLhaQxo3InTCBBAvGm6KpAk9Bj4GHXhM4ZqnNK4B7TiQ== 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 4cd2vZ4ygmz77x; Thu, 02 Oct 2025 20:09: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 592K9k4q096845; Thu, 2 Oct 2025 20:09:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 592K9kqH096842; Thu, 2 Oct 2025 20:09:46 GMT (envelope-from git) Date: Thu, 2 Oct 2025 20:09:46 GMT Message-Id: <202510022009.592K9kqH096842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jonathan T. Looney" Subject: git: ad38f6a0b466 - main - tcp: close two minor races with debug messages List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: ad38f6a0b466bf05a0d40ce1daa8c7bce0936271 Auto-Submitted: auto-generated The branch main has been updated by jtl: URL: https://cgit.FreeBSD.org/src/commit/?id=ad38f6a0b466bf05a0d40ce1daa8c7bce0936271 commit ad38f6a0b466bf05a0d40ce1daa8c7bce0936271 Author: Jonathan T. Looney AuthorDate: 2025-10-02 17:26:03 +0000 Commit: Jonathan T. Looney CommitDate: 2025-10-02 20:07:50 +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 --- 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; }