[Bug 284283] if_re(4) crashes when attaching on RVVM

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 23 Jan 2025 00:47:31 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284283

            Bug ID: 284283
           Summary: if_re(4) crashes when attaching on RVVM
           Product: Base System
           Version: CURRENT
          Hardware: riscv
               URL: https://github.com/LekKit/RVVM/issues/131
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: fuz@FreeBSD.org
                CC: jhibbits@FreeBSD.org, wpaul@FreeBSD.org,
                    yongari@FreeBSD.org
             Flags: mfc-stable14?

I've tried to use FreeBSD 15-CURRENT in the RVVM riscv64 emulator.  I'm using a
15-CURRENT image with this uname -a, though it also happens on 14.2:

    FreeBSD 15.0-CURRENT (GENERIC) #0 main-n274800-054c5ddf587a: Thu Jan 16
06:51:42 UTC 2025

This emulator emulates a network card identifying itself as follows:

none0@pci0:0:1:0:       class=0x020000 rev=0x00 hdr=0x00 vendor=0x10ec
device=0x8169 subvendor=0x10dc subdevice=0xeba1
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8169 PCI Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet

when I do "kldload if_re" to attach the suitable driver, the system crashes
immediately:

# kldload if_re
re0: <RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet> mem
0x40000000-0x400000ff irq 21 at device 1.0 on pci0
re0: Chip rev. 0x00800000
re0: MAC rev. 0x00000000
   t[0]: 0xffffffd045944000
   t[1]: 0xffffffc09a40b3ec (.L0  + 0x450)
   t[2]: 0xffffffc000adc530 (w_locklistdata + 0x3f1f0)
   t[3]: 0xffffffc00042acf8 (ifmedia_ioctl)
   t[4]: 0xccf509939f66f20a
   t[5]: 0xffffffc0635be230 ($d + 0x62400008)
   t[6]: 0xd8c0caa20cc138df
   s[0]: 0xffffffc0635be2a0 ($d + 0x62400078)
   s[1]: 0xffffffd0040d5280
   s[2]: 0xffffffc0635be2e0 ($d + 0x624000b8)
   s[3]: 0x0000000000000000
   s[4]: 0xffffffd00b0ac800
   s[5]: 0xffffffd04594402c
   s[6]: 0xffffffc000a93fc0 (__stack_chk_guard)
   s[7]: 0xffffffc0008d1598 (db_pager_quit)
   s[8]: 0xffffffc09a359000 ($d + 0x9919add8)
   s[9]: 0x0000000000000801
  s[10]: 0xffffffc09a35d130 ($d + 0x9919ef08)
  s[11]: 0xffffffc0007bf028 (pci_find_cap_desc)
   a[0]: 0xffffffd00b0ac800
   a[1]: 0xffffffc0635be2e0 ($d + 0x624000b8)
   a[2]: 0xffffffd0040d5280
   a[3]: 0x0000000000000000
   a[4]: 0x00000000c0306938
   a[5]: 0x0000000000000010
   a[6]: 0x0000000000000020
   a[7]: 0x0000000000000016
     ra: 0xffffffc00042ade8 (ifmedia_ioctl + 0xf0)
     sp: 0xffffffc0635be270 ($d + 0x62400048)
     gp: 0xffffffc0008d0cd0 (__global_pointer$)
     tp: 0xffffffc000b54900 (__pcpu + 0x300)
   sepc: 0x0000000000000000
sstatus: 0x0000000a00000120
stval  : 0x0000000000000000
panic: Fatal page fault at 0: 0
cpuid = 3
time = 1737592726
KDB: stack backtrace:
db_trace_self() at db_trace_self
db_trace_self_wrapper() at db_trace_self_wrapper+0x36
kdb_backtrace() at kdb_backtrace+0x2c
vpanic() at vpanic+0x16e
panic() at panic+0x26
page_fault_handler() at page_fault_handler+0x22a
do_trap_supervisor() at do_trap_supervisor+0x6c
cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x74
--- exception 12, tval = 0
(null)() at 0
if_ioctl() at if_ioctl+0xc
dump_iface() at dump_iface+0x10e
rtnl_handle_ifevent() at rtnl_handle_ifevent+0x60
rtnl_handle_ifattach() at rtnl_handle_ifattach+0x48
if_attach_internal() at if_attach_internal+0x344
if_attach() at if_attach+0xe
ether_ifattach() at ether_ifattach+0x32
.L0 () at .L0 +0xa
device_attach() at device_attach+0x40c
device_probe_and_attach() at device_probe_and_attach+0x44
pci_driver_added() at pci_driver_added+0x102
devclass_driver_added() at devclass_driver_added+0x34
devclass_add_driver() at devclass_add_driver+0xfc
driver_module_handler() at driver_module_handler+0x6a
module_register_init() at module_register_init+0xa8
linker_load_module() at linker_load_module+0x9ee
kern_kldload() at kern_kldload+0x14e
sys_kldload() at sys_kldload+0x52
do_trap_user() at do_trap_user+0x1e4
cpu_exception_handler_user() at cpu_exception_handler_user+0x72
--- syscall (304, FreeBSD ELF64, kldload)

Up stream has noticed the same issue (see URL field) and found bug #275920 as a
related issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.