[PATCH xserver] On x86 targets, turn off SSE instructions for SlowBcopy

Dimitry Andric dimitry at andric.com
Sun Jul 30 18:49:49 UTC 2017


Some compilers (e.g. clang) will recognize the memcpy idiom in
xf86SlowBcopy(), and optimize it into a loop using SSE instructions.
This can cause "Illegal instruction" crashes under virtualization
environments such as qemu/kvm.

To prevent this, explicitly turn off SSE for SlowBcopy.c, when compiling
for an x86 target.

See also: https://bugs.freebsd.org/202643

Signed-off-by: Dimitry Andric <dimitry at andric.com>
---
 hw/xfree86/os-support/misc/Makefile.am | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/os-support/misc/Makefile.am b/hw/xfree86/os-support/misc/Makefile.am
index 0265aecd4..43c7010e2 100644
--- a/hw/xfree86/os-support/misc/Makefile.am
+++ b/hw/xfree86/os-support/misc/Makefile.am
@@ -7,6 +7,10 @@ libmisc_la_SOURCES = SlowBcopy.c
 
 AM_CPPFLAGS = $(XORG_INCS)
 
-AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
+if I386_VIDEO
+I386_VIDEO_CFLAGS = -mno-sse
+endif
+
+AM_CFLAGS = $(I386_VIDEO_CFLAGS) $(XORG_CFLAGS) $(DIX_CFLAGS)
 
 EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS)
-- 
2.13.3



More information about the xorg-devel mailing list