# Pastebin j5KydTwZ diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 8685f85a7474..c939e8f85875 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -215,13 +215,19 @@ void handle_page_fault(struct pt_regs *regs) struct task_struct *tsk; struct vm_area_struct *vma; struct mm_struct *mm; - unsigned long addr, cause; + unsigned long addr, addr_new, cause; unsigned int flags = FAULT_FLAG_DEFAULT; int code = SEGV_MAPERR; vm_fault_t fault; cause = regs->cause; addr = regs->badaddr; + addr_new = (long)addr << 16 >> 16; // Sign-extend TVAL + if (addr_new != addr) { + pr_warn("DEBUG %s: cause=0x%lx: TVAL bug detected and fixed: old=0x%lx new=0x%lx", + __func__, cause, addr, addr_new); + } + addr = addr_new; tsk = current; mm = tsk->mm;