From nobody Sat Mar 15 12:31:53 2025 X-Original-To: net@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 4ZFLG13nCmz5qjCm for ; Sat, 15 Mar 2025 12:31:53 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZFLG127Vgz3Gkm for ; Sat, 15 Mar 2025 12:31:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742041913; 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: in-reply-to:in-reply-to:references:references; bh=+uauPlsTaIih3Q0hxzpprq2mPdlfrKIZwPnT+abggG4=; b=GoHKGUIEeTP0m8JwQCOBDs46Mkc6A1lWxAjR2Mejfke38wcay2fR4zEqF3ESvgWx6zyZrj FowrUy7k3QCzV83zn08V/U5iMB2fln0lAnfwNsAEmKRTMTHcTfO8+kgYhC8SwroyuGNqRB XpvV8AfXyE0HohCG3OoHoRkTOUCpggC2dUP9s6u8OemjDTVd/KiUzUuwM+4Nk8IfZUlsuT PmdSclbDaKdDeyO/qSqMhh4aGhuhqfGUoXtxtwrom4eJfLGKZ9DUdklBDq3GSZjGRJXOEe yS99Q4GoSSeYuEdbibbJbur/7axU6EqIqJ2Cys2m1xcB60CYjhPFYeV4RebLLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1742041913; a=rsa-sha256; cv=none; b=hOHNe8ajYhPzfVnA/PpswED3FJDQqdf/kil2pHCetyyr6PDm3LJaI9WSc4aBJCPWeNBrwq dKDdeongkypZAs37WblqX1vuNEIhNKLl0cycPxyOztWajraT0R/0+aUMfLbcnTxIMUv/cl NGeiE062+R8yUOZQ/Sp5pBYK7wfh6OldlZFDrQRnpxUSYPYcj+jW1lXD7wAeODAsgmMq3G NX1eQkP8l2GsTkPI6ipx7Mrq9en7UCyspuaCt/PRK/R//BxhLlEjmdNmJ4hf7YdXERlGBg SZ2V1Yen7a/X8VUeJs3V/PBZyk5nUfoLm45kv/cDVCOPT5TbsRjVZr4a2id/fA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1742041913; 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: in-reply-to:in-reply-to:references:references; bh=+uauPlsTaIih3Q0hxzpprq2mPdlfrKIZwPnT+abggG4=; b=R1xUzwOJhZHWPDpECHs3yZX+FsgPW1Ck4NUVNnJn/jbViimCQa45/kU6heF+7yq/9DnFIB MgF5c+sdRX/xQ7ijTIj741VwVvi0nv/MSER89EIU+MPd4vatW2afy6vzLNVNvg/7gFWEcX CAP2iYa4srAZHu9N+ABplGObVVQgZybaVe/FWS6D9t2X5J6HHZL/2mQGnatoW1Ksb+FG1E X8k1OpAcR0YDUJgIDJA1nIfO7myMxQI0foadidbKQBIRUFIfvJtNHVQaGdTObq4qdPjxlf Fs1ab5JgrnC1+QI1GIbJKIDhmUB1quUEmhQZLeaenDwUyunfy28w10KwhQkrow== 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 4ZFLG11j6qzLG for ; Sat, 15 Mar 2025 12:31:53 +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 52FCVrnl064741 for ; Sat, 15 Mar 2025 12:31:53 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 52FCVr0Z064740 for net@FreeBSD.org; Sat, 15 Mar 2025 12:31:53 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: net@FreeBSD.org Subject: [Bug 137145] [mbuf] Reference count computing isn't correct when more than one threads call function m_copypacket Date: Sat, 15 Mar 2025 12:31:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: avg@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: net@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D137145 --- Comment #10 from Andriy Gapon --- (In reply to Gleb Smirnoff from comment #9) You are right when the scenario is going from one owner to more. But there is a scenario of multiple owners, some dropping their reference a= nd some just getting it. For example, let's start with refcnt of 2 and three threads: T1, T2, T3. T1 and T2 are getting a new reference while T3 is dropping its reference. There is also another owner, Tx, that just keeps its reference. 1. T1 reads refcnt, sees 2; 2. T3 decrements refcnt to 1 3. T2 reads refctnt see 1; 4. T2 proceeds to non-atomic *refcnt +=3D 1 and reads refcnt as 1 again; 5. T1 proceeds to atomic_add_int and increments refcnt to 2; 6. T2 sets refcnt to 2 as well (based on step 4); In the end, we have 3 owners (T1, T2, Tx) but the refcnt is 2. --=20 You are receiving this mail because: You are the assignee for the bug.=