Date: Tue, 16 Apr 2024 17:29:45 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 278392] virtio: device_detach crashes the system Message-ID: <bug-278392-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
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.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-278392-227>