qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: stephane duverger <stephane.duverger@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] fix gdbserver_state pointer validation
Date: Mon, 9 Jul 2018 14:54:59 +0200	[thread overview]
Message-ID: <20180709125452.7utyomtsxr6xaxdi@vm.localdomain> (raw)

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

             reply	other threads:[~2018-07-09 12:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 12:54 stephane duverger [this message]
2018-07-09 15:42 ` [Qemu-devel] [PATCH] fix gdbserver_state pointer validation 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180709125452.7utyomtsxr6xaxdi@vm.localdomain \
    --to=stephane.duverger@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).