Bug#841420: --enable-default-pie breaks kernel builds
On Fri, Oct 21, 2016 at 08:07:03AM -0500, S. R. Wright wrote: > As the kernel is the most important code gcc is ever likely to compile on > debian or any other distro for that matter, this change should be backed > out, and not reintroduced UNTIL the *official* kernel source is ready for > it. I agree with this, I would also recommend to wait for patchs to hit the LTS releases of the kernel (4.4, 4.1). As those are used on production systems. I also tried the patched mentioned earlier without luck: diff --git a/Makefile b/Makefile index 0f9cb36d45c2c..b95a6774e4600 100644 --- a/Makefile +++ b/Makefile @@ -341,8 +341,8 @@ include scripts/Kbuild.include # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as -LD = $(CROSS_COMPILE)ld -CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld -no-pie +CC = $(CROSS_COMPILE)gcc -no-pie CPP= $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm This does not work with gcc 6.2.0-7 on my environment. For now I've rollbacked to 6.2.0-6 which works as expected: $ cat /etc/apt/preferences.d/02_broken_kernel_builds Package: gcc-6-base Pin: version 6.2.0-7 Pin-Priority: -10 -- \o/ Arthur G Gandi.net
Bug#841420: --enable-default-pie breaks kernel builds
I agree with Eric; while the workaround is to back rev the gcc and its associated packages, I also build kernels straight from kernel.org, usually within hours of their availability and this has been working for me for many years, and it is not sufficient to justify this change by saying doing so "isn't a good idea." A change of functionality of this scope warrants a minor version number increase, this change was not merely a bug fix. As the kernel is the most important code gcc is ever likely to compile on debian or any other distro for that matter, this change should be backed out, and not reintroduced UNTIL the *official* kernel source is ready for it. -- sRw On 10/21/2016 06:43 AM, Wolfgang Walter wrote: On Friday, 21 October 2016 14:45:25 CEST Ritesh Raj Sarraf wrote: The Debian kernel packages still have a dependency on gcc-5, which may mean that the kernels are currently only built/supported with gcc-5. vanilla kernels (Linus' tree and the stable ones) could be compiled just fine with gcc 6.2.0-6 and that now fails. I still think this is a major regression and regard gcc 6.2.0-7 simply as broken. On Thu, 2016-10-20 at 11:22 -0500, S R Wright wrote: Concurring with Wolfgang; pulling the source straight from kernel.org and using identical .config files will work with 6.2.0-6 but fail with 6.2.0-7. I was able to build and install 4.8.3 with no issues after back-revving gcc et. al. to 6.2.0-6 -- sRw On 10/20/16 11:09, Wolfgang Walter wrote: Hello, with this version of gcc-6 I can't build vanilla kernels any more. It fails with even with CC_STACKPROTECTOR_STRONG disabled: scripts/kconfig/mconf Kconfig configuration written to .config *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. ksrc@ei:~/build/kernels/linux-4.8.3$ make scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h CC kernel/bounds.s kernel/bounds.c:1:0: error: code model kernel does not support PIC mode /* Kbuild:45: recipe for target 'kernel/bounds.s' failed make[1]: *** [kernel/bounds.s] Error 1 Makefile:1015: recipe for target 'prepare0' failed make: *** [prepare0] Error 2 I think this is a major regression if you can't build vanilla and stable kernels any more. Regards, Regards,
Bug#841420: --enable-default-pie breaks kernel builds
On Friday, 21 October 2016 14:45:25 CEST Ritesh Raj Sarraf wrote: > The Debian kernel packages still have a dependency on gcc-5, which may mean > that the kernels are currently only built/supported with gcc-5. vanilla kernels (Linus' tree and the stable ones) could be compiled just fine with gcc 6.2.0-6 and that now fails. I still think this is a major regression and regard gcc 6.2.0-7 simply as broken. > > On Thu, 2016-10-20 at 11:22 -0500, S R Wright wrote: > > Concurring with Wolfgang; pulling the source straight from kernel.org > > and using identical .config files will work with 6.2.0-6 but fail with > > 6.2.0-7. I was able to build and install 4.8.3 with no issues after > > back-revving gcc et. al. to 6.2.0-6 > > > > -- sRw > > > > On 10/20/16 11:09, Wolfgang Walter wrote: > > > Hello, > > > > > > with this version of gcc-6 I can't build vanilla kernels any more. It > > > fails > > > with even with CC_STACKPROTECTOR_STRONG disabled: > > > > > > scripts/kconfig/mconf Kconfig > > > configuration written to .config > > > > > > *** End of the configuration. > > > *** Execute 'make' to start the build or try 'make help'. > > > > > > ksrc@ei:~/build/kernels/linux-4.8.3$ make > > > scripts/kconfig/conf --silentoldconfig Kconfig > > >CHK include/config/kernel.release > > >CHK include/generated/uapi/linux/version.h > > >CHK include/generated/utsrelease.h > > >UPD include/generated/utsrelease.h > > >CC kernel/bounds.s > > > kernel/bounds.c:1:0: error: code model kernel does not support PIC mode > > > /* > > > > > > Kbuild:45: recipe for target 'kernel/bounds.s' failed > > > make[1]: *** [kernel/bounds.s] Error 1 > > > Makefile:1015: recipe for target 'prepare0' failed > > > make: *** [prepare0] Error 2 > > > > > > > > > I think this is a major regression if you can't build vanilla and stable > > > kernels any more. > > > > > > Regards, Regards, -- Wolfgang Walter Studentenwerk München Anstalt des öffentlichen Rechts
Bug#841420: --enable-default-pie breaks kernel builds
The Debian kernel packages still have a dependency on gcc-5, which may mean that the kernels are currently only built/supported with gcc-5. On Thu, 2016-10-20 at 11:22 -0500, S R Wright wrote: > Concurring with Wolfgang; pulling the source straight from kernel.org > and using identical .config files will work with 6.2.0-6 but fail with > 6.2.0-7. I was able to build and install 4.8.3 with no issues after > back-revving gcc et. al. to 6.2.0-6 > > -- sRw > > > On 10/20/16 11:09, Wolfgang Walter wrote: > > Hello, > > > > with this version of gcc-6 I can't build vanilla kernels any more. It fails > > with even with CC_STACKPROTECTOR_STRONG disabled: > > > > scripts/kconfig/mconf Kconfig > > configuration written to .config > > > > *** End of the configuration. > > *** Execute 'make' to start the build or try 'make help'. > > > > ksrc@ei:~/build/kernels/linux-4.8.3$ make > > scripts/kconfig/conf --silentoldconfig Kconfig > > CHK include/config/kernel.release > > CHK include/generated/uapi/linux/version.h > > CHK include/generated/utsrelease.h > > UPD include/generated/utsrelease.h > > CC kernel/bounds.s > > kernel/bounds.c:1:0: error: code model kernel does not support PIC mode > > /* > > > > Kbuild:45: recipe for target 'kernel/bounds.s' failed > > make[1]: *** [kernel/bounds.s] Error 1 > > Makefile:1015: recipe for target 'prepare0' failed > > make: *** [prepare0] Error 2 > > > > > > I think this is a major regression if you can't build vanilla and stable > > kernels any more. > > > > Regards, > > -- Given the large number of mailing lists I follow, I request you to CC me in replies for quicker response signature.asc Description: This is a digitally signed message part
Bug#841420: --enable-default-pie breaks kernel builds
Control: tags -1 - patch 2016-10-20 18:48 GMT+02:00 Sven Joachim: > On 2016-10-20 17:54 +0200, Bálint Réczey wrote: > >> Control: reassign -1 linux 4.7.8-1 >> Control: severity -1 serious >> Control: tags -1 patch >> >> Hi David, >> >> 2016-10-20 14:02 GMT+02:00 David Weinehall : >>> Package: gcc-6 >>> Severity: important >>> Version: 6.2.0-7 >>> >>> --enable-default-pie (first enabled in gcc-6 6.2.0-7) causes kernel >>> builds to fail. If the kernel is configured with the stack protector >>> enabled it'll fail with a rather unhelpful error message claiming >>> that the compiler doesn't support -fstack-protector, >>> but the problem is in fact caused by: >>> >>> kernel/bounds.c:1:0: error: code model kernel does not support PIC mode >>> >>> (The kernel is built with -mcmodel=kernel) >>> >>> I think it's fair to say that the kernel is kind of an important piece >>> of software and that it's imperative that we don't break kernel builds... >> >> The kernel is very important indeed and it did break in our build test. >> I'm sorry, somehow I missed filing bug for the linux package, just for >> user-mode-linux. >> The following patch fixes the FTBFS: >> >> --- linux-4.7.8/debian/rules.d/Makefile.inc >> +++ linux-4.7.8/debian/rules.d/Makefile.inc >> @@ -5,7 +5,8 @@ >> >> SHELL = /bin/sh -e >> >> -CC = $(CROSS_COMPILE)gcc >> +CC = $(CROSS_COMPILE)gcc -no-pie >> +LD = $(CROSS_COMPILE)ld -no-pie >> CXX = $(CROSS_COMPILE)g++ >> CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -Wall >> CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) \ >> >> Maybe the ld part is obsolete, I have not checked that. > > That patch might work for the Debian package, but has anybody contacted > the upstream kernel developers about that? At least the 4.8.3 vanilla > kernel fails in the same way, I haven't tested 4.9-rc1 yet. Fixing it upstream would certainly be better. I also haven't booted the built image, thus please use this patch only as inspiration. :-) Cheers, Balint > > FWIW, this issue has been discussed in Ubuntu for six months(!), see > https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1574982. > > Cheers, >Sven
Processed: Re: Bug#841420: --enable-default-pie breaks kernel builds
Processing control commands: > tags -1 - patch Bug #841420 [linux] --enable-default-pie breaks kernel builds Bug #841368 [linux] gcc-6 6.2.0-7 breaks kernel build if stack protection is enabled Removed tag(s) patch. Removed tag(s) patch. -- 841368: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841368 841420: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841420 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems
Bug#841420: --enable-default-pie breaks kernel builds
On 2016-10-20 17:54 +0200, Bálint Réczey wrote: > Control: reassign -1 linux 4.7.8-1 > Control: severity -1 serious > Control: tags -1 patch > > Hi David, > > 2016-10-20 14:02 GMT+02:00 David Weinehall: >> Package: gcc-6 >> Severity: important >> Version: 6.2.0-7 >> >> --enable-default-pie (first enabled in gcc-6 6.2.0-7) causes kernel >> builds to fail. If the kernel is configured with the stack protector >> enabled it'll fail with a rather unhelpful error message claiming >> that the compiler doesn't support -fstack-protector, >> but the problem is in fact caused by: >> >> kernel/bounds.c:1:0: error: code model kernel does not support PIC mode >> >> (The kernel is built with -mcmodel=kernel) >> >> I think it's fair to say that the kernel is kind of an important piece >> of software and that it's imperative that we don't break kernel builds... > > The kernel is very important indeed and it did break in our build test. > I'm sorry, somehow I missed filing bug for the linux package, just for > user-mode-linux. > The following patch fixes the FTBFS: > > --- linux-4.7.8/debian/rules.d/Makefile.inc > +++ linux-4.7.8/debian/rules.d/Makefile.inc > @@ -5,7 +5,8 @@ > > SHELL = /bin/sh -e > > -CC = $(CROSS_COMPILE)gcc > +CC = $(CROSS_COMPILE)gcc -no-pie > +LD = $(CROSS_COMPILE)ld -no-pie > CXX = $(CROSS_COMPILE)g++ > CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -Wall > CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) \ > > Maybe the ld part is obsolete, I have not checked that. That patch might work for the Debian package, but has anybody contacted the upstream kernel developers about that? At least the 4.8.3 vanilla kernel fails in the same way, I haven't tested 4.9-rc1 yet. FWIW, this issue has been discussed in Ubuntu for six months(!), see https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1574982. Cheers, Sven
Bug#841420: --enable-default-pie breaks kernel builds
Concurring with Wolfgang; pulling the source straight from kernel.org and using identical .config files will work with 6.2.0-6 but fail with 6.2.0-7. I was able to build and install 4.8.3 with no issues after back-revving gcc et. al. to 6.2.0-6 -- sRw On 10/20/16 11:09, Wolfgang Walter wrote: Hello, with this version of gcc-6 I can't build vanilla kernels any more. It fails with even with CC_STACKPROTECTOR_STRONG disabled: scripts/kconfig/mconf Kconfig configuration written to .config *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. ksrc@ei:~/build/kernels/linux-4.8.3$ make scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h CC kernel/bounds.s kernel/bounds.c:1:0: error: code model kernel does not support PIC mode /* Kbuild:45: recipe for target 'kernel/bounds.s' failed make[1]: *** [kernel/bounds.s] Error 1 Makefile:1015: recipe for target 'prepare0' failed make: *** [prepare0] Error 2 I think this is a major regression if you can't build vanilla and stable kernels any more. Regards,
Bug#841420: --enable-default-pie breaks kernel builds
Hello, with this version of gcc-6 I can't build vanilla kernels any more. It fails with even with CC_STACKPROTECTOR_STRONG disabled: scripts/kconfig/mconf Kconfig configuration written to .config *** End of the configuration. *** Execute 'make' to start the build or try 'make help'. ksrc@ei:~/build/kernels/linux-4.8.3$ make scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h CC kernel/bounds.s kernel/bounds.c:1:0: error: code model kernel does not support PIC mode /* Kbuild:45: recipe for target 'kernel/bounds.s' failed make[1]: *** [kernel/bounds.s] Error 1 Makefile:1015: recipe for target 'prepare0' failed make: *** [prepare0] Error 2 I think this is a major regression if you can't build vanilla and stable kernels any more. Regards, -- Wolfgang Walter Studentenwerk München Anstalt des öffentlichen Rechts
Processed: Re: Bug#841420: --enable-default-pie breaks kernel builds
Processing control commands: > reassign -1 linux 4.7.8-1 Bug #841420 [gcc-6] --enable-default-pie breaks kernel builds Bug reassigned from package 'gcc-6' to 'linux'. No longer marked as found in versions gcc-6/6.2.0-7. Ignoring request to alter fixed versions of bug #841420 to the same values previously set Bug #841420 [linux] --enable-default-pie breaks kernel builds There is no source info for the package 'linux' at version '4.7.8-1' with architecture '' Unable to make a source version for version '4.7.8-1' Marked as found in versions 4.7.8-1. > severity -1 serious Bug #841420 [linux] --enable-default-pie breaks kernel builds Severity set to 'serious' from 'important' > tags -1 patch Bug #841420 [linux] --enable-default-pie breaks kernel builds Added tag(s) patch. -- 841420: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841420 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems