Hello,
I am just trying to get the source line from the dmesg code line.


[   97.073761] bluetoothd[838]: segfault at 561314652a23 ip 000056167406a375 sp 
00007fffb128a200 error 4 in bluetoothd[561674048000+ec000] likely on CPU 11 
(core 5, socket 0)
[   97.073799] Code: 00 31 c0 e9 54 ff ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 
f3 0f 1e fa 41 55 41 54 55 53 48 83 ec 08 48 8b 2a 48 8b 7a 08 <48> 8b 45 20 4c 
8b ad 88 00 00 00 4c 8b 20 48 85 ff 74 19 c7 47 08


And it points to function a2dp_suspend_complete, [transport.c:431].

This function leads to upstream report [701],
which should be fixed since release 5.72 [83cfad1].

Kind regards,
Bernhard

[transport.c:431] 
https://sources.debian.org/src/bluez/5.71-1/profiles/audio/transport.c/#L431
[701] https://github.com/bluez/bluez/issues/701
[83cfad1] 
https://github.com/bluez/bluez/commit/83cfad1badee6aae77eb15177ccc917249ab9bb3
[   97.073761] bluetoothd[838]: segfault at 561314652a23 ip 000056167406a375 sp 
00007fffb128a200 error 4 in bluetoothd[561674048000+ec000] likely on CPU 11 
(core 5, socket 0)
[   97.073799] Code: 00 31 c0 e9 54 ff ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 
66 90 f3 0f 1e fa 41 55 41 54 55 53 48 83 ec 08 48 8b 2a 48 8b 7a 08 <48> 8b 45 
20 4c 8b ad 88 00 00 00 4c 8b 20 48 85 ff 74 19 c7 47 08

https://wiki.debian.org/InterpretingKernelOutputAtProcessCrash

error 4  ==  0b00000100:
 *   bit 0 ==    0: no page found
 *   bit 1 ==    0: read access
 *   bit 2 ==    1: user-mode access
.






# 2024-05-01 trixie/testing amd64 qemu VM

apt dist-upgrade
apt install gdb bluez bluez-dbgsym
apt build-dep bluez


mkdir /home/benutzer/source/bluez/orig -p
cd    /home/benutzer/source/bluez/orig
apt source bluez



echo -n "find /b ..., ..., 0x" && \
echo "00 31 c0 e9 54 ff ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 f3 0f 1e 
fa 41 55 41 54 55 53 48 83 ec 08 48 8b 2a 48 8b 7a 08 <48> 8b 45 20 4c 8b ad 88 
00 00 00 4c 8b 20 48 85 ff 74 19 c7 47 08" \
 | sed 's/[<>]//g' | sed 's/ /, 0x/g'

gdb -q
set width 0
set pagination off
file /usr/sbin/bluetoothd
tb main
run
pipe info target | grep -E "\.text$"

find /b 0x00005555555798f0, 0x0000555555663b30, 0x00, 0x31, 0xc0, 0xe9, 0x54, 
0xff, 0xff, 0xff, 0x66, 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x66, 0x90, 0xf3, 0x0f, 0x1e, 0xfa, 0x41, 0x55, 0x41, 0x54, 0x55, 0x53, 
0x48, 0x83, 0xec, 0x08, 0x48, 0x8b, 0x2a, 0x48, 0x8b, 0x7a, 0x08, 0x48, 0x8b, 
0x45, 0x20, 0x4c, 0x8b, 0xad, 0x88, 0x00, 0x00, 0x00, 0x4c, 0x8b, 0x20, 0x48, 
0x85, 0xff, 0x74, 0x19, 0xc7, 0x47, 0x08
b * (0x55555559a34b + 42)
info b
disassemble /r 0x55555559a34b, 0x55555559a34b + 62
directory /home/benutzer/source/bluez/orig/bluez-5.71




benutzer@debian:~$ gdb -q
(gdb) set width 0
(gdb) set pagination off
(gdb) file /usr/sbin/bluetoothd
Reading symbols from /usr/sbin/bluetoothd...
Reading symbols from 
/usr/lib/debug/.build-id/b3/ec9634ecf4f0995fa44119b844150cc8d98db5.debug...
(gdb) tb main
Temporary breakpoint 1 at 0x25bd0: file src/main.c, line 1355.
(gdb) run
Starting program: /usr/sbin/bluetoothd 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe478) at src/main.c:1355
1355    src/main.c: Datei oder Verzeichnis nicht gefunden.
(gdb) pipe info target | grep -E "\.text$"
        0x00005555555798f0 - 0x0000555555663b30 is .text
(gdb) find /b 0x00005555555798f0, 0x0000555555663b30, 0x00, 0x31, 0xc0, 0xe9, 
0x54, 0xff, 0xff, 0xff, 0x66, 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x66, 0x90, 0xf3, 0x0f, 0x1e, 0xfa, 0x41, 0x55, 0x41, 0x54, 0x55, 
0x53, 0x48, 0x83, 0xec, 0x08, 0x48, 0x8b, 0x2a, 0x48, 0x8b, 0x7a, 0x08, 0x48, 
0x8b, 0x45, 0x20, 0x4c, 0x8b, 0xad, 0x88, 0x00, 0x00, 0x00, 0x4c, 0x8b, 0x20, 
0x48, 0x85, 0xff, 0x74, 0x19, 0xc7, 0x47, 0x08
0x55555559a34b <resume_a2dp+283>
1 pattern found.
(gdb) b * (0x55555559a34b + 42)
Breakpoint 2 at 0x55555559a375: file profiles/audio/transport.c, line 431.
(gdb) info b
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   0x000055555559a375 in a2dp_suspend_complete at 
profiles/audio/transport.c:431
(gdb) disassemble /r 0x55555559a34b, 0x55555559a34b + 62
Dump of assembler code from 0x55555559a34b to 0x55555559a389:
...
   0x000055555559a360 <a2dp_suspend_complete+0>:        f3 0f 1e fa             
endbr64
   0x000055555559a364 <a2dp_suspend_complete+4>:        41 55                   
push   %r13
   0x000055555559a366 <a2dp_suspend_complete+6>:        41 54                   
push   %r12
   0x000055555559a368 <a2dp_suspend_complete+8>:        55                      
push   %rbp
   0x000055555559a369 <a2dp_suspend_complete+9>:        53                      
push   %rbx
   0x000055555559a36a <a2dp_suspend_complete+10>:       48 83 ec 08             
sub    $0x8,%rsp
   0x000055555559a36e <a2dp_suspend_complete+14>:       48 8b 2a                
mov    (%rdx),%rbp
   0x000055555559a371 <a2dp_suspend_complete+17>:       48 8b 7a 08             
mov    0x8(%rdx),%rdi
   0x000055555559a375 <a2dp_suspend_complete+21>:       48 8b 45 20             
mov    0x20(%rbp),%rax          <<<<<<<<<<<<<
   0x000055555559a379 <a2dp_suspend_complete+25>:       4c 8b ad 88 00 00 00    
mov    0x88(%rbp),%r13
   0x000055555559a380 <a2dp_suspend_complete+32>:       4c 8b 20                
mov    (%rax),%r12
   0x000055555559a383 <a2dp_suspend_complete+35>:       48 85 ff                
test   %rdi,%rdi
   0x000055555559a386 <a2dp_suspend_complete+38>:       74 19                   
je     0x55555559a3a1 <a2dp_suspend_complete+65>
   0x000055555559a388 <a2dp_suspend_complete+40>:       c7 47 08 00 00 00 00    
movl   $0x0,0x8(%rdi)
End of assembler dump.
(gdb) directory /home/benutzer/source/bluez/orig/bluez-5.71
Source directories searched: 
/home/benutzer/source/bluez/orig/bluez-5.71:$cdir:$cwd
(gdb) list a2dp_suspend_complete
421
422     static void a2dp_suspend_complete(struct avdtp *session, int err,
423                                                             void *user_data)
424     {
425             struct media_owner *owner = user_data;
426             struct media_transport *transport = owner->transport;
427             struct a2dp_transport *a2dp = transport->data;
428             struct a2dp_sep *sep = 
media_endpoint_get_sep(transport->endpoint);
429
430             /* Release always succeeds */
431             if (owner->pending) {
432                     owner->pending->id = 0;
433                     media_request_reply(owner->pending, 0);
434                     media_owner_remove(owner);
435             }
436
437             a2dp_sep_unlock(sep, a2dp->session);
438             transport_set_state(transport, TRANSPORT_STATE_IDLE);
439             media_transport_remove_owner(transport);
440     }
441

https://sources.debian.org/src/bluez/5.71-1/profiles/audio/transport.c/#L431

https://github.com/bluez/bluez/issues/701
https://github.com/bluez/bluez/issues/708

https://github.com/bluez/bluez/commit/83cfad1badee6aae77eb15177ccc917249ab9bb3

Patch is already included in 5.72
https://github.com/bluez/bluez/commits/5.72/

Reply via email to