Package: thunderbird
Version: 1:91.5.1-1+b2
Severity: normal

Dear Maintainer,

on startup, thunderbird generates a core dump when apparmor is enabled. Apart 
from that, the program works fine.


*** To reproduce:

> thunderbird
[GFX1-]: No GPUs detected via PCI
[GFX1-]: glxtest: process failed (received signal 11)
[...]

> file core
core: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from 
'/usr/lib/thunderbird/thunderbird', real uid: 1000, effective uid: 1000, real 
gid: 1000, effective gid: 1000, execfn: '/usr/lib/thunderbird/thunderbird', 
platform: 'x86_64'

[Note: in most installations the core dumps will be managed by 
`systemd-coredump`, and probably need to be accessed with `coredumpctl`]


*** Local fix:

# echo '/sys/devices/pci[0-9]*/**/class r,' >> 
/etc/apparmor.d/local/usr.bin.thunderbird
# systemctl restart apparmor.service

This augments the existing rules for /sys/devices/pci in 
/etc/apparmor.d/usr.bin.thunderbird,

  
/sys/devices/pci[0-9]*/**/{device,subsystem_device,subsystem_vendor,uevent,vendor}
 r,

to include the `class` file as well.


*** Supporting analysis:

I installed the -dbgsym packages for thunderbird and libpci to obtain a 
backtrace:

> gdb /usr/lib/thunderbird/thunderbird core
[...]
(gdb) bt
#0  UnexpectedExit() () at ./toolkit/xre/nsAppRunner.cpp:399
#1  0x00007fa0be447f67 in __run_exit_handlers (status=status@entry=1, 
listp=0x7fa0be5c5738 <__exit_funcs>, 
run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at 
exit.c:108
#2  0x00007fa0be44810a in __GI_exit (status=status@entry=1) at exit.c:139
#3  0x00007fa0b30998e1 in pci_generic_error (msg=0x7fa0b30a1415 "Cannot open 
%s: %s") at init.c:131
#4  0x00007fa0b309ece2 in sysfs_get_string (d=d@entry=0x7fa0be2d2120, 
object=object@entry=0x7fa0b30a1bd2 "class", buf=buf@entry=0x7ffccff099a0 
"0x6fb5\n", mandatory=mandatory@entry=1) at sysfs.c:103
#5  0x00007fa0b309f508 in sysfs_get_value (mandatory=1, object=0x7fa0b30a1bd2 
"class", d=0x7fa0be2d2120) at sysfs.c:145
#6  sysfs_fill_info (d=0x7fa0be2d2120, flags=33) at sysfs.c:311
#7  0x00007fa0b309a27f in pci_fill_info_v35 (d=d@entry=0x7fa0be2d2120, 
flags=flags@entry=33) at access.c:201
#8  0x00007fa0b7a477f6 in get_pci_status() () at ./toolkit/xre/glxtest.cpp:391
#9  childgltest() () at ./toolkit/xre/glxtest.cpp:1354
#10 0x00007fa0b7a48136 in fire_glxtest_process() () at 
./toolkit/xre/glxtest.cpp:1403
#11 0x00007fa0b7a3d90b in XREMain::XRE_mainInit(bool*) (this=<optimized out>, 
this@entry=0x7ffccff0a920, aExitFlag=aExitFlag@entry=0x7ffccff0a8af) at 
./toolkit/xre/nsAppRunner.cpp:3623
#12 0x00007fa0b7a44588 in XREMain::XRE_main(int, char**, 
mozilla::BootstrapConfig const&) (this=this@entry=0x7ffccff0a920, 
argc=argc@entry=1, argv=argv@entry=0x7ffccff0bb98, aConfig=...) at 
./toolkit/xre/nsAppRunner.cpp:5408
#13 0x00007fa0b7a44970 in XRE_main(int, char**, mozilla::BootstrapConfig 
const&) (argc=1, argv=0x7fa0b7a3e5c0 <UnexpectedExit()>, aConfig=...) at 
./toolkit/xre/nsAppRunner.cpp:5493
#14 0x0000559272bf7198 in do_main(int, char**, char**) (argc=1, 
argv=0x7ffccff0bb98, envp=<optimized out>) at ./comm/mail/app/nsMailApp.cpp:229
#15 main(int, char**, char**) (argc=<optimized out>, argv=<optimized out>, 
envp=<optimized out>) at ./comm/mail/app/nsMailApp.cpp:368
(gdb) frame 4
(gdb) print mandatory
$1 = 1
(gdb) print (char *)namebuf
$2 = 0x7ffccff09100 "/sys/bus/pci/devices/0000:ff:15.1/class"
(gdb) q

So we're hitting this code in libpci,

  https://github.com/pciutils/pciutils/blob/v3.7.0/lib/sysfs.c#L103

and because `mandatory` is set this is treated as an error by libpci.

dmesg points to apparmour as the cause:

# dmesg
[...]
[21096.091105] audit: type=1400 audit(1644074114.165:64): apparmor="DENIED" 
operation="open" profile="thunderbird" 
name="/sys/devices/pci0000:ff/0000:ff:15.1/class" pid=118142 comm="thunderbird" 
requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[21096.091119] thunderbird[118142]: segfault at 0 ip 00007fa0b7a3e5e7 sp 
00007ffccff08fa0 error 6 in libxul.so[7fa0b47d5000+4e9b000]
[...]


-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.15.0-3-amd64 (SMP w/12 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages thunderbird depends on:
ii  debianutils          5.7-0.1
ii  fontconfig           2.13.1-4.4
ii  libatk1.0-0          2.36.0-3
ii  libbotan-2-19        2.19.1+dfsg-2
ii  libbz2-1.0           1.0.8-5
ii  libc6                2.33-5
ii  libcairo-gobject2    1.16.0-5
ii  libcairo2            1.16.0-5
ii  libdbus-1-3          1.12.20-3
ii  libdbus-glib-1-2     0.112-2
ii  libevent-2.1-7       2.1.12-stable-1
ii  libffi8              3.4.2-4
ii  libfontconfig1       2.13.1-4.4
ii  libfreetype6         2.11.1+dfsg-1
ii  libgcc-s1            11.2.0-16
ii  libgdk-pixbuf-2.0-0  2.42.6+dfsg-2
ii  libglib2.0-0         2.70.3-1
ii  libgtk-3-0           3.24.31-1
ii  libjson-c5           0.15-2
ii  libnspr4             2:4.32-3
ii  libnss3              2:3.73.1-1
ii  libpango-1.0-0       1.50.3+ds1-6
ii  libstdc++6           11.2.0-16
ii  libvpx7              1.11.0-2
ii  libx11-6             2:1.7.2-2+b1
ii  libx11-xcb1          2:1.7.2-2+b1
ii  libxcb-shm0          1.14-3
ii  libxcb1              1.14-3
ii  libxext6             2:1.3.4-1
ii  libxrender1          1:0.9.10-1
ii  psmisc               23.4-2
ii  x11-utils            7.7+5
ii  zenity               3.41.0-2
ii  zlib1g               1:1.2.11.dfsg-2

Versions of packages thunderbird recommends:
ii  hunspell-en-us [hunspell-dictionary]  1:2020.12.07-2

Versions of packages thunderbird suggests:
ii  apparmor          3.0.3-6
ii  fonts-lyx         2.3.6-1
ii  libgssapi-krb5-2  1.18.3-7

-- no debconf information

Reply via email to