summary refs log tree commit diff stats
path: root/gitlab/issues_text/target_missing/host_missing/accel_missing/1725
diff options
context:
space:
mode:
authorChristian Krinitsin <mail@krinitsin.com>2025-05-30 16:52:07 +0200
committerChristian Krinitsin <mail@krinitsin.com>2025-05-30 16:52:17 +0200
commit9260319e7411ff8281700a532caa436f40120ec4 (patch)
tree2f6bfe5f3458dd49d328d3a9eb508595450adec0 /gitlab/issues_text/target_missing/host_missing/accel_missing/1725
parent225caa38269323af1bfc2daadff5ec8bd930747f (diff)
downloadqemu-analysis-9260319e7411ff8281700a532caa436f40120ec4.tar.gz
qemu-analysis-9260319e7411ff8281700a532caa436f40120ec4.zip
gitlab scraper: download in toml and text format
Diffstat (limited to 'gitlab/issues_text/target_missing/host_missing/accel_missing/1725')
-rw-r--r--gitlab/issues_text/target_missing/host_missing/accel_missing/172521
1 files changed, 21 insertions, 0 deletions
diff --git a/gitlab/issues_text/target_missing/host_missing/accel_missing/1725 b/gitlab/issues_text/target_missing/host_missing/accel_missing/1725
new file mode 100644
index 000000000..77dd71e0c
--- /dev/null
+++ b/gitlab/issues_text/target_missing/host_missing/accel_missing/1725
@@ -0,0 +1,21 @@
+qemu-system-x86_64 reports wrong thread to GDB on SIGINT
+Description of problem:
+Upon interruption of a thread by GDB, QEMU in some circumstances will send a stop reply with the ID of a thread that had not been resumed.
+
+This happens for the following reasons:
+1. GDB uses `vCont` exclusively to resume and step through threads.
+2. When a thread is interrupted by GDB, QEMU runs `vm_stop(RUN_STATE_PAUSED)`, which triggers `gdb_vm_state_change`, which, in turn, uses whatever CPU is pointed to by `gdbserver_state.c_cpu` at that time to construct the stop reply.
+3. The `vCont` handler in QEMU doesn't set `gdbserver_state.c_cpu` before resuming any CPUs.
+
+Important to note is that stepping is not affected by this issue because the `EXCP_DEBUG` handler sets `gdbserver_state.c_cpu` to the CPU the exception happened in before `gdb_vm_state_change` runs. Which also means single stepping before continuing is an effective way to work around this bug.
+Steps to reproduce:
+1. Run QEMU with at least two threads and the GDB stub enabled.
+2. Run `gdb --nx --ex 'target remote :1234' --ex 'set scheduler-locking on'`
+3. Switch to Thread 1.2 in GDB with `thr 2`
+4. Resume Thread 1.2 in GDB with `c`
+5. Press Ctrl+C to interrupt the VM
+6. Notice that the event is reported as having happened in Thread 1.1, which has not been resumed.
+Additional information:
+Note that, while this bug happens no matter the state of `scheduler-locking`, it only becomes a problem when it is enabled. This is because, when it is disabled, GDB will always resume all threads on `continue`, so it doesn't matter what thread ID QEMU says the interrupt happened in, as it is guaranteed to have been resumed anyway. That, however, is not the case when `scheduler-locking` is enabled.
+
+Regardless, I don't think it makes sense for QEMU to be reporting events happening in threads that weren't resumed through either `s/S/c/C` or `vCont`, which is what it's doing here.