diff mbox series

[39/66] bsd-user: Fix cpu_copy to initialize new_cpu queues, not source

Message ID 20260515-misc-2026q2-v1-39-5438ca41b27a@bsdimp.com
State New
Headers show
Series bsd-user: Upstream most of the remaining system calls | expand

Commit Message

Warner Losh May 15, 2026, 9:19 p.m. UTC
QTAILQ_INIT was called on the source cpu's breakpoints and watchpoints
lists, destroying them before the QTAILQ_FOREACH loops could iterate
them. Fix to initialize new_cpu's lists instead, matching linux-user.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index a79ee52cc1..3c150b54cd 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -245,7 +245,7 @@  CPUArchState *cpu_copy(CPUArchState *env)
      * Note: Once we support ptrace with hw-debug register access, make sure
      * BP_CPU break/watchpoints are handled correctly on clone.
      */
-    QTAILQ_INIT(&cpu->breakpoints);
+    QTAILQ_INIT(&new_cpu->breakpoints);
     QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
         cpu_breakpoint_insert(new_cpu, bp->pc, bp->flags, NULL);
     }