mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 10:11:38 -04:00
After commit 4cd641a79e ("LoongArch: Remove unnecessary checks for ORC
unwinder"), the system can not boot normally under some configs (such as
enable KASAN), there are many error messages "cannot find unwind pc".
The kernel boots normally with the defconfig, so no problem found out at
the first time. Here is one way to reproduce:
cd linux
make mrproper defconfig -j"$(nproc)"
scripts/config -e KASAN
make olddefconfig all -j"$(nproc)"
sudo make modules_install
sudo make install
sudo reboot
The address that can not unwind is not a valid kernel address which is
between "pcpu_handlers[cpu]" and "pcpu_handlers[cpu] + vec_sz" due to
the code of eentry was copied to the new area of pcpu_handlers[cpu] in
setup_tlb_handler(), handle this special case to get the valid address
to unwind normally.
Cc: stable@vger.kernel.org
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
|
|
*/
|
|
|
|
#ifndef _LOONGARCH_SETUP_H
|
|
#define _LOONGARCH_SETUP_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/threads.h>
|
|
#include <asm/sections.h>
|
|
#include <uapi/asm/setup.h>
|
|
|
|
#define VECSIZE 0x200
|
|
|
|
extern unsigned long eentry;
|
|
extern unsigned long tlbrentry;
|
|
extern unsigned long pcpu_handlers[NR_CPUS];
|
|
extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
|
|
extern char init_command_line[COMMAND_LINE_SIZE];
|
|
extern void tlb_init(int cpu);
|
|
extern void cpu_cache_init(void);
|
|
extern void cache_error_setup(void);
|
|
extern void per_cpu_trap_init(int cpu);
|
|
extern void set_handler(unsigned long offset, void *addr, unsigned long len);
|
|
extern void set_merr_handler(unsigned long offset, void *addr, unsigned long len);
|
|
|
|
#ifdef CONFIG_RELOCATABLE
|
|
|
|
struct rela_la_abs {
|
|
long pc;
|
|
long symvalue;
|
|
};
|
|
|
|
extern long __la_abs_begin;
|
|
extern long __la_abs_end;
|
|
extern long __rela_dyn_begin;
|
|
extern long __rela_dyn_end;
|
|
|
|
#ifdef CONFIG_RELR
|
|
extern long __relr_dyn_begin;
|
|
extern long __relr_dyn_end;
|
|
#endif
|
|
|
|
extern unsigned long __init relocate_kernel(void);
|
|
|
|
#endif
|
|
|
|
static inline unsigned long kaslr_offset(void)
|
|
{
|
|
return (unsigned long)&_text - VMLINUX_LOAD_ADDRESS;
|
|
}
|
|
|
|
#endif /* __SETUP_H */
|