From nobody Tue Sep 19 01:25:52 2023 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 4RqPB84V9zz4t56d for ; Tue, 19 Sep 2023 01:25:52 +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 4RqPB80zbxz3ddd for ; Tue, 19 Sep 2023 01:25:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695086752; a=rsa-sha256; cv=none; b=yM3M8GcmhEwmF4dnE9riKL+iRUGWCeMco3a1EsSjPU58ZRQF+pMVRCdNHGjrILA9qf7g7e inVcT9ze+yJtSaWaa1bClw+5R/t79+z/BwkaLMTWwIPuK3ZCLUP8k5AC3KsQ2r4dzjEXqV x70HwjQvYRdyD6ogEn05kO515ltpHbXceHjVoMYGTpfgJ+bd2LOPS1TuULaLhr10xroFem I3nWo+dC0XCx5bkrSykjBKMBRDOs6qkz1W2cwztmuONBNbFwRTgz5X/ddokeqZWbYxJqTk VNsk3gwKn9wYY6pGX5Zwj9eSfTKubMy4ZxkJtiLkooizIaN6v+qj5vHqURIJLg== 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=1695086752; 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=BjTAS61B8kqAuTKIWbKEnZDjP6EayosSSbc62cot9nk=; b=d/fWcKzCz/Glhy9RTTIAlR6acswXxj1hjMdPxOcwd5tW2LWHq5ngeOQZZV/W0qEvKpbwmR 1o3PCkh84RFSGaQmS8XTjfOIorRBnunWfRg/5UECPG5SCKaZo7DCE2tbbjQfhFXC98V1Yi p/HmjYhFpbA/XzLostCtPfPxb+4LgVTtwrJe7C6SXU3iqReYfaOwCaz9ndopcQTh3dz/zz He+lFuQvCxaBOGLWXle3MsN6TJaM9DJIymqMEKjRQBVoA2clszJSsKvRPAfgcfptCiedQR 7K47sr1dzAr6iAX6kuibk0i2jp503PKyWRQpHsFHGWG8bNwfTok8l0o0hmvU4Q== 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 4RqPB804Ppztgd for ; Tue, 19 Sep 2023 01:25:52 +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 38J1PpJv099612 for ; Tue, 19 Sep 2023 01:25:51 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 38J1PpgR099611 for bugs@FreeBSD.org; Tue, 19 Sep 2023 01:25:51 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 273418] [panic] Repeating kernel panic on open(/dev/console) Date: Tue, 19 Sep 2023 01:25:52 +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: 13.2-STABLE X-Bugzilla-Keywords: crash, regression X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: jah@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: Message-ID: In-Reply-To: References: 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273418 --- Comment #20 from Jason A. Harmening --- Expanded version that spits out devnode names, adds CDP_ACTIVE to devfs_fre= e() assert, and asserts that we don't try to add a node to the freelist while s= till on the active list: diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 6d8ce5cc3a63..1e28db5966a7 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -175,6 +175,9 @@ devfs_free(struct cdev *cdev) struct cdev_priv *cdp; cdp =3D cdev2priv(cdev); + KASSERT((cdp->cdp_flags & (CDP_ACTIVE | CDP_ON_ACTIVE_LIST)) =3D=3D= 0, + ("%s: cdp %p (%s) still on active list", + __func__, cdp, cdev->si_name)); if (cdev->si_cred !=3D NULL) crfree(cdev->si_cred); devfs_free_cdp_inode(cdp->cdp_inode); @@ -521,6 +524,9 @@ devfs_populate_loop(struct devfs_mount *dm, int cleanup) dev_lock(); TAILQ_FOREACH(cdp, &cdevp_list, cdp_list) { KASSERT(cdp->cdp_dirents !=3D NULL, ("NULL cdp_dirents")); + KASSERT((cdp->cdp_flags & CDP_ON_ACTIVE_LIST) !=3D 0, + ("%s: cdp %p (%s) should not be on active list", + __func__, cdp, cdp->cdp_c.si_name)); /* * If we are unmounting, or the device has been destroyed, @@ -552,6 +558,7 @@ devfs_populate_loop(struct devfs_mount *dm, int cleanup) if (!(cdp->cdp_flags & CDP_ACTIVE)) { if (cdp->cdp_inuse > 0) continue; + cdp->cdp_flags &=3D ~CDP_ON_ACTIVE_LIST; TAILQ_REMOVE(&cdevp_list, cdp, cdp_list); dev_unlock(); dev_rel(&cdp->cdp_c); @@ -703,7 +710,10 @@ devfs_create(struct cdev *dev) dev_lock_assert_locked(); cdp =3D cdev2priv(dev); - cdp->cdp_flags |=3D CDP_ACTIVE; + KASSERT((cdp->cdp_flags & CDP_ON_ACTIVE_LIST) =3D=3D 0, + ("%s: cdp %p (%s) already on active list", + __func__, cdp, dev->si_name)); + cdp->cdp_flags |=3D (CDP_ACTIVE | CDP_ON_ACTIVE_LIST); cdp->cdp_inode =3D alloc_unrl(devfs_inos); dev_refl(dev); TAILQ_INSERT_TAIL(&cdevp_list, cdp, cdp_list); diff --git a/sys/fs/devfs/devfs_int.h b/sys/fs/devfs/devfs_int.h index 26589e0bded6..9cf50c58018d 100644 --- a/sys/fs/devfs/devfs_int.h +++ b/sys/fs/devfs/devfs_int.h @@ -57,6 +57,7 @@ struct cdev_priv { #define CDP_ACTIVE (1 << 0) #define CDP_SCHED_DTR (1 << 1) #define CDP_UNREF_DTR (1 << 2) +#define CDP_ON_ACTIVE_LIST (1 << 3) u_int cdp_inuse; u_int cdp_maxdirent; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index e8c8956d36fd..a71cfda9fa9a 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -1676,6 +1676,10 @@ devfs_revoke(struct vop_revoke_args *ap) dev_lock(); cdp->cdp_inuse--; if (!(cdp->cdp_flags & CDP_ACTIVE) && cdp->cdp_inuse =3D=3D 0) { + KASSERT((cdp->cdp_flags & CDP_ON_ACTIVE_LIST) !=3D 0, + ("%s: cdp %p (%s) not on active list", + __func__, cdp, dev->si_name)); + cdp->cdp_flags &=3D ~CDP_ON_ACTIVE_LIST; TAILQ_REMOVE(&cdevp_list, cdp, cdp_list); dev_unlock(); dev_rel(&cdp->cdp_c); diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 866788530e7f..a3af24a43b61 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -119,6 +119,8 @@ dev_free_devlocked(struct cdev *cdev) cdp =3D cdev2priv(cdev); KASSERT((cdp->cdp_flags & CDP_UNREF_DTR) =3D=3D 0, ("destroy_dev() was not called after delist_dev(%p)", cdev)); + KASSERT((cdp->cdp_flags & CDP_ON_ACTIVE_LIST) =3D=3D 0, + ("%s: cdp %p (%s) on active list", __func__, cdp, cdev->si_name= )); TAILQ_INSERT_HEAD(&cdevp_free_list, cdp, cdp_list); } --=20 You are receiving this mail because: You are the assignee for the bug.=