Changeset 275605 in webkit


Ignore:
Timestamp:
Apr 7, 2021 6:13:34 AM (3 years ago)
Author:
commit-queue@webkit.org
Message:

[WPE][GTK] Null pointer dereference when child process exits immediately
https://bugs.webkit.org/show_bug.cgi?id=224209

Patch by Michael Catanzaro <Michael Catanzaro> 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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r275592 r275605  
     12021-04-07  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        [WPE][GTK] Null pointer dereference when child process exits immediately
     4        https://bugs.webkit.org/show_bug.cgi?id=224209
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        We discovered that when the child process exits immediately after it is spawned,
     9        g_subprocess_get_identifier() will return nullptr. In this case, we should crash cleanly
     10        with SIGABRT via g_error(), rather than crashing with a null pointer dereference inside
     11        g_ascii_strtoll(). SIGABRT is much nicer than SIGSEGV and indicates that we really do want
     12        to crash here, whereas SIGSEGV is just a bug.
     13
     14        Also, let's be careful with our terminology in the existing error message here. Although
     15        GSubprocess currently always forks, I'm working to make it use posix_spawn() instead, so
     16        let's not claim that fork() has failed when it soon might not be used at all.
     17
     18        * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
     19        (WebKit::ProcessLauncher::launchProcess):
     20
    1212021-04-07  Jer Noble  <jer.noble@apple.com>
    222
  • trunk/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp

    r274676 r275605  
    185185
    186186    if (!process.get())
    187         g_error("Unable to fork a new child process: %s", error->message);
     187        g_error("Unable to spawn a new child process: %s", error->message);
    188188
    189189    const char* processIdStr = g_subprocess_get_identifier(process.get());
     190    if (!processIdStr)
     191        g_error("Spawned process died immediately. This should not happen.");
     192
    190193    m_processIdentifier = g_ascii_strtoll(processIdStr, nullptr, 0);
    191194    RELEASE_ASSERT(m_processIdentifier);
Note: See TracChangeset for help on using the changeset viewer.