Date: Wed, 11 Aug 2021 22:14:17 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 77e736186d8f - stable/13 - bhyve: Move the gdb_active check to gdb_cpu_suspend(). Message-ID: <202108112214.17BMEH7j013900@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=77e736186d8f13246f886164c3e934a34f00af87 commit 77e736186d8f13246f886164c3e934a34f00af87 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-04-12 18:43:34 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2021-08-11 22:12:47 +0000 bhyve: Move the gdb_active check to gdb_cpu_suspend(). The check needs to be in the public routine (gdb_cpu_suspend()), not in the internal routine called from various places (_gdb_cpu_suspend()). All the other callers of _gdb_cpu_suspend() already check gdb_active, and this breaks the use of snapshots when the debug server is not enabled since gdb_cpu_suspend() tries to lock an uninitialized mutex. Reported by: Darius Mihai, Elena Mihailescu Reviewed by: elenamihailescu22_gmail.com Fixes: 621b5090487de9fed1b503769702a9a2a27cc7bb Differential Revision: https://reviews.freebsd.org/D29538 (cherry picked from commit eacc27affeff17beb3791793ba54458444df7135) --- usr.sbin/bhyve/gdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c index 3bff62418840..219d192b7c9a 100644 --- a/usr.sbin/bhyve/gdb.c +++ b/usr.sbin/bhyve/gdb.c @@ -731,8 +731,6 @@ static void _gdb_cpu_suspend(int vcpu, bool report_stop) { - if (!gdb_active) - return; debug("$vCPU %d suspending\n", vcpu); CPU_SET(vcpu, &vcpus_waiting); if (report_stop && CPU_CMP(&vcpus_waiting, &vcpus_suspended) == 0) @@ -807,6 +805,8 @@ void gdb_cpu_suspend(int vcpu) { + if (!gdb_active) + return; pthread_mutex_lock(&gdb_lock); _gdb_cpu_suspend(vcpu, true); gdb_cpu_resume(vcpu);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108112214.17BMEH7j013900>