From nobody Mon Jul 11 15:51:02 2022 X-Original-To: bugs@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 AE52417FB123 for ; Mon, 11 Jul 2022 15:51:02 +0000 (UTC) (envelope-from bugzilla-noreply@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LhSzB3JcCz3F6X for ; Mon, 11 Jul 2022 15:51:02 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4LhSzB2MP2z18jx for ; Mon, 11 Jul 2022 15:51:02 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 26BFp2eX028358 for ; Mon, 11 Jul 2022 15:51:02 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 26BFp2hc028357 for bugs@FreeBSD.org; Mon, 11 Jul 2022 15:51:02 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 265154] tcp: syncache_expand() potential race Date: Mon, 11 Jul 2022 15:51:02 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: kp@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657554662; 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=mIUFMUUQkBAOLj8+4P1NMsKlZOACBiN1bbEJUuW5OO0=; b=ElHEZGaBX0eKh/eEF5q2M/5pMl2jkYa7jIDTdm8SVTlbFwueMPW+hopwQRTk8eTfczk3yT t+ZXbzLEtkesqHbRFnzeYWfWOYNVvWTKu+SE6Qlb1TaSy8yWOG7bVisvxKRmbsH8/lOXsV J410qD8ljjn/XEyJWxbDh1W+nVs3jXz1iXcPRQssAdoOLFqg5gcACXst+UNlRoAFUJi3Pm Jb5q0o+IzeUeOfBNon9LA9hJMzseD2MzJ2Me/+65T2mOXhx83fF3+x3j3mh2n/AmO1RYPI j8yq72a7xcVcP3kHjQ7u0sReUQ/r+gKTVpyvhIuChtjAI+0I8uJBSqywaWwrXQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657554662; a=rsa-sha256; cv=none; b=afuohjsQ1DYUvkNRcZ0YckS6nqeO1m93iG6tdBezwpbJFZbInIvC8xZBSomtOCG3BuMP9o OUKXTgDRP7tQhQpmH6h5xrKXGIsGYaSuXMD97RBAr4ykO+iToyC0T13yMzjlVOtIQDYs0+ IqN2OUhIZNfhbjMx4+tEAfdB4mZOPlDlHmnqybDeXzHxM9S7Wni2NhFD5cCQ3SNSS4hVcB epnP97n3KBTKOG+abfipthG/SiaxN2juZg9r9/Z+SL7nC8KOycAzxnBHGvCZ7C3c3+85T7 ogDYYCHmDkijtoV6VMAJgiRLh3TdhPWDvuO5v6xXN1XFlENI3tQst/uilR8jSQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265154 Bug ID: 265154 Summary: tcp: syncache_expand() potential race Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: kp@freebsd.org With 'options RSS' set the 'pf:syncookie:forward' test case often fails. The behaviour is not consistent, but it is reproducible at least 50% of the time. The failure mode is that the TCP connection is established (full SYN/SYN+ACK/ACK) exchange, but the first data packet receives a RST in response. Up to that point the exchange is identical between working and failing connections. Within the same setup (i.e. without re-creating or re-configuring jails) the connection will sometimes succeed and sometimes f= ail. The test forwards a TCP connection, terminating on a vnet jail on the same host. Because pf's syncookie feature is enabled the code path passes through pf_send(), which calls a swi, transmitting the packet from (potentially) a different CPU. This appears to be due to a race condition in syncache_expand(), where we remove the sync cache entry (`TAILQ_REMOVE(&sch->sch_bucket, sc, sc_hash);`) prior to actually opening the connection through syncache_socket() (i.e. inserting the inpcb through in_pcbconnect()). If the race condition is triggered, we end up not finding the inpcb for the= now open connection, instead trying to look up the connection in the syncache w= hen the first data packet arrives, failing to find it and resetting the entire connection. --=20 You are receiving this mail because: You are the assignee for the bug.=