1
0
Fork 0
alistair23-linux/arch/mips/kernel
Alexander Lobakin f7a97dc302 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:26:12 +01:00
..
syscalls MIPS: syscalls: fix indentation of the 'SYSNR' message 2020-02-11 04:35:16 -08:00
.gitignore
8250-platform.c
Makefile mips: rename scall64-64.S to scall64-n64.S 2018-12-14 11:19:01 -08:00
asm-offsets.c MIPS: Remove struct task_struct fpu state when CONFIG_MIPS_FP_SUPPORT=n 2018-11-09 10:23:19 -08:00
binfmt_elfn32.c y2038: globally rename compat_time to old_time32 2018-08-27 14:48:48 +02:00
binfmt_elfo32.c y2038: globally rename compat_time to old_time32 2018-08-27 14:48:48 +02:00
bmips_5xxx_init.S MIPS: BCM5xxx: Remove dead init_fpu code 2018-11-08 11:20:57 -08:00
bmips_vec.S MIPS: BMIPS: Add Whirlwind (BMIPS5200) initialization code 2016-05-09 12:00:01 +02:00
branch.c MIPS: Don't use bc_false uninitialized in __mm_isBranchInstr 2019-08-11 21:44:24 -07:00
cacheinfo.c mips: cacheinfo: report shared CPU map 2020-01-17 19:49:04 +01:00
cevt-bcm1480.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
cevt-ds1287.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
cevt-gt641xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
cevt-r4k.c MIPS: cevt-r4k: Fix out-of-bounds array access 2017-04-10 13:31:12 +02:00
cevt-sb1250.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
cevt-txx9.c MIPS: clockevent drivers: Set ->min_delta_ticks and ->max_delta_ticks 2017-04-14 13:11:16 -07:00
cmpxchg.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cps-vec-ns16550.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cps-vec.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cpu-bugs64.c MIPS: cpu-bugs64: Mark inline functions as __always_inline 2019-10-01 12:59:59 -07:00
cpu-probe.c MIPS: elf_hwcap: Export userspace ASEs 2019-10-10 11:57:36 -07:00
crash.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
crash_dump.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
csrc-bcm1480.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
csrc-ioasic.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
csrc-r4k.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
csrc-sb1250.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
early_printk.c mips: unify prom_putchar() declarations 2018-07-17 09:40:17 -07:00
early_printk_8250.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
elf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
entry.S MIPS: entry: Remove unneeded need_resched() loop 2019-03-19 15:25:45 -07:00
ftrace.c MIPS: ftrace: Reword prepare_ftrace_return() comment block 2019-06-11 15:46:21 -07:00
genex.S MIPS: Fix IRQ tracing when call handle_fpe() and handle_msa_fpe() 2020-06-22 09:31:09 +02:00
gpio_txx9.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
head.S MIPS/head: Store ELF appended dtb in a global variable too 2018-09-25 16:27:24 -07:00
i8253.c MIPS: kernel: only use i8253 clocksource with periodic clockevent 2019-07-18 14:41:04 -07:00
idle.c MIPS: Remove unused R4300 CPU support 2019-07-23 14:33:23 -07:00
irq-gt641xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
irq-msc01.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
irq-rm7000.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
irq.c MIPS: irq: Allocate accurate order pages for irq stack 2019-02-19 12:45:01 -08:00
irq_txx9.c MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
jump_label.c MIPS: jump_label: Use compact branches for >= r6 2019-04-09 16:21:30 -07:00
kgdb.c MIPS: KGDB: fix kgdb support for SMP platforms. 2019-03-28 11:35:58 -07:00
kprobes.c mm, kprobes: generalize and rename notify_page_fault() as kprobe_page_fault() 2019-07-16 19:23:22 -07:00
linux32.c MIPS: Delete unused code in linux32.c 2018-08-01 13:20:27 -07:00
machine_kexec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 230 2019-06-19 17:09:06 +02:00
mcount.S mips: ftrace: fix static function graph tracing 2018-06-19 15:00:12 -07:00
mips-cm.c mips: cm: Fix an invalid error code of INTVN_*_ERR 2020-06-22 09:31:03 +02:00
mips-cpc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
mips-mt-fpaff.c sched/core: Provide a pointer to the valid CPU mask 2019-06-03 11:49:37 +02:00
mips-mt.c MIPS: MT: Remove norps command line parameter 2018-11-26 22:49:14 -08:00
mips-r2-to-r6-emul.c mips: kernel: no need to check return value of debugfs_create functions 2019-01-22 11:17:20 -08:00
mips_machine.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
module.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
octeon_switch.S Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
perf_event.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
perf_event_mipsxx.c The main MIPS changes for a pretty light v5.3 cycle, including: 2019-07-17 09:42:03 -07:00
pm-cps.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pm.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
probes-common.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
proc.c MIPS: Treat Loongson Extensions as ASEs 2019-08-26 11:42:40 +01:00
process.c MIPS: Remove function size check in get_frame_info() 2019-02-04 15:15:34 -08:00
prom.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ptrace.c audit/stable-5.2 PR 20190507 2019-05-07 19:06:04 -07:00
ptrace32.c MIPS: ptrace: Remove FP support when CONFIG_MIPS_FP_SUPPORT=n 2018-11-09 10:23:17 -08:00
r4k_fpu.S MIPS: Simplify FP context initialization 2018-11-09 10:23:13 -08:00
r4k_switch.S Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
r2300_fpu.S MIPS: Simplify FP context initialization 2018-11-09 10:23:13 -08:00
r2300_switch.S Kbuild: rename CC_STACKPROTECTOR[_STRONG] config variables 2018-06-14 12:21:18 +09:00
relocate.c MIPS: relocatable: fix possible boot hangup with KASLR enabled 2021-01-19 18:26:12 +01:00
relocate_kernel.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 230 2019-06-19 17:09:06 +02:00
reset.c MIPS: Hang more efficiently on halt/powerdown/restart 2018-03-09 11:22:43 +00:00
rtlx-cmp.c MIPS: APRP: Fix an issue when device_create() fails. 2014-08-01 17:30:35 +02:00
rtlx-mt.c MIPS: APRP: Fix an issue when device_create() fails. 2014-08-01 17:30:35 +02:00
rtlx.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
scall32-o32.S mips: remove nargs from __SYSCALL 2019-07-30 10:50:30 -07:00
scall64-n32.S mips: remove nargs from __SYSCALL 2019-07-30 10:50:30 -07:00
scall64-n64.S mips: remove nargs from __SYSCALL 2019-07-30 10:50:30 -07:00
scall64-o32.S mips: remove nargs from __SYSCALL 2019-07-30 10:50:30 -07:00
segment.c mips: kernel: no need to check return value of debugfs_create functions 2019-01-22 11:17:20 -08:00
setup.c MIPS: Don't round up kernel sections size for memblock_add() 2020-12-30 11:51:18 +01:00
signal-common.h MIPS: Save MSA extended context around signals 2015-09-03 12:07:59 +02:00
signal.c signal: Remove task parameter from force_sig 2019-05-27 09:36:28 -05:00
signal32.c Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
signal_n32.c Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2019-07-08 21:48:15 -07:00
signal_o32.c signal: Remove task parameter from force_sig 2019-05-27 09:36:28 -05:00
smp-bmips.c MIPS: BMIPS: Also call bmips_cpu_setup() for secondary cores 2020-09-09 19:12:24 +02:00
smp-cmp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 182 2019-05-30 11:29:20 -07:00
smp-cps.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
smp-mt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 182 2019-05-30 11:29:20 -07:00
smp-up.c MIPS: SMP: Allow boot_secondary SMP op to return errors 2017-08-30 00:57:27 +02:00
smp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
spinlock_test.c mips: kernel: no need to check return value of debugfs_create functions 2019-01-22 11:17:20 -08:00
spram.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
stacktrace.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
sync-r4k.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscall.c MIPS: Wire up clone3 syscall 2019-10-02 14:06:41 -07:00
sysrq.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
time.c mips: Add udelay lpj numbers adjustment 2020-06-22 09:31:07 +02:00
topology.c MIPS: CPU#0 is not hotpluggable 2020-08-21 13:05:26 +02:00
traps.c MIPS: add missing MSACSR and upper MSA initialization 2020-09-09 19:12:28 +02:00
unaligned.c signal: Remove task parameter from force_sig 2019-05-27 09:36:28 -05:00
uprobes.c MIPS: uprobes: remove set but not used variable 'epc' 2019-05-29 13:20:30 -07:00
vdso.c mips: Add support for generic vDSO 2019-07-25 21:45:05 -07:00
vmlinux.lds.S MIPS: Truncate link address into 32bit for 32bit kernel 2020-06-22 09:31:03 +02:00
vpe-cmp.c MIPS: APRP: Add VPE loader support for CMP platforms. 2014-01-22 20:19:02 +01:00
vpe-mt.c MIPS: MT: Remove SMTC support 2014-05-24 00:07:01 +02:00
vpe.c MIPS: VPE: Fix a double free and a memory leak in 'release_vpe()' 2020-03-05 16:43:45 +01:00
watch.c mips: annotate implicit fall throughs 2018-12-03 13:42:38 -08:00