Skip to content
  • Peter Maydell's avatar
    3ddd9036
    gdbstub: Correct misparsing of vCont C/S requests · 3ddd9036
    Peter Maydell authored
    In the vCont packet, two of the command actions (C and S) take an
    argument specifying the signal to be sent to the process/thread, which is
    sent as an ASCII string of two hex digits which immediately follow the
    'C' or 'S' character.
    
    Our code for parsing this packet accidentally skipped the first of the
    two bytes of the signal value, because it started parsing the hex string
    at 'p + 1' when the preceding code had already moved past the 'C' or
    'S' with "cur_action = *p++".
    
    This meant that we would only do the right thing for signals below
    10, and would misinterpret the rest.  For instance, when the debugger
    wants to send the process a SIGPROF (27 on x86-64) we mangle this into
    a SIGSEGV (11).
    
    Remove the accidental double increment.
    
    Fixes: https://bugs.launchpad.net/qemu/+bug/1773743
    
    
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
    Message-id: 20201121210342.10089-1-peter.maydell@linaro.org
    3ddd9036
    gdbstub: Correct misparsing of vCont C/S requests
    Peter Maydell authored
    In the vCont packet, two of the command actions (C and S) take an
    argument specifying the signal to be sent to the process/thread, which is
    sent as an ASCII string of two hex digits which immediately follow the
    'C' or 'S' character.
    
    Our code for parsing this packet accidentally skipped the first of the
    two bytes of the signal value, because it started parsing the hex string
    at 'p + 1' when the preceding code had already moved past the 'C' or
    'S' with "cur_action = *p++".
    
    This meant that we would only do the right thing for signals below
    10, and would misinterpret the rest.  For instance, when the debugger
    wants to send the process a SIGPROF (27 on x86-64) we mangle this into
    a SIGSEGV (11).
    
    Remove the accidental double increment.
    
    Fixes: https://bugs.launchpad.net/qemu/+bug/1773743
    
    
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
    Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
    Message-id: 20201121210342.10089-1-peter.maydell@linaro.org
Loading