FS#15498 - [gcc] can't compile grsecurity kernel
Attached to Project:
Arch Linux
Opened by Jonathan Liu (net147) - Monday, 13 July 2009, 11:59 GMT
Last edited by Allan McRae (Allan) - Tuesday, 14 July 2009, 03:30 GMT
Opened by Jonathan Liu (net147) - Monday, 13 July 2009, 11:59 GMT
Last edited by Allan McRae (Allan) - Tuesday, 14 July 2009, 03:30 GMT
|
Details
Description:
CC [M] drivers/staging/meilhaus/memain.o /home/user/abs/kernel26-grsecurity/src/linux-2.6.29/arch/x86/include/asm/uaccess_64.h: Assembler messages: /home/user/abs/kernel26-grsecurity/src/linux-2.6.29/arch/x86/include/asm/uaccess_64.h:92: Error: suffix or operands invalid for `movq' make[3]: *** [drivers/staging/meilhaus/memain.o] Error 1 make[2]: *** [drivers/staging/meilhaus] Error 2 make[1]: *** [drivers/staging] Error 2 make: *** [drivers] Error 2 Additional info: * gcc 4.4.0-5 * Compiling with gcc 4.4.0-2 doesn't work * Compiling with gcc 4.4.0 20090707 snapshot doesn't work either * Compiling with gcc 4.3.3 works Steps to reproduce: * wget http://aur.archlinux.org/packages/kernel26-grsecurity/kernel26-grsecurity.tar.gz * tar -zxvf kernel26-grsecurity.tar.gz * cd kernel26-grsecurity * makepkg The code that fails to compile is in linux-2.6.29/arch/x86/include/asm/uaccess_64.h in the function __copy_to_user and fails when the size argument is 8. Removing the __always_inline macro (which expands to the inline keyword) makes it compile successfully. Compiling with -O0 instead of -O2 also works. It seems to be a compiler bug of some sort ... |
This task depends upon
err = copy_to_user(arg, &karg, sizeof(me_query_version_main_driver_t));
sizeof(me_query_version_main_driver_t) is 8.
It seems like some sort of GCC optimisation error introduced in 4.4.
Running Arch Linux 64-bit with Intel(R) Pentium(R) Dual CPU E2220 @ 2.40GHz.
I am sure that you don't use the "meilhaus" :)
I could add a dependency on GCC 4.3.3 from AUR and get it to use that in the meantime I suppose...
Anyone know GCC options for printing out the assembly code with the compiler warnings?
Anyway, almost everything I have seen not compile at -02 but do compile at lower optimisation in gcc-4.4 can be "fixed" by adding the "-fno-strict-aliasing". If that works, it is a code bug and if not, it is a compiler or code bug... Either way, a bug report needs to go upstream. Not much we can do here.
Anyway: Yes, for some reason the compiler generates this instruction: movq $4294967295,(%rbp)
Using http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.6.tar.bz2 + http://www.grsecurity.net/test/grsecurity-2.1.14-2.6.29.6-200907122214.patch
[djgera@exequiel linux-2.6.29]$ gcc -Wp,-MD,drivers/staging/meilhaus/.memain.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include -Iinclude -I/tmp/kernel26-grsecurity/linux-2.6.29/arch/x86/include -include include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Iarch/x86/include/asm/mach-default -Wframe-larger-than=2048 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fwrapv -fno-dwarf2-cfi-asm -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(memain)" -D"KBUILD_MODNAME=KBUILD_STR(memain)" -c drivers/staging/meilhaus/memain.c -S -o - | grep movq
For example in arch/x86/include/asm/uaccess.h in the macro __put_user_asm add a comment
asm volatile("1: mov"itype" %"rtype"1,%2 /* HOLA */ \n" \
but if grsecurity patch is present , will be in the output.
Closing as upstream. Request reopen if it is a gcc bug and upstream provides a patch.