Re: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation

2018-07-12 Thread stephane duverger
Hi Phil, Well, at least we agree the gdb stub code is not straightforward. > > And apparently without seeing the bigger picture about how you are using > this, I am missing something. Sorry for that, i will try to explain it clearly. This is something rather simple indeed: 1 - during MachineSta

Re: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation

2018-07-11 Thread Philippe Mathieu-Daudé
Hi Stephane, On 07/11/2018 04:52 AM, stephane duverger wrote: > To reach gdb_set_stop_cpu() with gdbserver_state == NULL, you previously >> entered gdb_vm_state_change() with and use CPUState *cpu = >> gdbserver_state->c_cpu = NULL deref, which shouldn't happen. >> Also in gdb_set_stop_cpu() you f

Re: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation

2018-07-11 Thread stephane duverger
To reach gdb_set_stop_cpu() with gdbserver_state == NULL, you previously > entered gdb_vm_state_change() with and use CPUState *cpu = > gdbserver_state->c_cpu = NULL deref, which shouldn't happen. > Also in gdb_set_stop_cpu() you finally call cpu_single_step(cpu=crap) > which then deref crap->singl

Re: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation

2018-07-10 Thread Philippe Mathieu-Daudé
On 07/10/2018 08:44 AM, stephane duverger wrote: > Hi Alex, > > There don't seem to be any other patches attached? I would NACK a patch >> that isn't actually used in-tree. > > > No there isn't ! I should have not been so prolix. Actually the patch > corrects a > possible null pointer dereferenc

Re: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation

2018-07-10 Thread stephane duverger
Hi Alex, There don't seem to be any other patches attached? I would NACK a patch > that isn't actually used in-tree. No there isn't ! I should have not been so prolix. Actually the patch corrects a possible null pointer dereference in the gdbserver code. That's all folks. Below is how I discove

Re: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation

2018-07-09 Thread Alex Bennée
stephane duverger writes: > Hi, > > This is a small patch to gdbstub rather insignificant at first sight: > fix null pointer dereference. It actually allows to take benefit of > gdb features (breakpoints/sstep) internally (ie. special purpose > board) without connecting a gdb client to the Qemu

[Qemu-devel] [PATCH] fix gdbserver_state pointer validation

2018-07-09 Thread stephane duverger
Hi, This is a small patch to gdbstub rather insignificant at first sight: fix null pointer dereference. It actually allows to take benefit of gdb features (breakpoints/sstep) internally (ie. special purpose board) without connecting a gdb client to the Qemu instance gdbserver stub. Regards, Sign