# kernel-crash with ubt0



## mms.vanbreukelingen (Aug 26, 2019)

I'm trying to setup a bluetooth-box with freeBSD 13. uname -a:


```
FreeBSD freeBSD13 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r351273M:
Wed Aug 21 06:50:26 CEST 2019     root@freeBSD13:/usr/obj/usr/src/head/amd64.amd64/sys/GENERIC  amd64
```

loading ng_ubt.ko in /etc/loader.conf

`service start bluetooth ubt0`
results in a two or three times mode to be started.  

```
/etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0
```
but the third time it's quiet and that's always a good sign for a machine. 

Scanning is ok, my a2dp-sink bluetooth box is recognized. 

```
Inquiry result, num_responses=1
Inquiry result #0
    BD_ADDR: c0:7a:a5:00:c7:11
    Page Scan Rep. Mode: 0x1
    Page Scan Period Mode: 00
    Page Scan Mode: 00
    Class: 24:04:04
    Clock offset: 0x7954
Inquiry complete. Status: No error [00]
```

But now:
*hccontrol -n ubt0hci read_connection_list*

leads to:


```
freeBSD13 dumped core - see /var/crash/vmcore.0

Mon Aug 26 02:45:45 CEST 2019

GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...

Unread portion of the kernel message buffer:
Kernel page fault with the following non-sleepable locks held:
exclusive sleep mutex btsocks_hci_raw_pcb_mtx (btsocks_hci_raw_pcb_mtx) r = 0 (0xfffff800037ee5e0) locked @ /usr/src/head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c:1042
stack backtrace:
#0 0xffffffff80c3d903 at witness_debugger+0x73
#1 0xffffffff80c3e922 at witness_warn+0x442
#2 0xffffffff811996d3 at trap_pfault+0x53
#3 0xffffffff81198cc4 at trap+0x2b4
#4 0xffffffff81170fbc at calltrap+0x8
#5 0xffffffff82d23324 at ng_btsocket_hci_raw_control+0x6e4
#6 0xffffffff80c4b7f3 at soo_ioctl+0x413
#7 0xffffffff80c42995 at kern_ioctl+0x295
#8 0xffffffff80c4268d at sys_ioctl+0x15d
#9 0xffffffff8119a1ab at amd64_syscall+0x2bb
#10 0xffffffff811718e0 at fast_syscall_common+0x101


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address    = 0x80067c180
fault code        = supervisor write data, page not present
instruction pointer    = 0x20:0xffffffff81195d16
stack pointer            = 0x28:0xfffffe003494e880
frame pointer            = 0x28:0xfffffe003494e880
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 process        = 9646 (hccontrol)
trap number        = 12
panic: page fault
cpuid = 0
time = 1566777564
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe003494e540
vpanic() at vpanic+0x19d/frame 0xfffffe003494e590
panic() at panic+0x43/frame 0xfffffe003494e5f0
trap_fatal() at trap_fatal+0x39c/frame 0xfffffe003494e650
trap_pfault() at trap_pfault+0x62/frame 0xfffffe003494e6a0
trap() at trap+0x2b4/frame 0xfffffe003494e7b0
calltrap() at calltrap+0x8/frame 0xfffffe003494e7b0
--- trap 0xc, rip = 0xffffffff81195d16, rsp = 0xfffffe003494e880, rbp = 0xfffffe003494e880 ---
copyout_nosmap_erms() at copyout_nosmap_erms+0xb6/frame 0xfffffe003494e880
ng_btsocket_hci_raw_control() at ng_btsocket_hci_raw_control+0x6e4/frame 0xfffffe003494e910
soo_ioctl() at soo_ioctl+0x413/frame 0xfffffe003494e950
kern_ioctl() at kern_ioctl+0x295/frame 0xfffffe003494e9b0
sys_ioctl() at sys_ioctl+0x15d/frame 0xfffffe003494ea80
amd64_syscall() at amd64_syscall+0x2bb/frame 0xfffffe003494ebb0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe003494ebb0
--- syscall (54, FreeBSD ELF64, sys_ioctl), rip = 0x80042f2ea, rsp = 0x7fffffffe538, rbp = 0x7fffffffe5b0 ---
KDB: enter: panic
Uptime: 1h16m7s
Dumping 466 out of 3968 MB:..4%..11%..21%..31%..42%..52%..62%..72%..83%..93%
```

No matter what kinda kernel or stack (ubt1) I use, this shit happens. 
Is it a driver error, a compile failure or a system bug?

Bluetooth with freeBSD would be cool thing, I'd save a lot for the dentist.  And with this Ubitek Magic Box under linux it's an example of the fight against proprietarism (pE A2DP fix!). 

You'd handle her with care or she's gonna kill you and your family with making @world and @buildkernel bringing me to foreground - such a lota responsibility for not getting anything at all - but a lotta revenge-tribal-stuff-emotion is keeping us going!  

Interested in any related reply, 

Miranda


----------



## yuripv (Aug 26, 2019)

Please see https://forums.freebsd.org/threads/topics-about-unsupported-freebsd-versions.40469/.


----------

