qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix gdbserver_state pointer validation
@ 2018-07-09 12:54 stephane duverger
  2018-07-09 15:42 ` Alex Bennée
  0 siblings, 1 reply; 7+ messages in thread
From: stephane duverger @ 2018-07-09 12:54 UTC (permalink / raw)
  To: qemu-devel

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,

Signed-off-by: Stephane Duverger <stephane.duverger@gmail.com>
---
 gdbstub.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdbstub.c b/gdbstub.c
index d6ab95006c..788fd625ab 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1412,6 +1412,9 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
 
 void gdb_set_stop_cpu(CPUState *cpu)
 {
+    if (!gdbserver_state) {
+        return;
+    }
     gdbserver_state->c_cpu = cpu;
     gdbserver_state->g_cpu = cpu;
 }
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-07-12  8:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-09 12:54 [Qemu-devel] [PATCH] fix gdbserver_state pointer validation stephane duverger
2018-07-09 15:42 ` Alex Bennée
2018-07-10 11:44   ` stephane duverger
2018-07-10 21:14     ` Philippe Mathieu-Daudé
2018-07-11  7:52       ` stephane duverger
2018-07-11 13:58         ` Philippe Mathieu-Daudé
2018-07-12  8:30           ` stephane duverger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).