kern/60426: Signal handler corrupts AVX (YMM) registers

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60426
>Category:       kern
>Synopsis:       Signal handler corrupts AVX (YMM) registers
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 08 09:25:00 +0000 2026
>Originator:     Benny Siegert
>Release:        NetBSD 10.1_STABLE
>Organization:
The NetBSD Foundation
>Environment:
NetBSD 10.1/amd64
Architecture: x86_64
Machine: amd64
>Description:
This is a bug reported to Go about memory corruption in the runtime:

https://github.com/golang/go/issues/80285
runtime: async preemption corrupts AVX (YMM) state on netbsd/amd64

> It seems NetBSD 10.1/amd64 does not preserve the upper 128 bits of AVX (YMM)
> registers across signal delivery.

For now, the workaround has been to disable AVX completely in Go on NetBSD/amd64.
>How-To-Repeat:
> Repro (no Go, ymmsig.c attached to the bug report in GitHub): park a canary
> in ymm0, spin comparing it, while another thread sends SIGUSR1 whose handler
> clobbers YMM. On sigreturn the upper YMM half is not restored - the compare
> fails with mask=0000ffff (low XMM intact, high YMM lost). Clean on Linux
> (>1e9 iterations). Observed on QEMU -enable-kvm -cpu host (AMD Zen2 host,
> AVX2, no AVX-512), go-independent. This corrupts any AVX code interrupted by
> a signal (e.g. Go async preemption interrupting memmove).
>Fix:
Yes please!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.