kernel_optimize_test/arch/mips
Alexander Lobakin c8c2b27ab3 MIPS: relocatable: fix possible boot hangup with KASLR enabled
commit 69e976831cd53f9ba304fd20305b2025ecc78eab 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:27:20 +01:00
..
alchemy MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu 2020-11-17 12:53:57 +01:00
ar7
ath25
ath79
bcm47xx MIPS: BCM47XX: fix kconfig dependency bug for BCM47XX_BCMA 2020-12-30 11:53:09 +01:00
bcm63xx
bmips
boot MIPS: boot: Fix unaligned access with CONFIG_MIPS_RAW_APPENDED_DTB 2021-01-19 18:27:20 +01:00
cavium-octeon MIPS updates for v5.10: 2020-10-16 12:40:55 -07:00
cobalt
configs
crypto
dec MIPS: DEC: Restore bootmem reservation for firmware working memory area 2020-10-14 23:57:57 +02:00
fw
generic
include local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
ingenic
jazz
kernel MIPS: relocatable: fix possible boot hangup with KASLR enabled 2021-01-19 18:27:20 +01:00
kvm
lantiq
lib mips: lib: uncached: fix non-standard usage of variable 'sp' 2021-01-19 18:27:20 +01:00
loongson2ef MIPS updates for v5.10: 2020-10-16 12:40:55 -07:00
loongson32
loongson64 MIPS updates for v5.10: 2020-10-16 12:40:55 -07:00
math-emu
mm mips: fix Section mismatch in reference 2021-01-19 18:27:20 +01:00
mti-malta
net
netlogic MIPS updates for v5.10: 2020-10-16 12:40:55 -07:00
oprofile
pci MIPS updates for v5.10: 2020-10-16 12:40:55 -07:00
pic32
pistachio
power
ralink
rb532
sgi-ip22
sgi-ip27
sgi-ip30
sgi-ip32 MIPS updates for v5.10: 2020-10-16 12:40:55 -07:00
sibyte
sni
tools
txx9
vdso
vr41xx
Kbuild
Kbuild.platforms
Kconfig Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-22 09:59:21 -07:00
Kconfig.debug
Makefile
Makefile.postlink