Here is a patch for review to address the xmm register value corruption 
occurring in user code that is heavily bombarded by signals.

I have added an additional 'xstate_size' member to the sigcontext structures 
defined for i386 and amd64. xstate and xstate_size are determined during 
processing of the first signal (without a previous sigcontext). When a pending 
signal is handled, xstate_size bytes are copied from the previous sigcontext to 
sustain the original state of the thread for restoration after __sigreturn.

Hopefully most of the patch is simple. There is one noteworthy alteration. I 
have removed the _hurdsig_catch_memory_fault (ss->context) around access to the 
previous ss->context. There was no handling of the situation that ss->context 
caused a fault (ie returned non-zero) which meant that any previous xstate was 
lost but the signal handling continued anyway. Additionally, in the case where 
ss->context was not NULL, the previous context had already been checked for 
memory fault (in post_signal) before being copied into a new context on the 
stack of the caller. I couldn't therefore see what the benefit was in having 
this.

This patch has been tested successfully on hurd-i386 and hurd-amd64 using the 
test case 'sigtest_xmm0.c' attached to message 
https://lists.gnu.org/archive/html/bug-hurd/2026-01/msg00241.html

Mike.

Reply via email to