• Daniel Kiper's avatar
    x86/boot: Introduce kernel_info · 2c33c27f
    Daniel Kiper authored
    The relationships between the headers are analogous to the various data
    sections:
    
      setup_header = .data
      boot_params/setup_data = .bss
    
    What is missing from the above list? That's right:
    
      kernel_info = .rodata
    
    We have been (ab)using .data for things that could go into .rodata or .bss for
    a long time, for lack of alternatives and -- especially early on -- inertia.
    Also, the BIOS stub is responsible for creating boot_params, so it isn't
    available to a BIOS-based loader (setup_data is, though).
    
    setup_header is permanently limited to 144 bytes due to the reach of the
    2-byte jump field, which doubles as a length field for the structure, combined
    with the size of the "hole" in struct boot_params that a protected-mode loader
    or the BIOS stub has to copy it into. It is currently 119 bytes long, which
    leaves us with 25 very precious bytes. This isn't something that can be fixed
    without revising the boot protocol entirely, breaking backwards compatibility.
    
    boot_params proper is limited to 4096 bytes, but can be arbitrarily extended
    by adding setup_data entries. It cannot be used to communicate properties of
    the kernel image, because it is .bss and has no image-provided content.
    
    kernel_info solves this by providing an extensible place for information about
    the kernel image. It is readonly, because the kernel cannot rely on a
    bootloader copying its contents anywhere, but that is OK; if it becomes
    necessary it can still contain data items that an enabled bootloader would be
    expected to copy into a setup_data chunk.
    
    Do not bump setup_header version in arch/x86/boot/header.S because it
    will be followed by additional changes coming into the Linux/x86 boot
    protocol.
    Suggested-by: default avatarH. Peter Anvin (Intel) <hpa@zytor.com>
    Signed-off-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Reviewed-by: default avatarRoss Philipson <ross.philipson@oracle.com>
    Reviewed-by: default avatarH. Peter Anvin (Intel) <hpa@zytor.com>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: ard.biesheuvel@linaro.org
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: dave.hansen@linux.intel.com
    Cc: eric.snowberg@oracle.com
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: kanth.ghatraju@oracle.com
    Cc: linux-doc@vger.kernel.org
    Cc: linux-efi <linux-efi@vger.kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: rdunlap@infradead.org
    Cc: ross.philipson@oracle.com
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: x86-ml <x86@kernel.org>
    Cc: xen-devel@lists.xenproject.org
    Link: https://lkml.kernel.org/r/20191112134640.16035-2-daniel.kiper@oracle.com
    2c33c27f
Makefile 5.25 KB