The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=3ac82ee8d84edd38d759e476f514bcd34287943b
commit 3ac82ee8d84edd38d759e476f514bcd34287943b Author: Piotr Kubaj <[email protected]> AuthorDate: 2026-12-03 16:19:16 +0000 Commit: Piotr Kubaj <[email protected]> CommitDate: 2026-12-04 12:10:53 +0000 powerpc: zero the FPU save area in PT_SETVSRREGS when it was not valid PT_SETVSRREGS marks the saved FPU registers valid and fills in the VSX halves of VSR0-31. The FP registers and the FPSCR are left alone, and on a thread that hasn't used the FPU since exec they still hold whatever the previous program left there. So after a PT_SETVSRREGS on such a thread PT_GETFPREGS and a core dump show the FP registers of the program that ran before the exec, and the new program gets them on its first FP instruction. Zero the save area first when it wasn't valid, like set_fpregs() does. Reported by: llm-postcr Reviewed by: jhibbits Fixes: 2ab5877e45d8 ("powerpc: use the register validity flags in the vector ptrace requests") MFC with: 2ab5877e45d8 Differential Revision: https://reviews.freebsd.org/D62379 --- sys/powerpc/powerpc/ptrace_machdep.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/powerpc/ptrace_machdep.c b/sys/powerpc/powerpc/ptrace_machdep.c index 083818b16e64..eeb1698b0d04 100644 --- a/sys/powerpc/powerpc/ptrace_machdep.c +++ b/sys/powerpc/powerpc/ptrace_machdep.c @@ -101,7 +101,10 @@ cpu_ptrace(struct thread *td, int req, void *addr, int data) break; error = copyin(addr, &vsr, sizeof(vsr)); if (error == 0) { - pcb->pcb_flags |= PCB_FPREGS; + if ((pcb->pcb_flags & PCB_FPREGS) == 0) { + memset(&pcb->pcb_fpu, 0, sizeof(pcb->pcb_fpu)); + pcb->pcb_flags |= PCB_FPREGS; + } /* * Doubleword 0 of VSR0-VSR31 overlap with FPR0-FPR31 and
