Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault when locking GNOME/Wayland desktop with database open #10432

Closed
dimitris-personal opened this issue Mar 14, 2024 · 5 comments · Fixed by #10458
Closed

Segfault when locking GNOME/Wayland desktop with database open #10432

dimitris-personal opened this issue Mar 14, 2024 · 5 comments · Fixed by #10458

Comments

@dimitris-personal
Copy link

dimitris-personal commented Mar 14, 2024

Overview

KeePassXC crashes when locking the desktop. New regression as of 2.7.7.

Steps to Reproduce

  1. Enable the security option Lock databases when session is locked or lid is closed.
  2. Unlock the database.
  3. Lock the GNOME desktop

Expected Behavior

Before 2.7.7, KPXC behaved as expected. Was still running with database locked upon session unlock.

Actual Behavior

KPXC receives SIGSEGV before the database is locked (at least window still displays unlocked content)

Additional information

Fedora 39/GNOME/Wayland. KPXC build is from the Fedora testing repo.

Debug info

KeePassXC - Version 2.7.7
Revision: 68e2dd8

Qt 5.15.12
Debugging mode is disabled.

Operating system: Fedora Linux 39 (Workstation Edition)
CPU architecture: x86_64
Kernel: linux 6.7.9-200.fc39.x86_64

Enabled extensions:
- Auto-Type
- Browser Integration
- Passkeys
- SSH Agent
- KeeShare
- YubiKey
- Secret Service Integration

Cryptographic libraries:
- Botan 2.19.3

backtrace

Thread 1 "keepassxc" received signal SIGSEGV, Segmentation fault.
0x00005555556b78cd in Database::transformedDatabaseKey (this=<optimized out>) at /usr/include/qt5/QtCore/qscopedpointer.h:116
Downloading source file /usr/include/qt5/QtCore/qscopedpointer.h
116         T *operator->() const noexcept                                                                                                                                                                             
(gdb) bt
#0  0x00005555556b78cd in Database::transformedDatabaseKey (this=<optimized out>) at /usr/include/qt5/QtCore/qscopedpointer.h:116
#1  0x00005555556f1dcf in Kdbx4Reader::readDatabaseImpl (this=0x55555612d390, device=0x7fffffffd040, headerData=..., key=..., db=<optimized out>)
    at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/format/Kdbx4Reader.cpp:61
#2  0x00005555556ee6df in KdbxReader::readDatabase (db=0x5555572afb40, key=..., device=0x7fffffffd040, this=<optimized out>) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/format/KdbxReader.cpp:95
#3  KeePass2Reader::readDatabase (this=<optimized out>, device=0x7fffffffd040, key=..., db=0x5555572afb40) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/format/KeePass2Reader.cpp:97
#4  0x00005555556b7bfb in Database::open (this=0x5555572afb40, filePath=..., key=..., error=0x7fffffffd108) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/core/Database.cpp:149
#5  0x000055555571d301 in DatabaseOpenWidget::clearForms (this=this@entry=0x555556e66bd0) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/gui/DatabaseOpenWidget.cpp:275
#6  0x000055555571e7f3 in DatabaseOpenWidget::load (this=0x555556e66bd0, filename=...) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/gui/DatabaseOpenWidget.cpp:241
#7  0x000055555573025f in DatabaseWidget::switchToOpenDatabase (this=0x5555563a8100, filePath=...) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/gui/DatabaseWidget.cpp:1355
#8  0x0000555555736d8d in DatabaseWidget::lock (this=0x5555563a8100) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/gui/DatabaseWidget.cpp:1790
#9  0x00005555557200ee in DatabaseTabWidget::lockDatabases (this=0x555555dc4f60) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/gui/DatabaseTabWidget.cpp:666
#10 0x00007ffff64e92d8 in doActivate<false> (sender=0x555556052c90, signal_index=3, argv=0x7fffffffd380) at kernel/qobject.cpp:3937
#11 0x00007ffff64e92d8 in doActivate<false> (sender=0x555556052ba0, signal_index=3, argv=0x7fffffffd450) at kernel/qobject.cpp:3937
#12 0x00005555556abd20 in ScreenLockListenerDBus::qt_metacall (this=0x555556052ba0, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7fffffffd5a0)
    at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/redhat-linux-build/src/keepassx_core_autogen/FUIKO5VHUE/moc_ScreenLockListenerDBus.cpp:141
#13 0x00007ffff759438b in QDBusConnectionPrivate::deliverCall (this=<optimized out>, object=<optimized out>, msg=..., metaTypes=..., slotIdx=<optimized out>) at qdbusintegrator.cpp:1001
#14 0x00007ffff64df9fb in QObject::event (this=0x555556052ba0, e=0x7fffe001a010) at kernel/qobject.cpp:1347
#15 0x00007ffff77aeb95 in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x555556052ba0, e=0x7fffe001a010) at kernel/qapplication.cpp:3640
#16 0x00007ffff64b4e78 in QCoreApplication::notifyInternal2 (receiver=0x555556052ba0, event=0x7fffe001a010) at kernel/qcoreapplication.cpp:1064
#17 0x00007ffff64b5092 in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#18 0x00007ffff64b8325 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x555555b68570) at kernel/qcoreapplication.cpp:1821
#19 0x00007ffff64b85dd in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>) at kernel/qcoreapplication.cpp:1680
#20 0x00007ffff65078cf in postEventSourceDispatch (s=0x555555d149e0) at kernel/qeventdispatcher_glib.cpp:277
#21 0x00007ffff4b11e5c in g_main_dispatch (context=0x7fffe0000ec0) at ../glib/gmain.c:3476
#22 g_main_context_dispatch_unlocked (context=0x7fffe0000ec0) at ../glib/gmain.c:4284
#23 0x00007ffff4b6cf18 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7fffe0000ec0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4349
#24 0x00007ffff4b0fad3 in g_main_context_iteration (context=0x7fffe0000ec0, may_block=1) at ../glib/gmain.c:4414
#25 0x00007ffff65073b9 in QEventDispatcherGlib::processEvents (this=0x555555d017e0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#26 0x00007ffff64b383b in QEventLoop::exec (this=this@entry=0x7fffffffda80, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#27 0x00007ffff64bbacb in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#28 0x00007ffff6960efd in QGuiApplication::exec () at kernel/qguiapplication.cpp:1863
#29 0x00007ffff77aeb09 in QApplication::exec () at kernel/qapplication.cpp:2832
#30 0x000055555563d3a5 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/keepassxc-2.7.7-2.fc39.x86_64/src/main.cpp:215

KeePassXC - 2.7.7
Revision: 68e2dd8

Operating System: Linux
Desktop Env: Gnome
Windowing System: Wayland

@slovdahl
Copy link

slovdahl commented Mar 15, 2024

Same here, installed as deb package using a deb http://ppa.launchpad.net/phoerious/keepassxc/ubuntu jammy main APT source.

KeePassXC - Version 2.7.7
Revision: 68e2dd8

Qt 5.15.3
Debugging mode is disabled.

Operating system: Ubuntu 22.04.4 LTS
CPU architecture: x86_64
Kernel: linux 6.1.77-x64v3-xanmod1

Enabled extensions:
- Auto-Type
- Browser Integration
- Passkeys
- SSH Agent
- KeeShare
- YubiKey
- Secret Service Integration

Cryptographic libraries:
- Botan 2.19.1

@gmellini
Copy link

gmellini commented Mar 15, 2024

Same here with the new 2.7.7 version on Ubuntu 22.04, let me know if I can help debugging the issue. I can always trigger the crash (segfault) doing the steps written on the issue description

$ keepassxc  --debug-info
KeePassXC - Version 2.7.7
Revision: 68e2dd8

Qt 5.15.3
Debugging mode is disabled.

Operating system: Ubuntu 22.04.4 LTS
CPU architecture: x86_64
Kernel: linux 6.6.10-76060610-generic

Enabled extensions:
- Auto-Type
- Browser Integration
- Passkeys
- SSH Agent
- KeeShare
- YubiKey
- Secret Service Integration

Cryptographic libraries:
- Botan 2.19.1

Using x11

$ echo $XDG_SESSION_TYPE
x11

@slovdahl
Copy link

FWIW, I'm not using Wayland.

@sang-shelton
Copy link

Same here

keepassxc --debug-info

QSocketNotifier: Can only be used with threads started with QThread
KeePassXC - Version 2.7.7
Revision: 68e2dd8

Qt 5.15.10
Debugging mode is disabled.

Operating system: Ubuntu 23.10
CPU architecture: x86_64
Kernel: linux 6.7.8-060708-generic

Enabled extensions:
- Auto-Type
- Browser Integration
- Passkeys
- SSH Agent
- KeeShare
- YubiKey
- Secret Service Integration

Cryptographic libraries:
- Botan 2.19.3

System info (sudo inxi -Faz)

System:
  Kernel: 6.7.8-060708-generic arch: x86_64 bits: 64 compiler: N/A
    clocksource: tsc available: acpi_pm
    parameters: BOOT_IMAGE=/vmlinuz-6.7.8-060708-generic
    root=/dev/mapper/ubuntu--vg-ubuntu--lv ro quiet splash vt.handoff=7
  Desktop: GNOME v: 45.2 tk: GTK v: 3.24.38 wm: gnome-shell dm: GDM3
    v: 45.beta Distro: Ubuntu 23.10 (Mantic Minotaur)
Machine:
  Type: Laptop System: ASUSTeK product: ROG Strix G614JU_G614JU v: 1.0
    serial: <filter>
  Mobo: ASUSTeK model: G614JU v: 1.0 serial: <filter> UEFI: American
    Megatrends LLC. v: G614JU.321 date: 10/24/2023
Battery:
  ID-1: BAT0 charge: 82.5 Wh (100.0%) condition: 82.5/90.0 Wh (91.7%)
    volts: 17.3 min: 16.0 model: AS3GYFG3KC R220358 type: Unknown
    serial: <filter> status: full
CPU:
  Info: model: 13th Gen Intel Core i9-13980HX socket: U3E1 bits: 64
    type: MST AMCP arch: Raptor Lake gen: core 13 level: v3 note: check
    built: 2022+ process: Intel 7 (10nm) family: 6 model-id: 0xB7 (183)
    stepping: 1 microcode: 0x11D
  Topology: cpus: 1x cores: 24 mt: 8 tpc: 2 st: 16 threads: 32 smt: enabled
    cache: L1: 2.1 MiB desc: d-16x32 KiB, 8x48 KiB; i-8x32 KiB, 16x64 KiB
    L2: 32 MiB desc: 8x2 MiB, 4x4 MiB L3: 36 MiB desc: 1x36 MiB
  Speed (MHz): avg: 836 high: 1284 min/max: 800/5400:5600:4000
    base/boost: 5346/8500 scaling: driver: intel_pstate governor: powersave
    volts: 1.4 V ext-clock: 100 MHz cores: 1: 800 2: 800 3: 800 4: 800 5: 800
    6: 800 7: 800 8: 800 9: 1284 10: 949 11: 969 12: 800 13: 800 14: 800
    15: 800 16: 800 17: 970 18: 989 19: 800 20: 800 21: 800 22: 800 23: 800
    24: 800 25: 800 26: 800 27: 800 28: 800 29: 800 30: 800 31: 800 32: 800
    bogomips: 154828
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Enhanced / Automatic IBRS, IBPB:
    conditional, RSB filling, PBRSB-eIBRS: SW sequence
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel Raptor Lake-S UHD Graphics vendor: ASUSTeK driver: i915
    v: kernel arch: Gen-13 process: Intel 7 (10nm) built: 2022+ ports:
    active: eDP-1 empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 0000:00:02.0
    chip-ID: 8086:a788 class-ID: 0300
  Device-2: NVIDIA AD107M [GeForce RTX 4050 Max-Q / Mobile]
    vendor: ASUSTeK GN21-X2 driver: nvidia v: 545.29.06
    alternate: nvidiafb,nouveau,nvidia_drm non-free: 535.xx+
    status: current (as of 2023-08) arch: Lovelace code: AD1xx
    process: TSMC n4 (5nm) built: 2022-23+ ports: active: none
    empty: DP-3,HDMI-A-3,eDP-2 bus-ID: 0000:01:00.0 chip-ID: 10de:28e1
    class-ID: 0300
  Device-3: Sonix USB2.0 HD UVC WebCam driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-8:3 chip-ID: 322e:2122
    class-ID: 0e02
  Display: server: X.Org v: 1.23.2 with: Xwayland v: 23.2.0
    compositor: gnome-shell driver: X: loaded: modesetting,nvidia
    unloaded: fbdev,nouveau,vesa dri: iris gpu: i915 display-ID: :1 screens: 1
  Screen-1: 0 s-res: 1440x900 s-dpi: 96 s-size: 381x238mm (15.00x9.37")
    s-diag: 449mm (17.69")
  Monitor-1: eDP-1 model: TL160ADMP03-0 built: 2022 res: 1440x900 hz: 240
    dpi: 105 gamma: 1.2 size: 350x220mm (13.78x8.66") diag: 407mm (16")
    ratio: 16:10 modes: 2560x1600
  API: OpenGL v: 4.6 Mesa 23.2.1-1ubuntu3.1 renderer: Mesa Intel Graphics
    (RPL-S) direct-render: Yes
Audio:
  Device-1: Intel vendor: ASUSTeK driver: snd_hda_intel v: kernel
    alternate: snd_sof_pci_intel_tgl bus-ID: 0000:00:1f.3 chip-ID: 8086:7a50
    class-ID: 0403
  Device-2: NVIDIA vendor: ASUSTeK driver: snd_hda_intel v: kernel
    bus-ID: 0000:01:00.1 chip-ID: 10de:22be class-ID: 0403
  API: ALSA v: k6.7.8-060708-generic status: kernel-api
    tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 0.3.79 status: n/a (root, process) with:
    1: pipewire-pulse status: active 2: wireplumber status: active
    3: pipewire-alsa type: plugin tools: pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel driver: iwlwifi v: kernel port: N/A bus-ID: 0000:00:14.3
    chip-ID: 8086:7a70 class-ID: 0280
  IF: wlo1 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK driver: r8169 v: kernel port: 4000 bus-ID: 0000:6c:00.0
    chip-ID: 10ec:8168 class-ID: 0200
  IF: enp108s0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel driver: btusb v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s
    lanes: 1 mode: 1.1 bus-ID: 1-14:4 chip-ID: 8087:0033 class-ID: e001
  Report: hciconfig ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.3
    lmp-v: 12 sub-v: 32fe hci-v: 12 rev: 32fe class-ID: 6c010c
  Info: acl-mtu: 1021:4 sco-mtu: 96:6 link-policy: rswitch sniff
    link-mode: peripheral accept service-classes: rendering, capturing, audio,
    telephony
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller Intel
    driver: vmd v: 0.6 port: N/A bus-ID: 0000:00:0e.0 chip-ID: 8086:a77f rev:
    class-ID: 0104
Drives:
  Local Storage: total: 953.87 GiB used: 324.69 GiB (34.0%)
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Micron model: 2400 MTFDKBA1T0QFM
    size: 953.87 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
    lanes: 4 tech: SSD serial: <filter> fw-rev: V3MA003 temp: 42.9 C
    scheme: GPT
  SMART: yes health: PASSED on: 122d 5h cycles: 323
    read-units: 19,456,697 [9.96 TB] written-units: 19,626,533 [10.0 TB]
Partition:
  ID-1: / raw-size: 950.8 GiB size: 934.8 GiB (98.32%)
    used: 324.16 GiB (34.7%) fs: ext4 block-size: 4096 B dev: /dev/dm-1
    maj-min: 252:1 mapped: ubuntu--vg-ubuntu--lv
  ID-2: /boot raw-size: 2 GiB size: 1.9 GiB (95.01%) used: 533.4 MiB (27.4%)
    fs: ext4 block-size: 4096 B dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-3: /boot/efi raw-size: 1.05 GiB size: 1.05 GiB (99.80%)
    used: 6.1 MiB (0.6%) fs: vfat block-size: 512 B dev: /dev/nvme0n1p1
    maj-min: 259:1
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: file size: 8 GiB used: 0 KiB (0.0%) priority: -2
    file: /swap.img
Sensors:
  System Temperatures: cpu: 39.0 C mobo: N/A
  Fan Speeds (rpm): cpu: 1900
Info:
  Processes: 567 Uptime: 6h 38m wakeups: 6 Memory: total: 32 GiB note: est.
  available: 30.97 GiB used: 6.23 GiB (20.1%) igpu: 64 MiB Init: systemd
  v: 253 target: graphical (5) default: graphical tool: systemctl Compilers:
  gcc: 13.2.0 alt: 12/13 clang: 16.0.6 Packages: 2588 pm: dpkg pkgs: 2555
  libs: 1523 tools: apt,apt-get pm: flatpak pkgs: 24 pm: snap pkgs: 9
  Shell: Sudo (sudo) v: 1.9.14p2 default: Bash v: 5.2.15
  running-in: gnome-terminal inxi: 3.3.29

@droidmonkey
Copy link
Member

Thank you no more need for same here's

@keepassxreboot keepassxreboot locked and limited conversation to collaborators Mar 15, 2024
droidmonkey added a commit that referenced this issue Mar 17, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
@droidmonkey droidmonkey added this to the v2.7.8 milestone Mar 17, 2024
droidmonkey added a commit that referenced this issue Mar 31, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
droidmonkey added a commit that referenced this issue Mar 31, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
droidmonkey added a commit that referenced this issue Apr 1, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
droidmonkey added a commit that referenced this issue Apr 1, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
droidmonkey added a commit that referenced this issue Apr 1, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
pull bot pushed a commit to tigerwill90/keepassxc that referenced this issue Apr 13, 2024
* Fixes keepassxreboot#10455
* Fixes keepassxreboot#10432
* Fixes keepassxreboot#10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
pull bot pushed a commit to shashinma/keepassxc that referenced this issue Apr 13, 2024
* Fixes keepassxreboot#10455
* Fixes keepassxreboot#10432
* Fixes keepassxreboot#10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
droidmonkey added a commit that referenced this issue Apr 28, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
droidmonkey added a commit that referenced this issue Apr 29, 2024
* Fixes #10455
* Fixes #10432
* Fixes #10415

Prevent setting critical key components to nullptr when database data is cleared. This can result in a crash due to race condition between threads.

Added a bunch of asserts to detect this problem and if guards to prevent actual crashes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants