Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

riscv/mm/fault: Set FAULT_FLAG_INSTRUCTION flag in do_page_fault()

If the page fault "cause" is EXC_INST_PAGE_FAULT, set the
FAULT_FLAG_INSTRUCTION flag to let handle_mm_fault() and friends know
about it. This has no functional changes because RISC-V uses the default
arch_vma_access_permitted() implementation, which always returns true.
However, dax_pmd_fault(), for example, has a tracepoint that uses
FAULT_FLAG_INSTRUCTION, so we might as well set it.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>

authored by

Pekka Enberg and committed by
Palmer Dabbelt
a960c132 2baa6d95

+2 -1
+2 -1
arch/riscv/mm/fault.c
··· 234 234 235 235 if (cause == EXC_STORE_PAGE_FAULT) 236 236 flags |= FAULT_FLAG_WRITE; 237 - 237 + else if (cause == EXC_INST_PAGE_FAULT) 238 + flags |= FAULT_FLAG_INSTRUCTION; 238 239 retry: 239 240 mmap_read_lock(mm); 240 241 vma = find_vma(mm, addr);