[Bug 265207] SR-IOV: ifconfig segfault with VF interface

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 14 Jul 2022 07:12:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265207

            Bug ID: 265207
           Summary: SR-IOV: ifconfig segfault with VF interface
           Product: Base System
           Version: 13.1-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: benoitc@enki-multimedia.eu

kerlel is crashing when running the command `ifconfig-vm' over a VF interface
with `passtrough = false`.

I have an HPE branded 2x25G qlogic card (HPE Eth 1G 2p 368i/10G 2p
568FLR-MMSFP+ Adptr 866467-B21) which support SR-IOV. I have enabled it using
the following configuration below. I confirmed SR-IOV is enabled. and the
interface ql2 is set up.

Crash:

```
# ifconfig -vm ql2
ql2: flags=8843<

Fatal trap 12: page fault while in kernel mode
cpuid = 2; apic id = 02
fault virtual address   = 0x30
fault code              = supervisor write data, page not present
instruction pointer     = 0x20:0xffffffff82376bb9
stack pointer           = 0x28:0xfffffe02152d4b70
frame pointer           = 0x28:0xfffffe02152d4b70
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current proUP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
       
options=507bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWFILTER,VLAN_HWTSO>
        cacess          = 47292 (ifconfig)
trap number             = 12
panic: page fault
cpuid = 2
time = 1657782022
KDB: stack backtrace:
#0 0xffffffff80c69465 at kdb_backtrace+0x65
#1 0xffffffff80c1bb1f at vpanic+0x17f
#2 0xffffffff80c1b993 at panic+0x43
#3 0xffffffff810afdf5 at trap_fatal+0x385
#4 0xffffffff810afe4f at trap_pfault+0x4f
#5 0xffffffff81087528 at calltrap+0x8
#6 0xffffffff82376a13 at ecore_ptt_acquire+0x83
#7 0xffffffff823b02f3 at qlnx_ioctl+0x583
#8 0xffffffff80d325e7 at ifioctl+0x407
#9 0xffffffff80c897cb at kern_ioctl+0x25b
#10 0xffffffff80c894d1 at sys_ioctl+0xf1
#11 0xffffffff810b06ec at amd64_syscall+0x10c
#12 0xffffffff81087e3b at fast_syscall_common+0xf8
Uptime: 7m33s
```

/etc/iov/ql0.conf
```
PF {
        device: "ql0";
        num_vfs: 8;
}

DEFAULT {
        passthrough: true;
        allow-set-mac: true;
        allow-promisc: true;
}

VF-0 {
        passthrough: false;
        mac-addr: "1e:4f:d8:c5:92:ab";
}
```

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