Page 1 of 1

grsecurity-2.1.14-2.6.31.4 compilation error

PostPosted: Tue Oct 13, 2009 4:26 am
by forsaken
grsecurity-2.1.14-2.6.31.4-200910130056.patch fails to compile for me with:

CC arch/x86/mm/extable.o
arch/x86/mm/extable.c: In function 'swap_ex':
arch/x86/mm/extable.c:30: error: implicit declaration of function 'pax_open_kernel'
arch/x86/mm/extable.c:33: error: implicit declaration of function 'pax_close_kernel'
make[2]: *** [arch/x86/mm/extable.o] Error 1

amd64 build
gcc version 4.4.1 (Gentoo Hardened 4.4.1-r2 p1.0, espf-0.3.5)

Re: grsecurity-2.1.14-2.6.31.4 compilation error

PostPosted: Tue Oct 13, 2009 10:42 am
by elazar
Ditto:

Slackware 13.0 x86_64
gcc version 4.3.3 (GCC)
GNU ld (Linux/GNU Binutils) 2.18.50.0.9.20080822

elazar

Re: grsecurity-2.1.14-2.6.31.4 compilation error

PostPosted: Tue Oct 13, 2009 3:04 pm
by specs
Found same problem compiling for x86_64.
Kernel for i386 compiles and works without problems.

It seems adding one rule to arch/x86/mm/extable.c fixes the problem
Code: Select all
--- linux-2.6.31.4-grsec/arch/x86/mm/extable.c  2009-10-13 21:07:59.000000000 +0200
+++ linux-2.6.31.4-grsec/arch/x86/mm/extable.c  2009-10-13 21:11:49.000000000 +0200
@@ -2,6 +2,7 @@
 #include <linux/spinlock.h>
 #include <linux/sort.h>
 #include <asm/uaccess.h>
+#include <asm/pgtable.h>
 
 /*
  * The exception table needs to be sorted so that the binary

However the compilation then ends with
Code: Select all
make[1]: [grsecurity/grsec_hidesym.o] Error 1 (ignored)
make[1]: [grsecurity/grsec_hidesym.o] Error 1 (ignored)
  grsec: protected kernel image paths
  LD      vmlinux.o
  MODPOST vmlinux.o
WARNING: modpost: Found 2860 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
  GEN     .version
  CHK     include/linux/compile.h
  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
arch/x86/built-in.o: In function `no_context':
fault.c:(.text+0x190e4): undefined reference to `_etext'
arch/x86/built-in.o: In function `__change_page_attr_set_clr':
pageattr.c:(.text+0x1a597): undefined reference to `_etext'
pageattr.c:(.text+0x1a6fa): undefined reference to `_etext'
pageattr.c:(.text+0x1a761): undefined reference to `_etext'
arch/x86/built-in.o: In function `setup_arch':
(.init.text+0xe38): undefined reference to `_etext'
arch/x86/built-in.o:(.init.text+0xe56): more undefined references to `_etext' follow
make: *** [.tmp_vmlinux1] Error 1


And the reference to "#include <asm/sections.h>" was present in arch/x86/mm/pageattr.c

Re: grsecurity-2.1.14-2.6.31.4 compilation error

PostPosted: Wed Oct 14, 2009 2:16 pm
by specs
The new patch works for 2.6.31.4 on amd64.

Thank you.