linux/arch/loongarch/kernel
Thomas Weißschuh 134475a9ab LoongArch: Don't crash in stack_top() for tasks without vDSO
Not all tasks have a vDSO mapped, for example kthreads never do. If such
a task ever ends up calling stack_top(), it will derefence the NULL vdso
pointer and crash.

This can for example happen when using kunit:

	[<9000000000203874>] stack_top+0x58/0xa8
	[<90000000002956cc>] arch_pick_mmap_layout+0x164/0x220
	[<90000000003c284c>] kunit_vm_mmap_init+0x108/0x12c
	[<90000000003c1fbc>] __kunit_add_resource+0x38/0x8c
	[<90000000003c2704>] kunit_vm_mmap+0x88/0xc8
	[<9000000000410b14>] usercopy_test_init+0xbc/0x25c
	[<90000000003c1db4>] kunit_try_run_case+0x5c/0x184
	[<90000000003c3d54>] kunit_generic_run_threadfn_adapter+0x24/0x48
	[<900000000022e4bc>] kthread+0xc8/0xd4
	[<9000000000200ce8>] ret_from_kernel_thread+0xc/0xa4

Fixes: 803b0fc5c3 ("LoongArch: Add process management")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2024-10-21 22:11:19 +08:00
..
.gitignore LoongArch: Add build infrastructure 2022-06-03 20:09:27 +08:00
access-helper.h LoongArch: Add exception/interrupt handling 2022-06-03 20:09:28 +08:00
acpi.c LoongArch: Enable ACPI BGRT handling 2024-09-24 15:32:06 +08:00
alternative.c LoongArch: Use common function sign_extend64() 2023-01-17 11:42:16 +08:00
asm-offsets.c arch: fix asm-offsets.c building with -Wmissing-prototypes 2023-11-23 11:32:31 +01:00
cacheinfo.c LoongArch: Refactor cache probe and flush methods 2022-10-12 16:36:14 +08:00
cpu-probe.c LoongArch: Rework CPU feature probe from CPUCFG/IOCSR 2024-09-24 15:32:20 +08:00
crash_dump.c LoongArch: Add kdump support 2022-10-12 16:36:19 +08:00
dma.c dma-mapping: Add helpers for dma_range_map bounds 2024-04-26 12:07:24 +02:00
efi-header.S LoongArch: Calculate various sizes in the linker script 2023-06-29 20:58:42 +08:00
efi.c LoongArch: Enable general EFI poweroff method 2024-08-07 17:37:11 +08:00
elf.c LoongArch: Fix and simplify fcsr initialization on execve() 2024-01-17 12:43:08 +08:00
entry.S LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
env.c LoongArch: Parsing CPU-related information from DTS 2024-01-17 12:43:08 +08:00
fpu.S LoongArch: Add ifdefs to fix LSX and LASX related warnings 2024-08-26 23:11:32 +08:00
ftrace_dyn.c kprobe/ftrace: bail out if ftrace was killed 2024-05-16 07:23:30 +09:00
ftrace.c LoongArch/ftrace: Add basic support 2022-12-14 08:41:53 +08:00
genex.S LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
head.S LoongArch: Add writecombine support for DMW-based ioremap() 2024-07-20 22:40:59 +08:00
hw_breakpoint.c LoongArch: Check TIF_LOAD_WATCH to enable user space watchpoint 2024-07-20 22:41:07 +08:00
idle.c arch/idle: Change arch_cpu_idle() behavior: always exit with IRQs disabled 2023-01-13 11:48:15 +01:00
image-vars.h efi/loongarch: Directly position the loaded image file 2023-12-19 11:16:37 +01:00
inst.c LoongArch: Add larch_insn_gen_break() to generate break insns 2023-06-29 20:58:44 +08:00
io.c LoongArch: Add misc common routines 2022-06-03 20:09:28 +08:00
irq.c Merge tag 'irq-core-2024-09-16' into loongarch-next 2024-09-17 22:20:12 +08:00
jump_label.c LoongArch: Add jump-label implementation 2023-06-29 20:58:44 +08:00
kfpu.c LoongArch: Allow usage of LSX/LASX in the kernel 2023-09-06 22:53:55 +08:00
kgdb.c LoongArch: Add basic KGDB & KDB support 2023-09-06 22:53:55 +08:00
kprobes.c LoongArch: Make the users of larch_insn_gen_break() constant 2024-07-20 22:41:07 +08:00
lbt.S LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
machine_kexec.c LoongArch: Give a chance to build with !CONFIG_SMP 2024-05-14 12:24:18 +08:00
Makefile LoongArch: KVM: Add PV IPI support on guest side 2024-05-06 22:00:47 +08:00
Makefile.syscalls syscalls: fix syscall macros for newfstat/newfstatat 2024-08-02 15:20:47 +02:00
mcount_dyn.S LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
mcount.S LoongArch: Replace #include <asm/export.h> with #include <linux/export.h> 2023-08-25 23:40:26 +08:00
mem.c LoongArch: Set all reserved memblocks on Node#0 at initialization 2023-09-20 14:26:29 +08:00
module-sections.c LoongArch: Fix some build warnings with W=1 2023-09-20 14:26:28 +08:00
module.c arch: make execmem setup available regardless of CONFIG_MODULES 2024-05-14 00:31:44 -07:00
numa.c arch, mm: pull out allocation of NODE_DATA to generic code 2024-09-03 21:15:28 -07:00
paravirt.c Updates for the interrupt subsystem: 2024-09-17 07:09:17 +02:00
perf_event.c LoongArch/smp: Refine some ipi functions on LoongArch platform 2024-05-06 22:00:46 +08:00
perf_regs.c LoongArch: Add perf events support 2022-10-12 16:36:14 +08:00
proc.c LoongArch: Rework CPU feature probe from CPUCFG/IOCSR 2024-09-24 15:32:20 +08:00
process.c LoongArch: Don't crash in stack_top() for tasks without vDSO 2024-10-21 22:11:19 +08:00
ptrace.c LoongArch: Check TIF_LOAD_WATCH to enable user space watchpoint 2024-07-20 22:41:07 +08:00
relocate_kernel.S LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
relocate.c LoongArch: Add support for relocating the kernel with RELR relocation 2024-07-20 22:41:07 +08:00
reset.c LoongArch: Add hibernation (ACPI S4) support 2022-12-14 08:41:53 +08:00
rethook_trampoline.S LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
rethook.c LoongArch: Replace kretprobe with rethook 2023-06-29 20:58:44 +08:00
rethook.h LoongArch: Replace kretprobe with rethook 2023-06-29 20:58:44 +08:00
setup.c LoongArch: Get correct cores_per_package for SMT systems 2024-10-21 22:11:18 +08:00
signal.c LoongArch: signal.c: add header file to fix build error 2023-12-27 11:49:56 -05:00
smp.c Updates for the interrupt subsystem: 2024-09-17 07:09:17 +02:00
stacktrace.c LoongArch: Add kernel livepatching support 2024-03-11 22:23:47 +08:00
switch.S LoongArch: Add basic STACKPROTECTOR support 2022-12-14 08:41:53 +08:00
syscall.c LoongArch: Remove STACK_FRAME_NON_STANDARD(do_syscall) 2024-09-17 22:23:10 +08:00
sysrq.c tty: sysrq: switch sysrq handlers from int to u8 2023-07-25 19:21:03 +02:00
time.c LoongArch: KVM: Add PV steal time support in guest side 2024-07-09 16:25:51 +08:00
topology.c LoongArch: convert to use arch_cpu_is_hotpluggable() 2023-12-06 12:41:50 +09:00
traps.c LoongArch: Enable IRQ if do_ale() triggered in irq-enabled context 2024-10-21 22:11:19 +08:00
unaligned.c LoongArch: Delete unnecessary debugfs checking 2023-06-29 20:58:42 +08:00
unwind_guess.c LoongArch: Strip guess unwinder out from prologue unwinder 2023-01-17 11:42:16 +08:00
unwind_orc.c LoongArch: Add ORC stack unwinder support 2024-03-11 22:23:47 +08:00
unwind_prologue.c LoongArch: Set unwind stack type to unknown rather than set error flag 2023-12-09 15:49:15 +08:00
unwind.c LoongArch: Set unwind stack type to unknown rather than set error flag 2023-12-09 15:49:15 +08:00
uprobes.c LoongArch: Add uprobes support 2023-06-29 20:58:44 +08:00
vdso.c LoongArch: Set correct size for vDSO code mapping 2024-10-21 22:11:19 +08:00
vmlinux.lds.S LoongArch: Add support for relocating the kernel with RELR relocation 2024-07-20 22:41:07 +08:00