linux-stable/arch/mips/kernel
Thomas Bogendoerfer bd67b711bf MIPS: kernel: Reserve exception base early to prevent corruption
BMIPS is one of the few platforms that do change the exception base.
After commit 2dcb396454 ("memblock: do not start bottom-up allocations
with kernel_end") we started seeing BMIPS boards fail to boot with the
built-in FDT being corrupted.

Before the cited commit, early allocations would be in the [kernel_end,
RAM_END] range, but after commit they would be within [RAM_START +
PAGE_SIZE, RAM_END].

The custom exception base handler that is installed by
bmips_ebase_setup() done for BMIPS5000 CPUs ends-up trampling on the
memory region allocated by unflatten_and_copy_device_tree() thus
corrupting the FDT used by the kernel.

To fix this, we need to perform an early reservation of the custom
exception space. Additional we reserve the first 4k (1k for R3k) for
either normal exception vector space (legacy CPUs) or special vectors
like cache exceptions.

Huge thanks to Serge for analysing and proposing a solution to this
issue.

Fixes: 2dcb396454 ("memblock: do not start bottom-up allocations with kernel_end")
Reported-by: Kamal Dasu <kdasu.kdev@gmail.com>
Debugged-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
2021-03-09 11:22:59 +01:00
..
syscalls Kbuild updates for v5.12 2021-02-25 10:17:31 -08:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01: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
bmips_5xxx_init.S MIPS: BCM5xxx: Remove dead init_fpu code 2018-11-08 11:20:57 -08:00
bmips_vec.S
branch.c MIPS: kernel: include probes-common.h header in branch.c 2020-09-21 22:14:24 +02:00
cacheinfo.c mips: cacheinfo: Remove unnecessary increment of level 2021-01-27 21:48:23 +01:00
cevt-bcm1480.c MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
cevt-ds1287.c MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
cevt-gt641xx.c MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
cevt-r4k.c mips: cevt-r4k: Update the r4k-clockevent frequency in sync with CPU 2020-05-22 09:14:32 +02:00
cevt-sb1250.c MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
cevt-txx9.c mips: kernel: convert comma to semicolon 2020-12-28 22:32:28 +01:00
cmpxchg.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cps-vec-ns16550.S mips: Add CPS_NS16550_WIDTH config 2020-05-22 09:12:52 +02:00
cps-vec.S MIPS: CPS: don't create redundant .text.cps-vec section 2021-01-15 15:27:54 +01:00
cpu-probe.c MIPS: kernel: Reserve exception base early to prevent corruption 2021-03-09 11:22:59 +01:00
cpu-r3k-probe.c MIPS: kernel: Reserve exception base early to prevent corruption 2021-03-09 11:22:59 +01:00
crash.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
crash_dump.c MIPS: crash_dump.c: Simplify copy_oldmem_page() 2021-02-09 13:30:12 +01: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 mips: csrc-r4k: Mark R4K timer as unstable if CPU freq changes 2020-05-22 09:14:06 +02: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: Add MIPS Release 5 support 2020-05-22 09:09:01 +02:00
fpu-probe.c MIPS: cpu-probe: move fpu probing/handling into its own file 2020-10-12 12:04:50 +02:00
fpu-probe.h MIPS: cpu-probe: move fpu probing/handling into its own file 2020-10-12 12:04:50 +02:00
ftrace.c Revert "MIPS: kernel: {ftrace,kgdb}: Set correct address limit for cache flushes" 2021-02-13 09:53:08 +01:00
genex.S MIPS: Make check condition for SDBBP consistent with EJTAG spec 2021-02-11 11:04:31 +01:00
gpio_txx9.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
head.S MIPS: of: Introduce helper function to get DTB 2021-02-04 13:34:51 +01:00
i8253.c MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01:00
idle.c Revert "MIPS: Remove unused R4300 CPU support" 2021-01-22 11:39:45 +01: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.c MIPS: irq: Allocate accurate order pages for irq stack 2019-02-19 12:45:01 -08:00
irq_txx9.c
jump_label.c MIPS: jump_label: Use compact branches for >= r6 2019-04-09 16:21:30 -07:00
kgdb.c MIPS: kernel: Drop kgdb_call_nmi_hook 2021-02-15 12:23:54 +01:00
kprobes.c mips: kprobes: Use generic kretprobe trampoline handler 2020-09-08 11:52:33 +02: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
Makefile - added support for Nintendo N64 2021-02-21 13:18:26 -08:00
mcount.S mips: ftrace: fix static function graph tracing 2018-06-19 15:00:12 -07:00
mips-cm.c mips: cm: add missing iounmap() on error in mips_cm_probe() 2020-11-06 11:33:11 +01:00
mips-cpc.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
mips-mt-fpaff.c MIPS: Use rcu to lookup a task in mipsmt_sys_sched_setaffinity() 2020-09-03 10:13:43 +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: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00
module.c MIPS: module: optimize module relocations processing 2021-01-18 15:55:16 +01: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 MIPS: perf: Add support for OCTEON III perf events. 2021-01-04 11:32:57 +01:00
perf_regs.c MIPS: kernel: Support extracting off-line stack traces from user-space with perf 2021-02-04 21:55:45 +01:00
pm-cps.c MIPS: barrier: Add __SYNC() infrastructure 2019-10-07 09:42:17 -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: Add MIPS Release 5 support 2020-05-22 09:09:01 +02:00
process.c arch: setup PF_IO_WORKER threads like PF_KTHREAD 2021-02-21 17:25:22 -07:00
prom.c MIPS: replace add_memory_region with memblock 2020-10-12 12:01:36 +02:00
ptrace.c Revert "MIPS: Add basic support for ptrace single step" 2021-02-18 11:57:44 +01:00
ptrace32.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
r4k-bugs64.c arch: mips: update references to current linux-mips list 2021-02-23 13:24:38 +01:00
r4k_fpu.S mips: Add MIPS Release 5 support 2020-05-22 09:09:01 +02: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 - added support for Nintendo N64 2021-02-21 13:18:26 -08: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
rtlx-mt.c MIPS: Replace setup_irq() by request_irq() 2020-03-05 16:47:35 +01: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 compat: switch to compat_binfmt_elf.c 2021-01-06 08:42:49 -05:00
scall64-o32.S MIPS: asm: Rename some macros to avoid build errors 2020-05-07 13:20:05 +02: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: Use common way to parse elfcorehdr 2021-02-13 09:57:22 +01:00
signal-common.h
signal.c Revert "MIPS: Add basic support for ptrace single step" 2021-02-18 11:57:44 +01: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: No need to check CPU 0 in {loongson3,bmips,octeon}_cpu_disable() 2020-11-27 10:38:12 +01:00
smp-cmp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 182 2019-05-30 11:29:20 -07:00
smp-cps.c MIPS: No need to check CPU 0 in cps_cpu_disable() 2020-12-28 22:34:09 +01:00
smp-mt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 182 2019-05-30 11:29:20 -07:00
smp-up.c
smp.c arch: mips: kernel: Fix two spelling in smp.c 2021-02-03 11:33:48 +01: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 mips: Add CONFIG/CONFIG6/Cause reg fields macro 2020-05-22 09:12:22 +02:00
stacktrace.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
sync-r4k.c MIPS: sync-r4k: do slave counter synchronization with disabled HW interrupts 2020-01-22 10:16:18 -08:00
syscall.c MIPS: Convert R10000_LLSC_WAR info a config option 2020-09-07 22:24:27 +02:00
sysrq.c MIPS: constify sysrq_key_op 2020-05-15 14:53:19 +02:00
time.c mips: Add udelay lpj numbers adjustment 2020-05-22 09:13:32 +02:00
topology.c MIPS: CPU#0 is not hotpluggable 2020-07-26 10:18:35 +02:00
traps.c MIPS: kernel: Reserve exception base early to prevent corruption 2021-03-09 11:22:59 +01:00
unaligned.c uaccess: add force_uaccess_{begin,end} helpers 2020-08-12 10:57:59 -07:00
uprobes.c MIPS: uprobes: remove set but not used variable 'epc' 2019-05-29 13:20:30 -07:00
vdso.c MIPS: vdso: Use vma page protection for remapping 2020-11-19 13:26:38 +01:00
vmlinux.lds.S MIPS: vmlinux.lds.S: align raw appended dtb to 8 bytes 2021-03-08 18:36:08 +01:00
vpe-cmp.c mips: pci: convert comma to semicolon 2020-12-28 22:33:43 +01:00
vpe-mt.c mips: kernel: convert comma to semicolon 2020-12-28 22:32:28 +01:00
vpe.c MIPS: vpe: Remove vpe_getcwd 2021-01-27 21:49:16 +01:00
watch.c MIPS: Use fallthrough for arch/mips 2020-05-07 11:55:47 +02:00