[Webkit-unassigned] [Bug 241583] Make sure WebPageProxy doesn't leak though strong references in async IPC callbacks

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 15 08:17:18 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=241583

--- Comment #2 from Michael Catanzaro <mcatanzaro at gnome.org> ---
Checking how PR_SET_PDEATHSIG works, I think I was just misusing it before when I convinced myself that it was unreliable or broken. I had previously attempted to use it between fork() and exec(), but it is not async-signal-safe, so that's illegal.

Anyway, possible solution:

diff --git a/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp b/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp
index 5f3b994864fa..ac763ecd9b08 100644
--- a/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp
+++ b/Source/WebKit/Shared/unix/AuxiliaryProcessMain.cpp
@@ -32,6 +32,10 @@
 #include <stdlib.h>
 #include <string.h>

+#if OS(LINUX)
+#include <sys/prctl.h>
+#endif
+
 namespace WebKit {

 bool AuxiliaryProcessMainCommon::parseCommandLine(int argc, char** argv)
@@ -56,6 +60,10 @@ void AuxiliaryProcess::platformInitialize(const AuxiliaryProcessInitializationPa
     RELEASE_ASSERT(!sigemptyset(&signalAction.sa_mask));
     signalAction.sa_handler = SIG_IGN;
     RELEASE_ASSERT(!sigaction(SIGPIPE, &signalAction, nullptr));
+
+#if OS(LINUX)
+    prctl(PR_SET_PDEATHSIG, SIGCONT, 0, 0, 0);
+#endif
 }

 } // namespace WebKit


I attempted to test this by manually sending SIGSTOP to the web process and SIGTERM to the UI process, but the web process and all other child processes actually did die when the UI process received SIGTERM. Not sure what killed the web process.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220615/8c7667df/attachment.htm>


More information about the webkit-unassigned mailing list