XSAVE-related segfaults observed under wine

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Jun 27 15:10:15 GMT 2025


Hi Pip,

On Jun 27 14:41, Pip Cet via Cygwin wrote:
> My suggested fix is to align the value in %rbx to the next 64-byte
> multiple after the "cpuid" instruction is executed, by performing the
> assembler equivalent of $rbx += 63; $rbx &= -64; I tried this:
> 
> diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
> index 861a2405b..d681fde3f 100755
> --- a/winsup/cygwin/scripts/gendef
> +++ b/winsup/cygwin/scripts/gendef
> @@ -232,6 +232,8 @@ sigdelayed:
>  	movl	\$0x0d,%eax
>  	xorl	%ecx,%ecx
>  	cpuid	# get necessary space for xsave
> +	addq	\$63, %rbx
> +	andq	\$-64, %rbx # align to next 64-byte multiple

what about a oneliner instead by just aligning rsp?  As in

>  	movq	%rbx,%rcx
>  	addq	\$0x48,%rbx # 0x18 for alignment, 0x30 for additional space
>  	subq	%rbx,%rsp

  +     andq    \$-64, %rsp

Would you mind to create a git send-email compatible patch with a nice
commit message basically duplicating your great description of the
problem and matching "Fixes:" and "Signed-off-by:" lines?

You can send it here or to the cygwin-patches mailing list.


Thanks,
Corinna


More information about the Cygwin mailing list