From bc3e6ded65043a1da221f6219789d0783a524a41 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Mon, 2 Jul 2018 18:26:57 +0900 Subject: [PATCH] disable sse for everyone GCC optimizes big switches with sse so we could clobber users floating point registers when they would do a syscall Reproducer: ``` #include #include union num { float f; unsigned long long i; }; #define WORKSIZE (1024 * 1024 * 32) int main(int argc, char **argv) { char *work = malloc(WORKSIZE); char *fromaddr; char sink; union num r; unsigned long long int offset; r.f = drand48(); printf("r: %llx\n", (long long)r.i); offset = (long long int)(r.f * (double)WORKSIZE); fromaddr = work + offset; printf("%e %llx %llx\n", r.f, offset, fromaddr); sink = *fromaddr; return 0; } ``` Change-Id: I7bb0883ec8ef2f245ab98064e308025422afc115 --- kernel/Makefile.build.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/Makefile.build.in b/kernel/Makefile.build.in index 77bf0238..931a4f5b 100644 --- a/kernel/Makefile.build.in +++ b/kernel/Makefile.build.in @@ -19,7 +19,7 @@ endif CFLAGS += -I$(SRC)/include -I@abs_builddir@/../ -I@abs_builddir@/include -D__KERNEL__ -g -fno-omit-frame-pointer -fno-inline -fno-inline-small-functions ifneq ($(ARCH), arm64) -CFLAGS += -mcmodel=large -mno-red-zone +CFLAGS += -mcmodel=large -mno-red-zone -mno-sse endif LDFLAGS += -e arch_start IHKOBJ = ihk/ihk.o