From nobody Sun Dec 14 19:28:08 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 4dTtWs1033z6Kjdq for ; Sun, 14 Dec 2025 19:28:09 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dTtWr62gZz3G4G for ; Sun, 14 Dec 2025 19:28:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765740488; 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=MtWjAIz2K6VBaE1/6pxJYUTpRFG/MUKcl4NIuFYfZ5s=; b=DbCkMos/g1xZ7cXOADH5iyV1jMariLpEoMWIrMZFjNL4oSFMKzAaIunstyWIj2f+SGzI1T +ZENZ075pSC0QehgkkeodG4raJGBUC/DWZrstVTAALC75qwb/VPZOG5esZ9O9tq6tOvEJ3 6W01IcfhzZn95hHizOOw1ljbE1dZd2M5ppWurepl2+yNLxEZYDmPJ9sZ18AR1gvHZ/sGRA OaawI+gXD280WZDRTXdw7nWOKemWigRPjBAIEXG4HHJdxVzAjFkJrbeLZNVY45jolwy9ek n0GyFSF/1GYCZ831sem0xIGEF0EODnG037kxw2UCoMCuxxAP+Y2h0bD5tyffzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765740488; 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=MtWjAIz2K6VBaE1/6pxJYUTpRFG/MUKcl4NIuFYfZ5s=; b=cU02a6XLp9eUmxUQEfUHD8Y+GfdDdoHPSakStmzUWLXv1pl6lZUmkvnK9tLv8O92g5Nca3 4fKBKD0kRAP2dJ0tfWf/Zd4b8hG7/9bPJzaJbQTPyY3ATqvU1MIH35iXP5LACB3CHp+DHN P629lPNGxNxQuVks+BaGCE+mAasTQWMLqn+oBeqZ/2cpEv7Pbosr3Osy5zZ9nTTCi3Z4US buhRl4mtZ+rhh4FkpNxYbDCqQ6+m34kSmN5DN+sL9OxpNjpZj9ybTiWpqk4nGliOxXUJBS 6nmLdgXV2ROuh9cy7q1jU6kzPiCzcoG2knLNOMU4fAdcQob+WTpx7e1DZ0yLVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765740488; a=rsa-sha256; cv=none; b=oRAf26NRKcbG+yny2Q2dGyzBb9FUqcr1SfPeR/3NIa9RyVx7oBJLDbz43pu+/6NmhokS86 ZnRcfleHZGwvu6nsTBuMrVVjiNjHFNt3PviZt8OTWOTWz0GLa+uVW7kgnU19PLRW9laeVI bGmg11HcGhuXI0YJrBiABduPcr8E+ZhvfEFaAt1PEbCLwPGCC4rYB9rOkV5Wln2AkeXkas QLLp30qlCZLtxLuJjn7xRRB9tx8GhrGenJZzYDjjt46HoBmcLIMm1q0o9SbpYTeF/DYBWN aF50W2Vc0mOrLLhdnh9i2ys2gCdzjw6DzpKI54R6UslvqYYzeldUtEWsL4o8oQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4dTtWr57Jgzn5s for ; Sun, 14 Dec 2025 19:28:08 +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 5BEJS8n2067079 for ; Sun, 14 Dec 2025 19:28:08 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 5BEJS8ER067078 for net@FreeBSD.org; Sun, 14 Dec 2025 19:28:08 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 289017] [lagg] A time-of-check to time-of-use (TOCTOU) race exists in the Link Aggregation (LAGG) network subsystem Date: Sun, 14 Dec 2025 19:28:08 +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: 14.3-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: hanguidong02@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- 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=3D289017 --- Comment #7 from Gui-Dong Han --- (In reply to Zhenlei Huang from comment #1) I can reliably reproduce the panic on an unmodified GENERIC kernel within seconds using the scripts provided. However, by inserting artificial delays to widen the race window, I captured the specific stack trace below. Crash log: Fatal trap 12: page fault while in kernel mode cpuid =3D 2; apic id =3D 02 fault virtual address=C2=A0 =C2=A0=3D 0x40 fault code=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D supervisor r= ead data, page not present instruction pointer=C2=A0 =C2=A0 =C2=A0=3D 0x20:0xffffffff82825bdd stack pointer=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D 0x28:0xfffffe0068= fc58c0 frame pointer=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D 0x28:0xfffffe0068= fc58d0 code segment=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D base 0x0, limit 0= xfffff, type 0x1b [TOCTOU_DEBUG] SIOCSLAGG: Change! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags=C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D interrupt enabled, IOPL =3D= 0 current process=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D 860 (poc) rdi: fffff8000363c000 rsi: 00000000d1f2023f rdx: 00000000000000ff rcx: fffffe0068fc58ec=C2=A0 r8: 0000000000000800=C2=A0 r9: 0000000000000008 rax: 0000000000000000 rbx: fffff80004a08300 rbp: fffffe0068fc58d0 r10: fffffe0068fc5800 r11: 00fff58b8d9e8b8c r12: 000000000000000e [TOCTOU_DEBUG] SIOCSLAGG: Change! r13: 0000000000000008 r14: fffff8000363c000 r15: fffff80003624800 trap number=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D 12 panic: page fault cpuid =3D 2 time =3D 1765735007 KDB: stack backtrace: #0 0xffffffff80ba8f1d at kdb_backtrace+0x5d #1 0xffffffff80b5aa11 at vpanic+0x161 #2 0xffffffff80b5a8a3 at panic+0x43 #3 0xffffffff8104dbfa at trap_pfault+0x3da #4 0xffffffff81023e88 at calltrap+0x8 #5 0xffffffff82821f7a at lagg_lacp_start+0x1a #6 0xffffffff8281fa25 at lagg_transmit_ethernet+0xb5 #7 0xffffffff80c85c5c at ether_output_frame+0xcc #8 0xffffffff80c85a50 at ether_output+0x6b0 #9 0xffffffff80d21a48 at ip_output+0x13a8 #10 0xffffffff80d52cf0 at udp_send+0xb60 #11 0xffffffff80c0145c at sosend_dgram+0x31c #12 0xffffffff80c0242f at sousrsend+0x5f #13 0xffffffff80c0aec0 at kern_sendit+0x1c0 #14 0xffffffff80c0b1f2 at sendit+0x1b2 #15 0xffffffff80c0b02d at sys_sendto+0x4d #16 0xffffffff8104e547 at amd64_syscall+0x117 #17 0xffffffff8102479b at fast_syscall_common+0xf8 This crash indicates that lagg_lacp_start was executing after the protocol resources had already been cleared by the detach routine. This confirms a severe lack of synchronization between the data path and the control path, which can lead to various race conditions. I strongly recommend validating any proposed fix by running the attached stress-test scripts for an extended period. --=20 You are receiving this mail because: You are the assignee for the bug.=