Hello, Linux kernels built with binutils HEAD, starting some time after 27.02.2018, no longer boot, but immediately cause a reboot. The final vmlinux binary is ~5MB smaller (out of ~600MB), and the .text section starts at 0x1000, instead of the usual 0x20000: --- good.txt 2018-03-20 09:35:37.614685097 +0100 +++ bad.txt 2018-03-20 09:35:52.111352335 +0100 @@ -10,7 +10,7 @@ ELF Header: Version: 0x1 Entry point address: 0x1000000 Start of program headers: 64 (bytes into file) - Start of section headers: 650727648 (bytes into file) + Start of section headers: 645898400 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) @@ -22,78 +22,78 @@ ELF Header: Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 - [ 1] .text PROGBITS ffffffff81000000 200000 e03000 00 AX 0 0 64 - [ 2] .rela.text RELA 0000000000000000 1164bb58 7362c0 18 I 70 1 8 [...] + [ 1] .text PROGBITS ffffffff81000000 001000 e03000 00 AX 0 0 64 + [ 2] .rela.text RELA 0000000000000000 111b0b18 7362c0 18 I 70 1 8 I'll try to find the culprit via bisection, last working version I have is HEAD as of 27.02.2018. Thanks! Manuel
Patch "ld: Add --enable-separate-code" by H.J. Lu (git commit f6aec96dce1ddbd8961a3aa8a2925db2021719bb) is the first bad one. I suppose linux has to be patched to disable this feature?
This is a kernel bug: https://bugzilla.kernel.org/show_bug.cgi?id=198851 and will be fixed by Commit-ID: e3d03598e8ae7d195af5d3d049596dec336f569f Gitweb: https://git.kernel.org/tip/e3d03598e8ae7d195af5d3d049596dec336f569f Author: H.J. Lu <hjl.tools@gmail.com> AuthorDate: Mon, 19 Mar 2018 13:57:46 -0700 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Tue, 20 Mar 2018 08:03:03 +0100 x86/build/64: Force the linker to use 2MB page size Binutils 2.31 will enable -z separate-code by default for x86 to avoid mixing code pages with data to improve cache performance as well as security. To reduce x86-64 executable and shared object sizes, the maximum page size is reduced from 2MB to 4KB. But x86-64 kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to linker to force 2MB page size regardless of the default page size used by linker. Tested with Linux kernel 4.15.6 on x86-64. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Eric Biederman <ebiederm@xmission.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Juergen Gross <jgross@suse.com> Cc: Kees Cook <keescook@chromium.org> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/CAMe9rOp4_%3D_8twdpTyAP2DhONOCeaTOsniJLoppzhoNptL8xzA@mail.gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>