linux/arch/mips
Alexander Lobakin 0e488a1781 MIPS: relocatable: fix possible boot hangup with KASLR enabled
commit 69e976831c upstream.

LLVM-built Linux triggered a boot hangup with KASLR enabled.

arch/mips/kernel/relocate.c:get_random_boot() uses linux_banner,
which is a string constant, as a random seed, but accesses it
as an array of unsigned long (in rotate_xor()).
When the address of linux_banner is not aligned to sizeof(long),
such access emits unaligned access exception and hangs the kernel.

Use PTR_ALIGN() to align input address to sizeof(long) and also
align down the input length to prevent possible access-beyond-end.

Fixes: 405bc8fd12 ("MIPS: Kernel: Implement KASLR using CONFIG_RELOCATABLE")
Cc: stable@vger.kernel.org # 4.7+
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-19 18:22:35 +01:00
..
alchemy MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu 2020-11-24 13:27:22 +01:00
ar7
ath25
ath79
bcm47xx MIPS: BCM47XX: fix kconfig dependency bug for BCM47XX_BCMA 2020-12-30 11:25:53 +01:00
bcm63xx MIPS: BCM63XX: drop unused and broken DSP platform device 2020-01-27 14:50:10 +01:00
bmips
boot MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB 2021-01-19 18:22:35 +01:00
cavium-octeon MIPS: OCTEON: add missing put_device() call in dwc3_octeon_device_init() 2020-08-19 08:14:58 +02:00
cobalt
configs scsi: sr: remove references to BLK_DEV_SR_VENDOR, leave it enabled 2020-07-22 09:32:04 +02:00
crypto
dec
emma
fw
generic
include MIPS: Add the missing 'CPU_1074K' into __get_cpu_type() 2020-10-01 13:14:53 +02:00
jazz
jz4740
kernel MIPS: relocatable: fix possible boot hangup with KASLR enabled 2021-01-19 18:22:35 +01:00
kvm KVM: MIPS: Change the definition of kvm type 2020-09-23 12:10:59 +02:00
lantiq
lasat
lib
loongson32
loongson64 MIPS: Loongson: Fix potential NULL dereference in loongson3_platform_init() 2020-02-24 08:34:37 +01:00
math-emu
mm MIPS: export has_transparent_hugepage() for modules 2020-11-24 13:27:21 +01:00
mti-malta
net bpf, mips: Limit to 33 tail calls 2020-01-12 12:17:12 +01:00
netlogic
oprofile
paravirt
pci
pic32
pistachio
pmcs-msp71xx
pnx833x
power
ralink
rb532
sgi-ip22
sgi-ip27
sgi-ip32
sibyte
sni MIPS: SNI: Fix spurious interrupts 2020-09-23 12:11:00 +02:00
tools
txx9
vdso mips/vdso: Fix resource leaks in genvdso.c 2020-09-03 11:24:21 +02:00
vr41xx
Kbuild
Kbuild.platforms
Kconfig MIPS: SNI: Fix MIPS_L1_CACHE_SHIFT 2020-09-23 12:11:00 +02:00
Kconfig.debug
Makefile MIPS: Truncate link address into 32bit for 32bit kernel 2020-06-22 09:05:15 +02:00
Makefile.postlink MIPS: fix indentation of the 'RELOCS' message 2020-02-11 04:33:58 -08:00