Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86319

Use of CLONE_PIDFD for forkfd interacts badly with debugging

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.15.0
    • Fix Version/s: 5.15.2
    • Component/s: Core: I/O
    • Labels:
      None
    • Platform/s:
      Linux/X11
    • Commits:
      d1fc991c6e3c45a5f93c925d49e3fe77ce6ce455 (qt/qtbase/dev) a82032351c921c3d5d57122aca57b47f83f9b9d1 (qt/qtbase/5.15)

      Description

      [Edited]
      I see the following on my new machine, fresh setup of Ubuntu 20.04.1 LTS, and a self-build Qt 5.15. I don't see it with pre-build binaries from https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.15.0-focal:

      Change 22f0905b4ac1a ( https://codereview.qt-project.org/c/qt/qtbase/+/108456 ) ill-affects the ability to debug code like

      #include <QCoreApplication>
      #include <QProcess>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
        QCoreApplication a(argc, argv);
      
        QProcess p;
        p.start("/bin/ls", {"--version"});
        p.waitForStarted();
        p.waitForFinished();
      
        qDebug() << p.readAllStandardOutput();
      
        return 0;
      }

      For gdb (tested 9.1 and some version from 2017) there was before:

      $ gdb ./untitled -ex run -ex quit -batch
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      [Detaching after fork from child process 89575]
      "ls (GNU coreutils) 8.30\nCopyright (C) 2018 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\nWritten by Richard M. Stallman and David MacKenzie.\n"
      [Inferior 1 (process 89571) exited normally]
      

      Afterwards:

      $ gdb ./untitled -ex run -ex quit -batch
      
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      [New Thread 0x7ffff50ce780 (LWP 88899)]
      process 88895 is executing new program: /usr/bin/ls
      warning: Probes-based dynamic linker interface failed.
      Reverting to original interface.
       
      Thread 2 received signal SIGSEGV, Segmentation fault.
      [Switching to LWP 88899]
      0x00007ffff7fd37a5 in ?? () from /lib64/ld-linux-x86-64.so.2
      A debugging session is active.
      
      Inferior 1 [process 88895] will be killed.
      

      Not exactly the same, but also bad for LLDB.

      Before:

      (lldb) target create "/tmp/untitled/untitled"
      Current executable set to '/tmp/untitled/untitled' (x86_64).
      (lldb) r
      Process 396885 launched: '/tmp/untitled/untitled' (x86_64)
      Process 396885 stopped and restarted: thread 1 received signal: SIGCHLD
      "ls (GNU coreutils) 8.30\nCopyright (C) 2018 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\nWritten by Richard M. Stallman and David MacKenzie.\n"
      Process 396885 exited with status = 0 (0x00000000) 
      

      Afterwards:

      (lldb) target create "/tmp/untitled/untitled"
      Current executable set to '/tmp/untitled/untitled' (x86_64).
      (lldb) r
      Process 396365 launched: '/tmp/untitled/untitled' (x86_64)
      Process 396365 stopped
      * thread #1, name = 'untitled', stop reason = signal SIGSTOP
          frame #0: 0xffffffffffffffff 
      QProcess: Destroyed while process ("/bin/ls") is still running.
      

       

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              thiago Thiago Macieira
              Reporter:
              hjk hjk
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes