Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

SDE signal handling bug

Mikulas_Patocka
Beginner
2,398 Views

Hi

 

I was running the Ajla programming language ( www.ajla-lang.cz ) in SDE-9.44.0-2024-08-22 on Linux and I got crashes. Ajla sets up a timer that triggers the SIGALRM signal every 10ms. I analyzed it and it turned out that these signals cause the problems.

 

When SDE processes a signal, it corrups the registers ZMM16-ZMM31 and the upper halves of ZMM0-ZMM15.

 

I uploaded a simplified example that shows this bug here: http://www.jikos.cz/~mikulas/testcases/sde/signal-bug.c
Run this example with "gcc -O2 signal-bug.c && sde64 -future -- ./a.out" and you get a "mismatch" error.

 

The kind of corruption depends on whether the host CPU supports AVX-512 or not. If I run it on a host CPU that supports AVX-512, the registers ZMM16-ZMM31 and the upper halves of ZMM0-ZMM15 are overwritten with zero on every signal. Only YMM0-YMM15 are preserved. If I run it on a host CPU that doesn't support AVX-512, the registers are not overwritten, but if I modify them inside the signal handler, the modifications are not reverted when the signal handler ends.

 

Note that the register corruption sometimes doesn't happen (I haven't found out the reason why), so I added a code that re-executes the binary if it doesn't crash for 1 second.

 

Mikulas

0 Kudos
1 Reply
AdyT_Intel
Moderator
2,271 Views

You are right, the save/restore of emulated registers was added only for the APX extended registers. The support for emulated vector registers is missing.

We will add fixing this issue to our plans.

0 Kudos
Reply