[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SSE registers in thread state

From: Sergey Bugaev
Subject: Re: SSE registers in thread state
Date: Tue, 20 Jun 2023 13:14:44 +0300

On Tue, Jun 20, 2023 at 12:24 PM Samuel Thibault
<samuel.thibault@gnu.org> wrote:
> > I don't know much about SSE and those registers and fxsave/fxrstor and
> > xsave/xrstor, but it seems clear enough that this will result in
> > string operations breaking after a thread receives a signal
> AIUI the problem only happens if one uses SSE (e.g. string operations)
> in the signal handler while the interrupted thread uses SSE, thus not
> that common (and thus probably why we didn't notice the problem).

Yes, but on x86_64 the availability of SSE2 is guaranteed (I believe),
so the compilers will use it for basic data manipulation even if you
don't call a string function explicitly. That is where the 16-byte
stack alignment requirement comes from: the compiler can just use SSE
without any checking and assume it will work.

We also have to think about sigreturn itself potentially using SSE.
Well, that could perhaps be solved by compiling it with a flag to
disable that, but then it calls _hurd_sigstate_unlock (and that can
call gsync things) and __mach_port_mod_refs, and we definitely
wouldn't want to deoptimize generic code.

Oh, and the i386 version of sigreturn calls memcpy right after frstor,
tha is surely bound to go very well... At least mine doesn't do that.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]