• Matt Redfearn's avatar
    MIPS: Kernel: Implement KASLR using CONFIG_RELOCATABLE · 405bc8fd
    Matt Redfearn authored
    This patch adds KASLR to the MIPS kernel.
    
    Entropy is derived from the banner, which will change every build and
    random_get_entropy() which should provide additional runtime entropy.
    Additionally the bootloader may pass entropy via the /chosen/kaslr-seed
    node in device tree.
    
    The kernel is relocated by up to RANDOMIZE_BASE_MAX_OFFSET bytes from
    its link address (PHYSICAL_START). Because relocation happens so early
    in the kernel boot, the amount of physical memory has not yet been
    determined. This means the only way to limit relocation within the
    available memory is via Kconfig.
    Signed-off-by: default avatarMatt Redfearn <matt.redfearn@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Cc: kernel-hardening@lists.openwall.com
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/12990/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    405bc8fd
relocate.c 9.12 KB