[Long] Segfault on applications using qt5
BERTRAND Joël
joel.bertrand at systella.fr
Thu Nov 26 09:36:14 UTC 2020
Hello,
For a long time, some applications abort with segfault or bus error. I
have seen that all of them were linked against qt5.
Since I have upgraded my workstation to 12.0 (diskless, NFS server runs
NetBSD 9.0), I have done some investigations.
This workstation runs now :
- FreeBSD 12.2-RELEASE r366954 GENERIC
- CPU is Intel(R) Core(TM) i5-4570S CPU @ 2.90GHz (2900.06-MHz K8-class
CPU), RAM 8 GB
- GPU is intel embedded GPU in main CPU
- WM is WindowMaker
/etc/X11/xorg.conf :
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
Option "AllowEmptyInput" "False"
Option "AutoAddDevices" "False"
EndSection
Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
FontPath "/usr/local/share/fonts/misc/"
FontPath "/usr/local/share/fonts/TTF/"
FontPath "/usr/local/share/fonts/OTF/"
FontPath "/usr/local/share/fonts/Type1/"
FontPath "/usr/local/share/fonts/100dpi/"
FontPath "/usr/local/share/fonts/75dpi/"
FontPath "/usr/local/share/fonts/dejavu/"
FontPath "/usr/local/share/fonts/LinLibertineG/"
FontPath "/usr/local/share/fonts/Liberation/"
FontPath "/usr/local/share/fonts/Carlito/"
FontPath "/usr/local/share/fonts/Caladea/"
FontPath "/usr/local/share/fonts/GentiumBasic/"
EndSection
Section "Module"
Load "glx"
Load "freetype"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "fr"
Option "XkbVariant" "latin9"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
Identifier "Card0"
Driver "intel"
BusID "PCI:0:2:0"
EndSection
Section "Device"
Identifier "Card1"
Driver "vesa"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
First constatation, I cannot start Xorg with intel driver. Only vesa
seems to run (but I obtain an accelerated X). I don't understand why I
cannot start X with regular intel driver (same motherboard in the same
configuration runs Xorg with intel driver without any trouble).
Second constatation : a lot of applications abort with segfault. For
example : vlc, libreoffice or okular.
I have rebuilt these applications from sources to have debug
information and I have seen that both segfault occur in libQt5Gui.so.5
Full backtrace :
(gdb) bt
#0 0x0000000803051ed0 in ?? () from /usr/local/lib/qt5/libQt5Gui.so.5
#1 0x00000008032b7723 in ?? () from /usr/local/lib/qt5/libQt5Gui.so.5
#2 0x00000008032b92f9 in QRasterPaintEngine::fillRect(QRectF const&,
QSpanData*) () from /usr/local/lib/qt5/libQt5Gui.so.5
#3 0x00000008032de2db in QPainter::fillRect(QRect const&, QBrush const&) ()
from /usr/local/lib/qt5/libQt5Gui.so.5
#4 0x0000000802ac4bbe in ?? () from /usr/local/lib/qt5/libQt5Widgets.so.5
#5 0x0000000802ac47a8 in QWidgetPrivate::paintBackground(QPainter*,
QRegion const&, int) const () from /usr/local/lib/qt5/libQt5Widgets.so.5
#6 0x0000000802acbcc8 in QWidgetPrivate::drawWidget(QPaintDevice*,
QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
from /usr/local/lib/qt5/libQt5Widgets.so.5
#7 0x0000000802aa4a45 in ?? () from /usr/local/lib/qt5/libQt5Widgets.so.5
#8 0x0000000802aa344c in ?? () from /usr/local/lib/qt5/libQt5Widgets.so.5
#9 0x0000000802af4cf4 in ?? () from /usr/local/lib/qt5/libQt5Widgets.so.5
#10 0x0000000802af1e0a in ?? () from /usr/local/lib/qt5/libQt5Widgets.so.5
#11 0x0000000802a97ca3 in QApplicationPrivate::notify_helper(QObject*,
QEvent*)
() from /usr/local/lib/qt5/libQt5Widgets.so.5
#12 0x0000000802a991ec in QApplication::notify(QObject*, QEvent*) ()
from /usr/local/lib/qt5/libQt5Widgets.so.5
#13 0x0000000803a39362 in QCoreApplication::notifyInternal2(QObject*,
QEvent*)
() from /usr/local/lib/qt5/libQt5Core.so.5
#14 0x0000000803083bcc in
QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*)
() from /usr/local/lib/qt5/libQt5Gui.so.5
#15 0x0000000803065afc in
QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)
() from /usr/local/lib/qt5/libQt5Gui.so.5
#16 0x000000080657f8bf in ?? () from /usr/local/lib/qt5/libQt5XcbQpa.so.5
#17 0x00000008041e87d7 in g_main_context_dispatch ()
from /usr/local/lib/libglib-2.0.so.0
#18 0x00000008041e8b9a in ?? () from /usr/local/lib/libglib-2.0.so.0
#19 0x00000008041e8c54 in g_main_context_iteration ()
from /usr/local/lib/libglib-2.0.so.0
#20 0x0000000803a91e06 in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
() from /usr/local/lib/qt5/libQt5Core.so.5
#21 0x0000000803a34a0e in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from
/usr/local/lib/qt5/libQt5Core.so.5
#22 0x0000000803a39ace in QCoreApplication::exec() ()
from /usr/local/lib/qt5/libQt5Core.so.5
#23 0x00000008024b50c4 in ?? ()
from /usr/local/lib/vlc/plugins/gui/libqt_plugin.so
#24 0x00000008024b46d6 in ?? ()
from /usr/local/lib/vlc/plugins/gui/libqt_plugin.so
#25 0x000000080027b736 in ?? () from /lib/libthr.so.3
/usr/local/lib/qt5/libQt5Gui.so.5 is built with clang and linked
against libc++.so.1. Okular and vlc are built with gcc. Thus, I have
tried to rebuild okular with clang. I have added in /etc/make.conf:
.if ${.CURDIR:M*/multimedia/vlc}
CC=clang
CXX=clang++
CPP=clang-cpp
.endif
.if ${.CURDIR:M*/graphics/okular}
CC=clang
CXX=clang++
CPP=clang-cpp
.endif
and I have verified that both applications are now built with clang.
Same result: segfault in libQt5Gui.so.5
I have rebuilt qt5 (5.14.2) from sources with debug symbols. Now, I see
okular aborts in :
(gdb) bt
#0 0x000000080163fa20 in qt_memfillXX_avx2(unsigned char*, long long
__vector(4), long long) () from /root/qt5/lib/libQt5Gui.so.5
#1 0x00000008018bc2d5 in fillRect_normalized(QRect const&, QSpanData*,
QRasterPaintEnginePrivate*) () from /root/qt5/lib/libQt5Gui.so.5
#2 0x00000008018bdcd6 in QRasterPaintEngine::fillRect(QRectF const&,
QSpanData*) () from /root/qt5/lib/libQt5Gui.so.5
#3 0x00000008018e1a9c in QPainter::fillRect(QRect const&, QBrush const&) ()
from /root/qt5/lib/libQt5Gui.so.5
#4 0x00000008010c04be in fillRegion(QPainter*, QRegion const&, QBrush
const&)
() from /root/qt5/lib/libQt5Widgets.so.5
#5 0x00000008010c017f in QWidgetPrivate::paintBackground(QPainter*,
QRegion const&, QFlags<QWidgetPrivate::DrawWidgetFlag>) const ()
from /root/qt5/lib/libQt5Widgets.so.5
I'm rebuilding qt without optimization (avx2). I have rebuilt Qt from
scratch in a new tree. Now okular crashes in another function :
Thread 1 received signal SIGSEGV, Segmentation fault.
0x0000000801a0c940 in qt_memfillXX_aligned(void*, long long __vector(2),
unsigned long long) () from /usr/local/Qt-5.14.2/lib/libQt5Gui.so.5
(gdb) bt
#0 0x0000000801a0c940 in qt_memfillXX_aligned(void*, long long
__vector(2), unsigned long long) () from
/usr/local/Qt-5.14.2/lib/libQt5Gui.so.5
#1 0x00000008018b4835 in fillRect_normalized(QRect const&, QSpanData*,
QRasterPaintEnginePrivate*) () from /usr/local/Qt-5.14.2/lib/libQt5Gui.so.5
#2 0x00000008018b6236 in QRasterPaintEngine::fillRect(QRectF const&,
QSpanData*) () from /usr/local/Qt-5.14.2/lib/libQt5Gui.so.5
#3 0x00000008018d9ffc in QPainter::fillRect(QRect const&, QBrush const&) ()
from /usr/local/Qt-5.14.2/lib/libQt5Gui.so.5
#4 0x00000008010c04be in fillRegion(QPainter*, QRegion const&, QBrush
const&)
() from /usr/local/Qt-5.14.2/lib/libQt5Widgets.so.5
#5 0x00000008010c017f in QWidgetPrivate::paintBackground(QPainter*,
QRegion const&, QFlags<QWidgetPrivate::DrawWidgetFlag>) const ()
from /usr/local/Qt-5.14.2/lib/libQt5Widgets.so.5
#6 0x00000008010be570 in QWidgetPrivate::drawWidget(QPaintDevice*,
QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>,
QPainter*, QWidgetRepaintManager*) () from
/usr/local/Qt-5.14.2/lib/libQt5Widgets.so.5
#7 0x00000008010a110f in QWidgetRepaintManager::paintAndFlush() ()
from /usr/local/Qt-5.14.2/lib/libQt5Widgets.so.5
#8 0x000000080109f47b in QWidgetRepaintManager::sync(QWidget*, QRegion
const&)
() from /usr/local/Qt-5.14.2/lib/libQt5Widgets.so.5
#9 0x00000008010ec834 in QWidgetWindow::handleExposeEvent(QExposeEvent*) ()
from /usr/local/Qt-5.14.2/lib/libQt5Widgets.so.5
gdb) info register
rax 0x805e1b000 34458415104
rbx 0x272 626
rcx 0x805e58220 34458665504
rdx 0x3d220 250400
rsi 0x3d220 250400
rdi 0x805e1b000 34458415104
rbp 0x7fffffffcc20 0x7fffffffcc20
rsp 0x7fffffffcc20 0x7fffffffcc20
r8 0xff000000 4278190080
r9 0xef 239
r10 0x80186af50 34385342288
r11 0x0 0
r12 0x804031700 34427049728
r13 0x0 0
r14 0x64 100
r15 0x0 0
rip 0x801a0c940 0x801a0c940
<qt_memfillXX_aligned(void*, long long __vector(2), unsigned long long)+32>
eflags 0x10202 [ IF RF ]
cs 0x43 67
ss 0x3b 59
ds <unavailable>
es <unavailable>
fs <unavailable>
gs <unavailable>
fs_base 0x802ff78e0 34410035424
gs_base 0x0 0
If I try to reproduce this bug with a new qt5 configuration
(-no-strip-no-evdev -no-avx -no-avx2 -no-avx512), okular aborts in the
_same_ function (qt_memfillXX_avx2).
I don't know how investigate further...
Help will be welcome,
JKB
More information about the freebsd-x11
mailing list