https://bugs.kde.org/show_bug.cgi?id=423963

--- Comment #25 from Christoph Cullmann <cullm...@kde.org> ---
As additional info that might be useful:

Before we ported our stuff to Qt 6.x, we did use Qt 5.15 (not with all
patches).

There we never had such issues, below is the diff of the 3rdparty/forkfd
directories between the Qt 5.15 and 6.x version now in use here:

diff -u -r -w ../../qt5/src/qtbase/src/3rdparty/forkfd/forkfd.c
src/qtbase/src/3rdparty/forkfd/forkfd.c
--- ../../qt5/src/qtbase/src/3rdparty/forkfd/forkfd.c   2020-10-06
17:17:50.510596533 +0200
+++ src/qtbase/src/3rdparty/forkfd/forkfd.c     2021-04-01 10:53:12.909416546
+0200
@@ -240,6 +240,9 @@
     }
 }

+#ifdef __GNUC__
+__attribute__((unused))
+#endif
 static int convertForkfdWaitFlagsToWaitFlags(int ffdoptions)
 {
     int woptions = WEXITED;
@@ -617,12 +620,6 @@
  * fork(), such as not calling the functions registered with pthread_atfork().
  * If that's necessary, pass this flag.
  *
- * @li @c FFD_VFORK_SEMANTICS Tell forkfd() to use semantics similar to
- * vfork(), if that's available. For example, on Linux with pidfd support
- * available, this will add the CLONE_VFORK option. On most other systems,
- * including Linux without pidfd support, this option does nothing, as using
- * the actual vfork() system call would cause a race condition.
- *
  * The file descriptor returned by forkfd() supports the following operations:
  *
  * @li read(2) When the child process exits, then the buffer supplied to
diff -u -r -w ../../qt5/src/qtbase/src/3rdparty/forkfd/forkfd.h
src/qtbase/src/3rdparty/forkfd/forkfd.h
--- ../../qt5/src/qtbase/src/3rdparty/forkfd/forkfd.h   2020-10-06
17:17:50.510596533 +0200
+++ src/qtbase/src/3rdparty/forkfd/forkfd.h     2021-04-01 10:53:12.909416546
+0200
@@ -41,7 +41,6 @@
 #define FFD_CLOEXEC             1
 #define FFD_NONBLOCK            2
 #define FFD_USE_FORK            4
-#define FFD_VFORK_SEMANTICS     8

 #define FFD_CHILD_PROCESS (-2)

diff -u -r -w ../../qt5/src/qtbase/src/3rdparty/forkfd/forkfd_linux.c
src/qtbase/src/3rdparty/forkfd/forkfd_linux.c
--- ../../qt5/src/qtbase/src/3rdparty/forkfd/forkfd_linux.c     2020-10-06
17:17:50.510596533 +0200
+++ src/qtbase/src/3rdparty/forkfd/forkfd_linux.c       2021-04-01
10:53:12.909416546 +0200
@@ -82,7 +82,7 @@
     return syscall(__NR_clone, cloneflags, child_stack, stack_size, ptid,
newtls, ctid);
 #elif defined(__arc__) || defined(__arm__) || defined(__aarch64__) ||
defined(__mips__) || \
     defined(__nds32__) || defined(__hppa__) || defined(__powerpc__) ||
defined(__i386__) || \
-    defined(__x86_64__) || defined(__xtensa__) || defined(__alpha__)
+    defined(__x86_64__) || defined(__xtensa__) || defined(__alpha__) ||
defined(__riscv)
     /* ctid and newtls are inverted on CONFIG_CLONE_BACKWARDS architectures,
      * but since both values are 0, there's no harm. */
     return syscall(__NR_clone, cloneflags, child_stack, ptid, ctid, newtls);
@@ -147,10 +147,10 @@
     }

     *system = 1;
-    unsigned long cloneflags = CLONE_PIDFD;
-    if (flags & FFD_VFORK_SEMANTICS)
-        cloneflags |= CLONE_VFORK;
+    unsigned long cloneflags = CLONE_PIDFD | SIGCHLD;
     pid = sys_clone(cloneflags, &pidfd);
+    if (pid < 0)
+        return pid;
     if (ppid)
         *ppid = pid;

@@ -173,7 +173,7 @@
 {
     siginfo_t si;
     int ret;
-    int options = __WALL | convertForkfdWaitFlagsToWaitFlags(ffdoptions);
+    int options = convertForkfdWaitFlagsToWaitFlags(ffdoptions);

     if ((options & WNOHANG) == 0) {
         /* check if the file descriptor is non-blocking */

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to