From nobody Tue Apr 16 17:29:45 2024 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 4VJrdP3lFXz5HDgB for ; Tue, 16 Apr 2024 17:29:45 +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 4VJrdP1gPdz4cr6 for ; Tue, 16 Apr 2024 17:29:45 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713288585; a=rsa-sha256; cv=none; b=YU8LbMY6J8gheUazk990YfWKY9Q2FqCyPiy+8hSBVJ2qmOW9MZl5H+jyd3lQo7JoRGhU2+ FEuj574NwchfxwgaONxrIoO3MUwF5mz9UEU0naeJmfN2s67Kr25AFyaUDwwaq+mRUnB+t2 bgtsIum0SzzxJvF3SUfgMvPeQJZJEQoSZwCr5RRjBuwQDFuDZjzhj1nTX6AKZ3GxqeUUCU QoQx+SB75bQWeXfbCdQL+fMYtkxzRFKuxqzqVNtnBeY8e1dHqkwLlM8tirWCCkwFTSd5NW Rl1Sfw7uf46d88Fq+BZ4yGD+qx0Mf+JVg5evtECKbd08qtgqpUUqn0npto6V3w== 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=1713288585; 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=19DVBRFT99TaSWi+kkglG/bEU1sP5QyHPhiP3iNq/pQ=; b=azM48j4HZgbGUwD8Nyw/+CySxUQodh146wMtH4K6CMSNuD1ZXJqIWgCB1iITzG4VSCe0hE 9BrGccUoa/xLSlXioJa8a3PT8oXT39ombcdO1nfqGxAlLl5IUyLTU3BeKUlJyVxdu9lZ8D NY6aRny4B/J1Hj6tAKgm+NZFK2hrmpFztqhMmVdyos5ytY/OCDDLi0cf70IxsXwCSy4Ps9 AodieO4FVadfRMi7W0P+q8q5BP3Uo5CBmHnFIJ75QpjgULHZ5ZaL8xrKppvqyzbUVx6vOQ WX6HOnsrd+QxPuJvyGCchVcCf1u0LIsT6ZUO3C8Lp/scc9rSt6PWc3ECFnoe7A== 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 4VJrdP1B2NzsLt for ; Tue, 16 Apr 2024 17:29:45 +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 43GHTjZ9060932 for ; Tue, 16 Apr 2024 17:29:45 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 43GHTjXu060929 for bugs@FreeBSD.org; Tue, 16 Apr 2024 17:29:45 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 278392] virtio: device_detach crashes the system Date: Tue, 16 Apr 2024 17:29:45 +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: 14.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: sade@blackberry.com 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278392 Bug ID: 278392 Summary: virtio: device_detach crashes the system Product: Base System Version: 14.0-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: sade@blackberry.com Steps to reproduce: devctl delete -f vtnet0 devctl delete -f virtio_pci0 Reason: When the the child device is deleted, vtpci_child_dev is not set to NULL. Thus, vtpci_delete_child() tries to delete the child again and system crash= es. Possible fix: Implementing bus_child_deleted method for vtpci legacy/modern devices which would clear vtpci_child_dev when child is deleted. I.e:=20 vtpci_legacy_child_deleted(device_t dev, device_t child) { struct vtpci_legacy_softc *sc; sc =3D device_get_softc(dev); sc->vtpci_common.vtpci_child_dev =3D NULL; } Logs: root@freebsd:~ # devctl delete -f vtnet0 Apr 16 15:35:15 freebsd dhclient[592]: receive_packet failed on vtnet0: Dev= ice not configured Apr 16 15:35:15 freebsd dhclient[592]: ioctl(SIOCGIFFLAGS) on vtnet0: Opera= tion not permitted Apr 16 15:35:15 freebsd dhclient[592]: Interface vtnet0 no longer appears valid. Apr 16 15:35:15 freebsd dhclient[592]: No live interfaces to poll on - exit= ing. Apr 16 15:35:15 freebsd dhclient[592]: exiting. Apr 16 15:35:15 freebsd dhclient[592]: connection closed Apr 16 15:35:15 freebsd dhclient[592]: exiting. vtnet0: detached root@freebsd:~ # devctl delete -f virtio_pci0 Fatal trap 12: page fault while in kernel mode cpuid =3D 0; apic id =3D 00 fault virtual address =3D 0x800 fault code =3D supervisor read data, page not present instruction pointer =3D 0x20:0xffffffff80b91407 stack pointer =3D 0x28:0xfffffe004beeea10 frame pointer =3D 0x28:0xfffffe004beeea40 code segment =3D base 0x0, limit 0xfffff, type 0x1b =3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags =3D interrupt enabled, IOPL =3D 0 current process =3D 1064 (devctl) rdi: fffff80003625100 rsi: ffffffff816d9e30 rdx: 0000000000000020 rcx: fffff800036d3600 r8: fffffe004c165000 r9: 0000000000000000 rax: 0000000000000000 rbx: ffffffff816d9e30 rbp: fffffe004beeea40 r10: 0000000000000000 r11: fffffe004c165520 r12: fffff8000305e928 r13: 0000000000000000 r14: fffff80003625100 r15: fffffe004c165000 trap number =3D 12 panic: page fault cpuid =3D 0 time =3D 1713281726 KDB: stack backtrace: #0 0xffffffff80b9002d at kdb_backtrace+0x5d #1 0xffffffff80b43132 at vpanic+0x132 #2 0xffffffff80b42ff3 at panic+0x43 #3 0xffffffff8100c85c at trap_fatal+0x40c #4 0xffffffff8100c8af at trap_pfault+0x4f #5 0xffffffff80fe3828 at calltrap+0x8 #6 0xffffffff80b7db47 at device_delete_child+0x127 #7 0xffffffff8096705c at vtpci_delete_child+0x1c #8 0xffffffff8096896b at vtpci_legacy_detach+0x1b #9 0xffffffff80b7dcf6 at device_detach+0x186 #10 0xffffffff80b7da35 at device_delete_child+0x15 #11 0xffffffff80b84d32 at devctl2_ioctl+0x4d2 #12 0xffffffff809d10dc at devfs_ioctl+0xcc #13 0xffffffff80c3b9b4 at vn_ioctl+0xd4 #14 0xffffffff809d177e at devfs_ioctl_f+0x1e #15 0xffffffff80bb1535 at kern_ioctl+0x255 #16 0xffffffff80bb1273 at sys_ioctl+0x123 #17 0xffffffff8100d119 at amd64_syscall+0x109 Uptime: 5m15s Dumping 79 out of 95 MB:..21%..41%..61%..81% Dump complete --=20 You are receiving this mail because: You are the assignee for the bug.=