From 6f0b990f87a72e843560c3aa414a0e337f0527b3 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Tue, 3 Nov 2020 18:25:54 +0100 Subject: [PATCH] Backport upstream fix for QTBUG-86319 --- qt5-qtbase.spec | 8 ++++- qtbase-QTBUG-86319.patch | 73 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 qtbase-QTBUG-86319.patch diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index 283ecfd..b5e046a 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -49,7 +49,7 @@ BuildRequires: pkgconfig(libsystemd) Name: qt5-qtbase Summary: Qt5 - QtBase components Version: 5.15.1 -Release: 6%{?dist} +Release: 7%{?dist} # See LGPL_EXCEPTIONS.txt, for exception details License: LGPLv2 with exceptions or GPLv3 with exceptions @@ -129,6 +129,8 @@ Patch90: %{name}-gcc11.patch ## upstream patches Patch100: qtbase-emit-qscreen-geometry-changed-when-logical-dpi-changes.patch +Patch101: qtbase-QTBUG-86319.patch + # Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires. # Those themes are there for platform integration. If the required libraries are # not there, the platform to integrate with isn't either. Then Qt will just @@ -389,6 +391,7 @@ Qt5 libraries used for drawing widgets and OpenGL items. ## upstream patches %patch100 -p1 -b .emit-qscreen-geometry-changed-when-logical-dpi-changes +%patch101 -p1 # move some bundled libs to ensure they're not accidentally used pushd src/3rdparty @@ -1046,6 +1049,9 @@ fi %changelog +* Tue Nov 03 2020 Sandro Mani - 5.15.1-7 +- Backport upstream fix for QTBUG-86319 + * Sun Oct 18 2020 Jeff Law - 5.15.1-6 - Fix missing #includes for gcc-11 diff --git a/qtbase-QTBUG-86319.patch b/qtbase-QTBUG-86319.patch new file mode 100644 index 0000000..992b66d --- /dev/null +++ b/qtbase-QTBUG-86319.patch @@ -0,0 +1,73 @@ +From a82032351c921c3d5d57122aca57b47f83f9b9d1 Mon Sep 17 00:00:00 2001 +From: Thiago Macieira +Date: Thu, 10 Sep 2020 13:30:59 -0700 +Subject: [PATCH] forkfd/Linux: ask clone() to use the SIGCHLD as the + termination signal + +Because of these lines in the Linux kernel (kernel/fork.c, see [1][3]): + + if (clone_flags & CLONE_VFORK) + trace = PTRACE_EVENT_VFORK; + else if (args->exit_signal != SIGCHLD) + trace = PTRACE_EVENT_CLONE; + else + trace = PTRACE_EVENT_FORK; + +Without CLONE_VFORK (which we can't use), if the exit signal isn't +SIGCHLD, the debugger will get a PTRACE_EVENT_CLONE, which makes it +think the process we're starting is a thread, not a new process. Both +gdb and lldb remain attached to the child and when it later performs an +execve(), they get mightily confused. See gdb bug report[5]. + +The idea of not having an exit_signal was so that no SIGCHLD would be +delivered to the parent process in the first place. That way, some +misguided SIGCHLD handler (*cough* GLib *cough*) wouldn't reap our +processes. Unfortunately, what I didn't realize was that the kernel +sends SIGCHLD anyway (see [2][4]), so this defensive measure didn't +actually work. Consequently, we can pass SIGCHLD to clone() and get the +debuggers working again. + +[ChangeLog][Linux] Fixed an issue that would cause debugging a Qt +application that uses QProcess to confuse both gdb and lldb if +the Linux kernel was version 5.4 or higher. Behavior outside of +a debugging session was not affected. + +[1] https://code.woboq.org/linux/linux/kernel/fork.c.html#_do_fork +[2] https://code.woboq.org/linux/linux/kernel/signal.c.html#do_notify_parent +[3] https://elixir.bootlin.com/linux/v5.8/source/kernel/fork.c#L2432 +[4] https://elixir.bootlin.com/linux/v5.8/source/kernel/signal.c#L1925 +[5] https://sourceware.org/bugzilla/show_bug.cgi?id=26562 + +Fixes: QTBUG-86319 +Change-Id: I2fc68c725ba649218bd9fffd1633863613537d42 +Reviewed-by: Dimitrios Apostolou +Reviewed-by: Oswald Buddenhagen +Reviewed-by: hjk +(cherry picked from commit d1fc991c6e3c45a5f93c925d49e3fe77ce6ce455) +Reviewed-by: Qt Cherry-pick Bot +--- + src/3rdparty/forkfd/forkfd_linux.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/3rdparty/forkfd/forkfd_linux.c b/src/3rdparty/forkfd/forkfd_linux.c +index 523fbca3ccc..ffe0e9a5e24 100644 +--- a/src/3rdparty/forkfd/forkfd_linux.c ++++ b/src/3rdparty/forkfd/forkfd_linux.c +@@ -147,7 +147,7 @@ int system_forkfd(int flags, pid_t *ppid, int *system) + } + + *system = 1; +- unsigned long cloneflags = CLONE_PIDFD; ++ unsigned long cloneflags = CLONE_PIDFD | SIGCHLD; + pid = sys_clone(cloneflags, &pidfd); + if (ppid) + *ppid = pid; +@@ -171,7 +171,7 @@ int system_forkfd_wait(int ffd, struct forkfd_info *info, int ffdoptions, struct + { + 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 */