Title: [275605] trunk/Source/WebKit
- Revision
- 275605
- Author
- [email protected]
- Date
- 2021-04-07 06:13:34 -0700 (Wed, 07 Apr 2021)
Log Message
[WPE][GTK] Null pointer dereference when child process exits immediately
https://bugs.webkit.org/show_bug.cgi?id=224209
Patch by Michael Catanzaro <[email protected]> on 2021-04-07
Reviewed by Carlos Garcia Campos.
We discovered that when the child process exits immediately after it is spawned,
g_subprocess_get_identifier() will return nullptr. In this case, we should crash cleanly
with SIGABRT via g_error(), rather than crashing with a null pointer dereference inside
g_ascii_strtoll(). SIGABRT is much nicer than SIGSEGV and indicates that we really do want
to crash here, whereas SIGSEGV is just a bug.
Also, let's be careful with our terminology in the existing error message here. Although
GSubprocess currently always forks, I'm working to make it use posix_spawn() instead, so
let's not claim that fork() has failed when it soon might not be used at all.
* UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
(WebKit::ProcessLauncher::launchProcess):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (275604 => 275605)
--- trunk/Source/WebKit/ChangeLog 2021-04-07 12:30:48 UTC (rev 275604)
+++ trunk/Source/WebKit/ChangeLog 2021-04-07 13:13:34 UTC (rev 275605)
@@ -1,3 +1,23 @@
+2021-04-07 Michael Catanzaro <[email protected]>
+
+ [WPE][GTK] Null pointer dereference when child process exits immediately
+ https://bugs.webkit.org/show_bug.cgi?id=224209
+
+ Reviewed by Carlos Garcia Campos.
+
+ We discovered that when the child process exits immediately after it is spawned,
+ g_subprocess_get_identifier() will return nullptr. In this case, we should crash cleanly
+ with SIGABRT via g_error(), rather than crashing with a null pointer dereference inside
+ g_ascii_strtoll(). SIGABRT is much nicer than SIGSEGV and indicates that we really do want
+ to crash here, whereas SIGSEGV is just a bug.
+
+ Also, let's be careful with our terminology in the existing error message here. Although
+ GSubprocess currently always forks, I'm working to make it use posix_spawn() instead, so
+ let's not claim that fork() has failed when it soon might not be used at all.
+
+ * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
+ (WebKit::ProcessLauncher::launchProcess):
+
2021-04-07 Jer Noble <[email protected]>
Unreviewed build fix after r275571 and r275537, which introduced conflicting changes.
Modified: trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp (275604 => 275605)
--- trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp 2021-04-07 12:30:48 UTC (rev 275604)
+++ trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp 2021-04-07 13:13:34 UTC (rev 275605)
@@ -184,9 +184,12 @@
process = adoptGRef(g_subprocess_launcher_spawnv(launcher.get(), argv, &error.outPtr()));
if (!process.get())
- g_error("Unable to fork a new child process: %s", error->message);
+ g_error("Unable to spawn a new child process: %s", error->message);
const char* processIdStr = g_subprocess_get_identifier(process.get());
+ if (!processIdStr)
+ g_error("Spawned process died immediately. This should not happen.");
+
m_processIdentifier = g_ascii_strtoll(processIdStr, nullptr, 0);
RELEASE_ASSERT(m_processIdentifier);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes