Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2936

Segfault with calling fileDescriptor method of QDBusUnixFileDescriptor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.8.2
    • 6.8.0.2
    • PySide
    • None
    • PySide 6.8.0.2
      Linux AL0 6.9.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 12 Jun 2024 20:17:17 +0000 x86_64 GNU/Linux
      Also tested on arm64 Linux build with Yocto
    • Linux/X11, Linux/Yocto
    • 12d33d7b8 (dev), 33406b871 (6.8)

    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)
      

      Attachments

        1. bug.py
          0.3 kB
        2. pyside2916_cpp.zip
          3 kB
        3. pyside2936_stack.txt
          9 kB
        4. pyside2936.py
          0.8 kB
        For Gerrit Dashboard: PYSIDE-2936
        # Subject Branch Project Status CR V

        Activity

          People

            kleint Friedemann Kleint
            matsjoyce-refeyn Matthew Joyce
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes