Details
Description
Running the following code (it requests in inhibition of power key handling by loginctl, which results in a file descriptor being sent back - other ways of receiving a QDBusUnixFileDescriptor should also crash):
from PySide6 import QtDBus iface = QtDBus.QDBusInterface( "org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", QtDBus.QDBusConnection.systemBus(), ) res = iface.call("Inhibit", "handle-power-key", "py", "py reasons", "block") fd = res.arguments()[0] print(fd) fd.fileDescriptor() # Seg faults
Results in the following output and backtrace
Starting program: /usr/bin/python3 bug.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". [New Thread 0x7ffff30006c0 (LWP 39182)] <PySide6.QtDBus.QDBusUnixFileDescriptor object at 0x7ffff69933c0> Thread 1 "python3" received signal SIGSEGV, Segmentation fault. 0x00007ffff681cc0c in QDBusUnixFileDescriptor::fileDescriptor() const () from /usr/lib/libQt6DBus.so.6 (gdb) bt #0 0x00007ffff681cc0c in QDBusUnixFileDescriptor::fileDescriptor() const () from /usr/lib/libQt6DBus.so.6 #1 0x00007ffff68d9bf9 in ?? () from /usr/lib/python3.12/site-packages/PySide6/QtDBus.cpython-312-x86_64-linux-gnu.so #2 0x00007ffff7988258 in ?? () from /usr/lib/libpython3.12.so.1.0 #3 0x00007ffff799a844 in PyObject_Vectorcall () from /usr/lib/libpython3.12.so.1.0 #4 0x00007ffff788bdfa in ?? () from /usr/lib/libpython3.12.so.1.0 #5 0x00007ffff7a3d767 in PyEval_EvalCode () from /usr/lib/libpython3.12.so.1.0 #6 0x00007ffff7a608b7 in ?? () from /usr/lib/libpython3.12.so.1.0 #7 0x00007ffff7a5b9dc in ?? () from /usr/lib/libpython3.12.so.1.0 #8 0x00007ffff7a74f33 in ?? () from /usr/lib/libpython3.12.so.1.0 #9 0x00007ffff7a74346 in _PyRun_SimpleFileObject () from /usr/lib/libpython3.12.so.1.0 #10 0x00007ffff7a73f88 in _PyRun_AnyFileObject () from /usr/lib/libpython3.12.so.1.0 #11 0x00007ffff7a6cc67 in Py_RunMain () from /usr/lib/libpython3.12.so.1.0 #12 0x00007ffff7a28fab in Py_BytesMain () from /usr/lib/libpython3.12.so.1.0 #13 0x00007ffff7639c88 in ?? () from /usr/lib/libc.so.6 #14 0x00007ffff7639d4c in __libc_start_main () from /usr/lib/libc.so.6 #15 0x0000555555555045 in _start () (gdb)