From nobody Mon Oct 17 19:40:05 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 4MrnQF3Tfdz4fHXS for ; Mon, 17 Oct 2022 19:40:05 +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 4MrnQD6rzjz40wp for ; Mon, 17 Oct 2022 19:40:04 +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 4MrnQD5yS9zwQm for ; Mon, 17 Oct 2022 19:40:04 +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 29HJe4Q6050014 for ; Mon, 17 Oct 2022 19:40:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 29HJe4kW050013 for bugs@FreeBSD.org; Mon, 17 Oct 2022 19:40:04 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 267159] SO_REUSEPORT_LB race conditions Date: Mon, 17 Oct 2022 19:40:05 +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: markj@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=1666035605; 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=ZxfqEU1HJV2NTEzoPolgu62lWcWtoncimH4YwD5x5b4=; b=FNxUI2gy/uuz7LC01DWOrNtgf9qpqZkQA6wZRkBOeR+gqHb+9O1WafSZDjswXYsGc5fQML p6eAMSB3TbcFWoUuxWEmnfz2Clz9nM+HAMgpi0CfixbjnEWGmrm+1WzUGDHz/yYXe6vsA4 8h9myKxoGi2vKlql/WUuW01YMj8WMbThPzFfpVrrnmgCNchjl4H2v5616kON2yE9uO/mP3 ifr5N7Ean9BuUxlunh4ieq9hEHlmgM1kbaXwD+2eqpKWR3K/4m+py66myR4WYxloPEydyL 5WchpGkv5Mcrl3vJIeXscYoiA9wGl9QIBTqmiFpbtm1SL1G/FxpsYy3zGDBolw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666035605; a=rsa-sha256; cv=none; b=nLA8xT37/xxJ6ZCsJqoOOR0mNEy3xBd6BflYTCyudCKs4qIZvFjHhgM85ZBXlrErYW6x7j HFLhF9sB4lK/pQBWC4i1qO31md4IJAA/PoHT7semoE6e77H8Jof3PN34AoWOhmkCcxmXPq pHVgw3WObP48tOyWCDP2niniUsXSg3RVN2JJ921188PG6JL8fDMhtDIG728jehW9w79gLD 7zevays3uMu8Ej+cWLh4OTDKOIqz4xCJGaqIgR/qtp48YG4XayoNggyDChFFCTPfAn6Gk/ J4upFmVbDM+GIjwCsVg80wo7LcK36XSKEeQcuNo9yJ0rq3zHexdRDWTZTiqALw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267159 Bug ID: 267159 Summary: SO_REUSEPORT_LB race conditions Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: markj@FreeBSD.org net_epoch permits in_pcblookup_lbgroup() and in_pcbremlbgrouphash() to run concurrently, but they weren't written with this in mind. The latter may remove entries in an LB group, after which it compacts the group. If a new group structure is allocated, in_pcbremlbgrouphash() puts it at the head of= the hash chain before copying the contents of the old group over, so there's a small window where we have a group of size 0, which can cause problems in t= he lookup path (kernel panics or inexplicable connection setup failures). I think there's a similar problem when growing a group structure. Finally, the group structures are not really protected by SMR, only by net_epoch. We should probably never shrink the group structure, I don't think it's wor= th the complexity. When growing the structure, we should populate the new one= and issue a memory barrier before making it visible to other CPUs (i.e., before adding it to the hash chain). --=20 You are receiving this mail because: You are the assignee for the bug.=