2

I have looked around for this specific error however I did not find it, instead I found errors that are similar such as 'not supported by compiler'.

I am trying to compile Kernel version 4.8.8, i have patched it with grsecuirty if that makes any difference.

This is the entire error from the output command fakeroot make-kpkg --initrd kernel_image:

Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong available but compiler is broken
Makefile:1059: recipe for target 'prepare-compiler-check' failed
make[2]: *** [prepare-compiler-check] Error 1
make[2]: Leaving directory '/home/shurik/GrSec/linux-4.8.8'
debian/ruleset/targets/common.mk:194: recipe for target 'debian/stamp/conf/kernel-conf' failed
make[1]: *** [debian/stamp/conf/kernel-conf] Error 2
make[1]: Leaving directory '/home/shurik/GrSec/linux-4.8.8'
/usr/share/kernel-package/ruleset/minimal.mk:93: recipe for target 'debian/stamp/conf/minimal_debian' failed
make: *** [debian/stamp/conf/minimal_debian] Error 2
Failed to create a ./debian directory:  at /usr/bin/make-kpkg line 970.

Currently I am running Debian Sid x86_64, my compiler is gcc 6.2.0.

I tried compiling a simple C program with the -fstack-protector-strong flag and it was a success.

1 Answer 1

1

This is a problem with Linux and Debian, not Grsecurity. The bug has been noted.

Apply something like the following patch:

--- a/Makefile
+++ b/Makefile
@@ -622,6 +622,8 @@ include arch/$(SRCARCH)/Makefile
 KBUILD_CFLAGS  += $(call cc-option,-fno-delete-null-pointer-checks,)
 KBUILD_CFLAGS  += $(call cc-disable-warning,maybe-uninitialized,)
 KBUILD_CFLAGS  += $(call cc-disable-warning,frame-address,)
+KBUILD_CFLAGS  += $(call cc-option,-fno-PIE)
+KBUILD_AFLAGS  += $(call cc-option,-fno-PIE)

 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
 KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)

--- a/scripts/gcc-x86_64-has-stack-protector.sh
+++ b/scripts/gcc-x86_64-has-stack-protector.sh
@@ -1,6 +1,6 @@
 #!/bin/sh

-echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
+echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
 if [ "$?" -eq "0" ] ; then
    echo y
 else

--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -16,6 +16,7 @@ KCOV_INSTRUMENT := n

 KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large
 KBUILD_CFLAGS += -m$(BITS)
+KBUILD_CFLAGS += $(call cc-option,-fno-PIE)

 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
        $(call if_changed,ld)

Actually, the Makefile doesn't patch on 4.8.10 and requires some manual fiddling, but afterwards it works.

Or... wait. I think mainline will be fixed quickly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .