Re: [PATCH v6 00/15] Handle variable XSAVE layouts

Keith Seitz via Gdb-patches
2023-07-25T18:43:38Z

On 7/25/23 11:15, John Baldwin wrote:
> On 7/25/23 10:17 AM, Keith Seitz wrote:
>> On 7/14/23 08:51, John Baldwin wrote:
>> 0x55ef54d4e9bf memcpy
>>           /usr/include/bits/string_fortified.h:29
>> 0x55ef54d4e9bf _Z18i387_collect_xsavePK8regcacheiPvi
>>           ../../gdb/i387-tdep.c:1543
>
> Can you confirm where this is in your patched copy?  For me this line is here:
>
>   if (gcore)
>     {
>       /* Clear XSAVE extended state.  */
>       memset (regs, 0, tdep->xsave_layout.sizeof_xsave);
>
>       /* Update XCR0 and `xstate_bv' with XCR0 for gcore.  */
>       if (tdep->xsave_xcr0_offset != -1)
>>>>     memcpy (regs + tdep->xsave_xcr0_offset, &tdep->xcr0, 8);
>       memcpy (XSAVE_XSTATE_BV_ADDR (regs), &tdep->xcr0, 8);
>     }

Yes, that's the problem spot.

> If you have a core handy, could you provide the output of 'p tdep->xsave_layout'
> and 'p tdep->xsave_xcr0_offset'?
>

I do have a corefile:

(gdb) up
#6 i387_collect_xsave (regcache=0x5568a96b1ab0, regnum=-1, xsave=0x0, gcore=1)
at ../../gdb/i387-tdep.c:1543
1543 memcpy (regs + tdep->xsave_xcr0_offset, &tdep->xcr0, 8);
(gdb) p tdep->xsave_layout
$1 = {sizeof_xsave = 0, avx_offset = 0, bndregs_offset = 0, bndcfg_offset = 0,
k_offset = 0, zmm_h_offset = 0, zmm_offset = 0, pkru_offset = 0}
(gdb) p tdep->xsave_xcr0_offset
$2 = 464

If there's anything I can do to help, please do not hesitate to ask!

Keith