From nobody Mon Sep 27 19:32:08 2021 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 9A33517DF69B for ; Mon, 27 Sep 2021 19:32:08 +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 4HJCSm3fz4z4dZ6 for ; Mon, 27 Sep 2021 19:32:08 +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 5F4F7169EC for ; Mon, 27 Sep 2021 19:32: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 18RJW8qh083675 for ; Mon, 27 Sep 2021 19:32:08 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 18RJW8sS083674 for bugs@FreeBSD.org; Mon, 27 Sep 2021 19:32: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: bugs@FreeBSD.org Subject: [Bug 258751] race between pfi_kkif_update() and if_addgroup() Date: Mon, 27 Sep 2021 19:32:08 +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 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258751 Bug ID: 258751 Summary: race between pfi_kkif_update() and if_addgroup() 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 We have the following syzbot report: https://syzkaller.appspot.com/bug?id=3D6698f3333928ca407039fd0bbe9238983681= 936f The crash happened right after the fuzzer started, at a point where it would have been creating a number of tun interfaces for packet injection. I susp= ect the following race is possible: - Thread 1 creates a tun interface, which is automatically added to an interface group. if_addgroup() creates the new interface group and adds the new interface to it. Then it drops locks before generating the group_attach_event event, and is preempted. - Thread 2 creates a second tun interface. The group is already created so= the group_attach_event event handlers do not run. - Thread 2 assigns an interface address. This runs ifaddr_event event handlers, including pfi_ifaddr_event(), which calls pfi_kkif_update().=20 pfi_kkif_update() recurses and is called on the new interface's containing groups, including the one that thread 1 is still constructing. - Thread 2 panics: thread 1 has created the group but the ifg_pf_kif field = is uninitialized. We could modify if_addgroup() to initialize the ifg_pf_kif field to NULL, a= nd modify pfi_kkif_update() to handle a NULL ifg_pf_kif, but I'm not sure that this is correct. --=20 You are receiving this mail because: You are the assignee for the bug.=