linux/arch/riscv/include/asm
Hsieh-Tseng Shen 67180e079b riscv: mm: Ensure prot of VM_WRITE and VM_EXEC must be readable
[ Upstream commit 6569fc12e4 ]

Commit 8aeb7b17f0 ("RISC-V: Make mmap() with PROT_WRITE imply PROT_READ")
allows riscv to use mmap with PROT_WRITE only, and meanwhile mmap with w+x
is also permitted. However, when userspace tries to access this page with
PROT_WRITE|PROT_EXEC, which causes infinite loop at load page fault as
well as it triggers soft lockup. According to riscv privileged spec,
"Writable pages must also be marked readable". The fix to drop the
`PAGE_COPY_READ_EXEC` and then `PAGE_COPY_EXEC` would be just used instead.
This aligns the other arches (i.e arm64) for protection_map.

Fixes: 8aeb7b17f0 ("RISC-V: Make mmap() with PROT_WRITE imply PROT_READ")
Signed-off-by: Hsieh-Tseng Shen <woodrow.shen@sifive.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20230425102828.1616812-1-woodrow.shen@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-14 11:15:32 +02:00
..
vdso riscv: fix detection of toolchain Zihintpause support 2022-10-27 15:13:06 -07:00
alternative-macros.h riscv: Move alternative length validation into subsection 2022-06-02 15:55:22 -07:00
alternative.h riscv: add memory-type errata for T-Head 2022-05-11 21:36:33 -07:00
asm-extable.h riscv: extable: add a dedicated uaccess handler 2022-01-05 17:53:29 -08:00
asm-offsets.h
asm-prototypes.h
asm.h RISC-V: Fix a race condition during kernel stack overflow 2022-12-01 11:38:39 -08:00
atomic.h riscv: atomic: Add custom conditional atomic operation implementation 2022-05-21 10:31:47 -07:00
barrier.h riscv: introduce nops and __nops macros for NOP sequences 2022-07-21 17:17:29 -07:00
bitops.h include: move find.h from asm_generic to linux 2022-01-15 08:47:31 -08:00
bug.h bug: Use normal relative pointers in 'struct bug_entry' 2022-05-19 23:46:10 +02:00
cache.h riscv: Add support for non-coherent devices using zicbom extension 2022-07-28 15:30:51 -07:00
cacheflush.h RISC-V: Fix compilation without RISCV_ISA_ZICBOM 2022-10-21 11:52:39 +05:30
cacheinfo.h
clint.h
clocksource.h
cmpxchg.h riscv: atomic: Cleanup unnecessary definition 2022-05-21 10:31:45 -07:00
compat.h riscv: compat: Add basic compat data type implementation 2022-04-26 13:36:12 -07:00
cpu_ops_sbi.h riscv: ensure cpu_ops_sbi is declared 2022-08-11 13:46:51 -07:00
cpu_ops.h RISC-V: Declare cpu_ops_spinwait in <asm/cpu_ops.h> 2022-08-11 13:06:47 -07:00
cpuidle.h RISC-V: Enable CPU_IDLE drivers 2022-03-10 09:29:21 -08:00
csr.h RISC-V: Add Sstc extension support 2022-08-11 14:41:52 -07:00
current.h riscv: Rename "sp_in_global" to "current_stack_pointer" 2022-03-30 15:15:27 -07:00
delay.h
efi.h riscv: Sync efi page table's kernel mappings before switching 2022-11-28 16:36:34 -08:00
elf.h riscv: Add cache information in AUX vector 2022-10-13 11:06:56 -07:00
errata_list.h riscv: implement Zicbom-based CMO instructions + the t-head variant 2022-08-10 20:49:32 -07:00
extable.h riscv: extable: add type and data fields 2022-01-05 17:52:54 -08:00
fence.h
fixmap.h riscv: Move early dtb mapping into the fixmap region 2023-05-01 08:26:28 +09:00
ftrace.h RISC-V: Don't check text_mutex during stop_machine 2023-03-17 08:50:29 +01:00
futex.h riscv: extable: add a dedicated uaccess handler 2022-01-05 17:53:29 -08:00
gdb_xml.h
gpr-num.h riscv: Add X register names to gpr-nums 2022-10-02 10:17:58 +05:30
hugetlb.h riscv/mm: add arch hook arch_clear_hugepage_flags 2022-12-31 13:32:36 +01:00
hwcap.h RISC-V: Probe Svinval extension form ISA string 2022-10-02 10:18:31 +05:30
image.h
insn-def.h RISC-V: KVM: Use Svinval for local TLB maintenance when available 2022-10-02 10:18:37 +05:30
io.h RISC-V: Fix MEMREMAP_WB for systems with Svpbmt 2022-12-31 13:32:37 +01:00
irq_work.h riscv: Fix irq_work when SMP is disabled 2022-06-01 21:46:31 -07:00
irq.h
irqflags.h
jump_label.h riscv: jump_label: Fixup unaligned arch_static_branch function 2023-03-10 09:34:30 +01:00
kasan.h riscv: Implement sv48 support 2022-01-19 17:54:09 -08:00
Kbuild RISC-V: Move to queued RW locks 2022-05-11 11:50:10 -07:00
kdebug.h
kexec.h RISC-V: kexec: Fix memory leak of fdt buffer 2023-01-07 11:11:53 +01:00
kfence.h
kgdb.h
kprobes.h
kvm_host.h RISC-V: KVM: Record number of signal exits as a vCPU stat 2022-10-02 10:19:16 +05:30
kvm_types.h KVM: RISC-V: Use common KVM implementation of MMU memory caches 2022-01-06 14:38:50 +05:30
kvm_vcpu_fp.h RISC-V: KVM: Improve ISA extension by using a bitmap 2022-07-29 17:14:11 +05:30
kvm_vcpu_insn.h RISC-V: KVM: Add extensible CSR emulation framework 2022-07-29 17:14:53 +05:30
kvm_vcpu_sbi.h RISC-V: KVM: Change the SBI specification version to v1.0 2022-10-02 10:18:25 +05:30
kvm_vcpu_timer.h RISC-V: KVM: Fix kvm_riscv_vcpu_timer_pending() for Sstc 2022-10-21 11:52:45 +05:30
linkage.h
mmio.h
mmiowb.h
mmu_context.h
mmu.h Revert "riscv: mm: notify remote harts about mmu cache updates" 2023-03-22 13:34:00 +01:00
mmzone.h
module.h
module.lds.h riscv module: remove (NOLOAD) 2022-03-29 14:31:07 -07:00
numa.h
page.h arch/*/: remove CONFIG_VIRT_TO_BUS 2022-06-28 13:20:21 +02:00
parse_asm.h riscv: Add header include guards to insn.h 2023-03-17 08:50:21 +01:00
patch.h RISC-V: Don't check text_mutex during stop_machine 2023-03-17 08:50:29 +01:00
pci.h RISC-V Patches for the 5.20 Merge Window, Part 1 2022-08-06 15:04:48 -07:00
perf_event.h riscv: perf: Fix callchain parse error with kernel tracepoint events 2023-06-09 10:34:23 +02:00
pgalloc.h riscv: Sync efi page table's kernel mappings before switching 2022-11-28 16:36:34 -08:00
pgtable-32.h riscv: add RISC-V Svpbmt extension support 2022-05-11 21:36:33 -07:00
pgtable-64.h riscv: Fix P4D_SHIFT definition for 3-level page table mode 2022-12-31 13:32:38 +01:00
pgtable-bits.h riscv: add RISC-V Svpbmt extension support 2022-05-11 21:36:33 -07:00
pgtable.h riscv: mm: Ensure prot of VM_WRITE and VM_EXEC must be readable 2023-06-14 11:15:32 +02:00
probes.h
processor.h kernel: exit: cleanup release_thread() 2022-09-11 21:55:07 -07:00
ptdump.h
ptrace.h
sbi.h RISC-V: Align SBI probe implementation with spec 2023-05-11 23:03:04 +09:00
seccomp.h
sections.h
set_memory.h
signal.h riscv: signal: fix missing prototype warning 2022-08-18 14:42:52 -07:00
signal32.h riscv: compat: signal: Add rt_frame implementation 2022-05-17 16:37:21 -07:00
smp.h riscv: kexec: Fixup crash_smp_send_stop without multi cores 2022-11-29 21:50:59 -08:00
soc.h
sparsemem.h riscv: Allow to dynamically define VA_BITS 2022-01-19 17:54:07 -08:00
stackprotector.h
stacktrace.h
string.h
suspend.h RISC-V: Add arch functions for non-retentive suspend entry/exit 2022-03-10 09:29:31 -08:00
switch_to.h riscv: switch has_fpu() to the unified static key mechanism 2022-06-16 10:51:31 -07:00
syscall.h riscv: compat: syscall: Add compat_sys_call_table implementation 2022-04-26 13:36:25 -07:00
thread_info.h RISC-V: add a spin_shadow_stack declaration 2023-03-10 09:34:29 +01:00
timex.h riscv: use fallback for random_get_entropy() instead of zero 2022-05-13 23:59:23 +02:00
tlb.h
tlbflush.h riscv: mm: Fix incorrect ASID argument when flushing TLB 2023-03-30 12:49:28 +02:00
uaccess.h riscv: uaccess: fix type of 0 variable on error in get_user() 2023-01-12 12:02:50 +01:00
unistd.h riscv: Wire up memfd_secret in UAPI header 2022-06-01 21:46:36 -07:00
uprobes.h
vdso.h riscv: compat: vdso: Add COMPAT_VDSO base code implementation 2022-04-26 13:36:53 -07:00
vendorid_list.h riscv: add memory-type errata for T-Head 2022-05-11 21:36:33 -07:00
vermagic.h
vmalloc.h
word-at-a-time.h
xip_fixup.h RISC-V: Split out the XIP fixups into their own file 2022-05-25 14:43:33 -07:00