[PATCH 0/2] gdbstub: don't crash if no gdb attached and gdb syscall attempted

Peter Maydell posted 2 patches 1 year, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220526190053.521505-1-peter.maydell@linaro.org
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
gdbstub.c            | 14 +++++++++++---
semihosting/config.c |  1 +
2 files changed, 12 insertions(+), 3 deletions(-)
[PATCH 0/2] gdbstub: don't crash if no gdb attached and gdb syscall attempted
Posted by Peter Maydell 1 year, 11 months ago
This patchset fixes a couple of bugs reported by
Liviu Ionescu related to semihosting syscall handling.

Firstly, if the user sets up the gdbstub but doesn't connect a gdb
(ie passes '-s' but not '-S'), and we try to use gdb for semihosting
syscalls (either because the user explicitly set target=gdb or else
via autodetection) then we currently segfault.  This patch adjusts
the behaviour so that "gdbstub initialized but no gdb attached to a
vCPU" is treated the same way we already treat "gdbstub not
initialized".

Secondly, we weren't handling commandlines where
--semihosting-config appears multiple times: these ought to be
merged together but instead we were effectively ignoring
all but the last one.

thanks
-- PMM

Peter Maydell (2):
  gdbstub: Don't use GDB syscalls if no GDB is attached
  semihosting/config: Merge --semihosting-config option groups

 gdbstub.c            | 14 +++++++++++---
 semihosting/config.c |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

-- 
2.25.1
Re: [PATCH 0/2] gdbstub: don't crash if no gdb attached and gdb syscall attempted
Posted by Peter Maydell 1 year, 10 months ago
On Thu, 26 May 2022 at 20:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> This patchset fixes a couple of bugs reported by
> Liviu Ionescu related to semihosting syscall handling.
>
> Firstly, if the user sets up the gdbstub but doesn't connect a gdb
> (ie passes '-s' but not '-S'), and we try to use gdb for semihosting
> syscalls (either because the user explicitly set target=gdb or else
> via autodetection) then we currently segfault.  This patch adjusts
> the behaviour so that "gdbstub initialized but no gdb attached to a
> vCPU" is treated the same way we already treat "gdbstub not
> initialized".
>
> Secondly, we weren't handling commandlines where
> --semihosting-config appears multiple times: these ought to be
> merged together but instead we were effectively ignoring
> all but the last one.
>
> thanks
> -- PMM
>
> Peter Maydell (2):
>   gdbstub: Don't use GDB syscalls if no GDB is attached
>   semihosting/config: Merge --semihosting-config option groups

I'll take these via target-arm.next.

thanks
-- PMM
Re: [PATCH 0/2] gdbstub: don't crash if no gdb attached and gdb syscall attempted
Posted by Alex Bennée 1 year, 10 months ago
Peter Maydell <peter.maydell@linaro.org> writes:

> On Thu, 26 May 2022 at 20:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> This patchset fixes a couple of bugs reported by
>> Liviu Ionescu related to semihosting syscall handling.
>>
>> Firstly, if the user sets up the gdbstub but doesn't connect a gdb
>> (ie passes '-s' but not '-S'), and we try to use gdb for semihosting
>> syscalls (either because the user explicitly set target=gdb or else
>> via autodetection) then we currently segfault.  This patch adjusts
>> the behaviour so that "gdbstub initialized but no gdb attached to a
>> vCPU" is treated the same way we already treat "gdbstub not
>> initialized".
>>
>> Secondly, we weren't handling commandlines where
>> --semihosting-config appears multiple times: these ought to be
>> merged together but instead we were effectively ignoring
>> all but the last one.
>>
>> thanks
>> -- PMM
>>
>> Peter Maydell (2):
>>   gdbstub: Don't use GDB syscalls if no GDB is attached
>>   semihosting/config: Merge --semihosting-config option groups
>
> I'll take these via target-arm.next.

Acked-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée