1
linux/arch/riscv/include/asm
Alexandre Ghiti cfb10de185
riscv: Fix kernel stack size when KASAN is enabled
We use Kconfig to select the kernel stack size, doubling the default
size if KASAN is enabled.

But that actually only works if KASAN is selected from the beginning,
meaning that if KASAN config is added later (for example using
menuconfig), CONFIG_THREAD_SIZE_ORDER won't be updated, keeping the
default size, which is not enough for KASAN as reported in [1].

So fix this by moving the logic to compute the right kernel stack into a
header.

Fixes: a7555f6b62 ("riscv: stack: Add config of thread stack size")
Reported-by: syzbot+ba9eac24453387a9d502@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/000000000000eb301906222aadc2@google.com/ [1]
Cc: stable@vger.kernel.org
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20240917150328.59831-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2024-10-01 13:08:11 -07:00
..
vdso riscv: Provide a definition for 'pause' 2024-07-12 03:16:39 -07:00
vendor_extensions riscv: Extend cpufeature.c to detect vendor extensions 2024-07-22 15:36:54 -07:00
acenv.h
acpi.h ACPI: RISCV: Make acpi_numa_get_nid() to be static 2024-09-17 12:02:48 -07:00
alternative-macros.h
alternative.h
arch_hweight.h riscv: lib: relax assembly constraints in hweight 2024-07-15 08:46:46 -07:00
archrandom.h
asm-extable.h
asm-offsets.h
asm-prototypes.h
asm.h
assembler.h
atomic.h Merge patch series "Rework & improve riscv cmpxchg.h and atomic.h" 2024-04-28 14:50:33 -07:00
barrier.h riscv: Add Zawrs support for spinlocks 2024-07-12 03:16:42 -07:00
bitops.h riscv: Enable bitops instrumentation 2024-09-19 01:10:04 -07:00
bug.h
cache.h riscv: mm: still create swiotlb buffer for kmalloc() bouncing if required 2024-04-30 10:35:45 -07:00
cacheflush.h riscv: Stop emitting preventive sfence.vma for new vmalloc mappings 2024-09-15 00:11:04 -07:00
cacheinfo.h
cfi.h
checksum.h
clint.h
clocksource.h
cmpxchg.h RISC-V Patches for the 6.11 Merge Window, Part 1 2024-07-20 09:11:27 -07:00
compat.h riscv: Introduce set_compat_task() in asm/compat.h 2024-03-19 16:39:40 -07:00
cpu_ops_sbi.h
cpu_ops.h
cpu.h
cpufeature.h riscv: cpufeature: Extract common elements from extension checking 2024-07-22 15:36:57 -07:00
cpuidle.h
crash_reserve.h
csr.h RISC-V: KVM: Add perf sampling support for guests 2024-04-26 13:13:50 +05:30
current.h
delay.h
dma-noncoherent.h
dmi.h riscv: dmi: Add SMBIOS/DMI support 2024-06-26 08:02:33 -07:00
efi.h
elf.h riscv: Introduce set_compat_task() in asm/compat.h 2024-03-19 16:39:40 -07:00
entry-common.h
errata_list.h RISC-V Patches for the 6.10 Merge Window, Part 1 2024-05-22 09:56:00 -07:00
exec.h riscv: Randomize lower bits of stack address 2024-09-17 08:05:10 -07:00
extable.h
fence.h riscv: Add license to fence.h 2024-09-03 07:18:33 -07:00
fixmap.h
fpu.h riscv: add support for kernel-mode FPU 2024-05-19 14:36:19 -07:00
ftrace.h function_graph: Everyone uses HAVE_FUNCTION_GRAPH_RET_ADDR_PTR, remove it 2024-06-11 11:18:24 -04:00
futex.h
gdb_xml.h
gpr-num.h
hugetlb.h mm: provide mm_struct and address to huge_ptep_get() 2024-07-12 15:52:15 -07:00
hwcap.h Merge patch series "Svvptc extension to remove preventive sfence.vma" 2024-09-15 20:58:24 -07:00
hwprobe.h RISC-V: hwprobe: Add MISALIGNED_PERF key 2024-08-14 13:13:23 -07:00
image.h
insn-def.h riscv: Add Zawrs support for spinlocks 2024-07-12 03:16:42 -07:00
insn.h RISC-V: fix vector insn load/store width mask 2024-06-25 08:47:10 -07:00
io.h riscv/barrier: Consolidate fence definitions 2024-03-19 18:52:24 -07:00
irq_stack.h
irq_work.h
irq.h RISC-V Patches for the 6.12 Merge Window, Part 1 2024-09-24 10:59:17 -07:00
irqflags.h riscv: Remove unnecessary irqflags processor.h include 2024-04-16 18:50:52 -07:00
jump_label.h riscv: jump_label: Simplify assembly syntax 2024-06-26 07:36:28 -07:00
kasan.h riscv: mm: Pre-allocate vmemmap/direct map/kasan PGD entries 2024-06-26 08:42:39 -07:00
Kbuild arch, mm: move definition of node_data to generic code 2024-09-03 21:15:28 -07:00
kdebug.h
kexec.h
kfence.h
kgdb.h
kprobes.h
kvm_aia.h
kvm_host.h ARM: 2024-07-20 12:41:03 -07:00
kvm_types.h
kvm_vcpu_fp.h
kvm_vcpu_insn.h
kvm_vcpu_pmu.h RISC-V: KVM: Fix to allow hpmcounter31 from the guest 2024-08-19 08:58:21 +05:30
kvm_vcpu_sbi.h
kvm_vcpu_timer.h
kvm_vcpu_vector.h
linkage.h
membarrier.h
mmio.h riscv/barrier: Consolidate fence definitions 2024-03-19 18:52:24 -07:00
mmiowb.h riscv/barrier: Consolidate fence definitions 2024-03-19 18:52:24 -07:00
mmu_context.h
mmu.h riscv: mm: Change attribute from __init to __meminit for page functions 2024-06-26 08:42:39 -07:00
module.h
module.lds.h
numa.h
page.h riscv: drop the use of XIP_OFFSET in kernel_mapping_va_to_pa() 2024-09-12 07:23:00 -07:00
paravirt_api_clock.h
paravirt.h
patch.h riscv: Pass patch_text() the length in bytes 2024-06-26 07:36:31 -07:00
pci.h
perf_event.h
pgalloc.h riscv: Use IPIs for remote cache/TLB flushes by default 2024-04-29 10:49:26 -07:00
pgtable-32.h
pgtable-64.h riscv: mm: Add support for ZONE_DEVICE 2024-06-26 08:42:46 -07:00
pgtable-bits.h riscv: mm: Add support for ZONE_DEVICE 2024-06-26 08:42:46 -07:00
pgtable.h Merge patch series "Svvptc extension to remove preventive sfence.vma" 2024-09-15 20:58:24 -07:00
probes.h
processor.h riscv: mm: Do not restrict mmap address based on hint 2024-08-29 06:03:29 -07:00
ptrace.h
sbi.h RISC-V Patches for the 6.12 Merge Window, Part 1 2024-09-24 10:59:17 -07:00
scs.h
seccomp.h
sections.h
semihost.h
set_memory.h riscv: remove limit on the size of read-only section for XIP kernel 2024-09-12 07:23:02 -07:00
signal32.h
simd.h riscv: vector: Fix a typo of preempt_v 2024-03-15 10:17:38 -07:00
smp.h riscv: Use IPIs for remote cache/TLB flushes by default 2024-04-29 10:49:26 -07:00
soc.h
sparsemem.h RISC-V: Don't have MAX_PHYSMEM_BITS exceed phys_addr_t 2024-09-20 01:32:39 -07:00
stackprotector.h
stacktrace.h
string.h riscv: Omit optimized string routines when using KASAN 2024-09-19 01:10:00 -07:00
suspend.h riscv: Do not save the scratch CSR during suspend 2024-04-28 14:50:36 -07:00
switch_to.h riscv: Include riscv_set_icache_flush_ctx prctl 2024-04-18 08:10:58 -07:00
sync_core.h
syscall_table.h riscv: convert to generic syscall table 2024-07-10 14:23:38 +02:00
syscall_wrapper.h riscv: Mark __se_sys_* functions __used 2024-03-26 14:11:03 -07:00
syscall.h
thread_info.h riscv: Fix kernel stack size when KASAN is enabled 2024-10-01 13:08:11 -07:00
timex.h
tlb.h RISC-V Patches for the 6.9 Merge Window 2024-03-22 10:41:13 -07:00
tlbbatch.h
tlbflush.h riscv: mm: Use a fixed layout for the MM context ID 2024-04-29 10:49:33 -07:00
topology.h arch, mm: move definition of node_data to generic code 2024-09-03 21:15:28 -07:00
trace.h riscv: Add tracepoints for SBI calls and returns 2024-07-10 13:23:09 -07:00
uaccess.h riscv: Fix spurious errors from __get/put_kernel_nofault 2024-03-26 08:34:48 -07:00
unistd.h riscv: convert to generic syscall table 2024-07-10 14:23:38 +02:00
uprobes.h
vdso.h
vector.h riscv: vector: adjust minimum Vector requirement to ZVE32X 2024-05-30 14:33:10 -07:00
vendor_extensions.h riscv: cpufeature: Extract common elements from extension checking 2024-07-22 15:36:57 -07:00
vendorid_list.h riscv: errata: Rename defines for Andes 2024-03-12 07:13:12 -07:00
vermagic.h
vmalloc.h riscv: Add license to vmalloc.h 2024-09-03 07:18:34 -07:00
word-at-a-time.h
xip_fixup.h riscv: drop the use of XIP_OFFSET in XIP_FIXUP_FLASH_OFFSET 2024-09-12 07:22:59 -07:00
xor.h