The branch main has been updated by pkubaj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=92e3711fa2237997aa5c6a333a8b056f3361cda4

commit 92e3711fa2237997aa5c6a333a8b056f3361cda4
Author:     Piotr Kubaj <[email protected]>
AuthorDate: 2026-12-03 17:06:21 +0000
Commit:     Piotr Kubaj <[email protected]>
CommitDate: 2026-12-04 12:26:54 +0000

    powerpc: don't single step a thread created while stepping
    
    cpu_copy_thread() copies the trap frame of the thread that creates the
    new one, MSR[SE] included. thr_new(2) doesn't care, cpu_set_upcall()
    builds a new MSR, but a Linux clone(CLONE_THREAD) keeps the copy. The
    new thread then takes a trace trap on its first instruction: the
    debugger gets a SIGTRAP from a thread it never stepped, and if it has
    detached by then, the process dies.
    
    Clear it there too, like cpu_fork() does.
    
    Reported by:    llm-postcr
    Approved by:    jhibbits (blanket)
---
 sys/powerpc/powerpc/exec_machdep.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/powerpc/powerpc/exec_machdep.c 
b/sys/powerpc/powerpc/exec_machdep.c
index 29f501842bdb..dd1150c6b5ec 100644
--- a/sys/powerpc/powerpc/exec_machdep.c
+++ b/sys/powerpc/powerpc/exec_machdep.c
@@ -1174,6 +1174,11 @@ cpu_copy_thread(struct thread *td, struct thread *td0)
        tf->fixreg[FIRSTARG + 1] = 0;
        tf->cr &= ~0x10000000;
 
+#ifdef AIM
+       /* Don't single step the new thread, see cpu_fork(). */
+       tf->srr1 &= ~PSL_SE;
+#endif
+
        /* Set registers for trampoline to user mode. */
        cf = (struct callframe *)tf - 1;
        memset(cf, 0, sizeof(struct callframe));

Reply via email to