Re: the x86 sysret_rip test fails on the Intel FRED architecture

From: H. Peter Anvin
Date: Mon Jan 23 2023 - 19:03:50 EST


On 1/23/23 15:53, Andrew Cooper wrote:

A simple workaround is: just compile it with "-mno-red-zone" flag.

You can't compile userspace like that, unless you recompile and
statically link everything including libc.

The proper way to fix this is to add a "+r" constraint on the stack
pointer, at which point the compiler will arrange for nothing in the
redzone to be live around the asm block.


So you are of course right that that is The Right Way[TM] to fix this.

However, to be picky: since the redzone is not in use across function calls, it is perfectly legitimate to inhibit the redzone for one function only.

-hpa