gdbserver crash in gdb/gdbserver/thread.c::thread_search_callback
authorJoel Brobecker <brobecker@adacore.com>
Sun, 20 Dec 2015 05:49:59 +0000 (00:49 -0500)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 22 Dec 2015 15:26:17 +0000 (19:26 +0400)
commit0e50fe5ca6ed2ce780cbbfa516aec20b023433ce
treee5a293fe714e7232cba5aff548f6f92daf90704e
parentaec47d1d54be415050bbd3ccb93c0157d60ed92d
gdbserver crash in gdb/gdbserver/thread.c::thread_search_callback

Connecting GDB to a LynxOS-178 GDBserver causes GDBserver to crash:

    % gdbserver :4444 simple_main
    Process simple_main created; pid = 19
    Listening on port 4444
    Remote debugging from host 205.232.38.10
    Segmentation fault (core dumped)

The crash happens in thread_search_callback where the function
calls the_target->thread_stopped (via the thread_stopped macro)
without verifying whether the callback is NULL or not.

For the record, the regression was introduced by:

    commit a67a9faef0e32886c83611cc7a0ba61e91123063
    Date:   Mon Nov 30 16:05:26 2015 +0000
    Subject: gdbserver:prepare_access_memory: pick another thread

This patch avoids the crash by checking the value of the callback
first, before calling it.

gdb/gdbserver/ChangeLog:

        * target.c (thread_search_callback): Add check that
        the thread_stopped target callback is not NULL before
        calling it.
gdb/gdbserver/ChangeLog
gdb/gdbserver/target.c
This page took 0.025912 seconds and 4 git commands to generate.