]> git.baikalelectronics.ru Git - kernel.git/commit
x86/boot/compressed/64: Remove .bss/.pgtable from bzImage
authorArvind Sankar <nivedita@alum.mit.edu>
Thu, 9 Jan 2020 15:02:17 +0000 (10:02 -0500)
committerBorislav Petkov <bp@suse.de>
Wed, 19 Feb 2020 16:28:57 +0000 (17:28 +0100)
commit006578edf94d3d01e44673105bec693f84c5e902
tree77833933e077a371650a1becb8fe62e0acfd8688
parent619dfe4a82e0f9cfae3ee295fe35ff0ecbd9c1ef
x86/boot/compressed/64: Remove .bss/.pgtable from bzImage

Commit

  5f46ff8535ee ("x86, boot: straighten out ranges to copy/zero in
  compressed/head*.S")

introduced a separate .pgtable section, splitting it out from the rest
of .bss. This section was added without the writeable flag, marking it
as read-only. This results in the linker putting the .rela.dyn section
(containing bogus dynamic relocations from head_64.o) after the .bss and
.pgtable sections.

When objcopy is used to convert compressed/vmlinux into a binary for
the bzImage:

$ objcopy  -O binary -R .note -R .comment -S arch/x86/boot/compressed/vmlinux \
arch/x86/boot/vmlinux.bin

the .bss and .pgtable sections get materialized as ~176KiB of zero
bytes in the binary in order to place .rela.dyn at the correct location.

Fix this by marking .pgtable as writeable. This moves the .rela.dyn
section up in the ELF image layout so that .bss and .pgtable are the
last allocated sections and so don't appear in bzImage.

 [ bp: Massage commit message. ]

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Kees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/20200109150218.16544-1-nivedita@alum.mit.edu
arch/x86/boot/compressed/head_64.S