Unverified Commit ae282ef3 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11169 CVE-2024-42267

Merge Pull Request from: @ci-robot 
 
PR sync from: Yongqiang Liu <liuyongqiang13@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/QFV33TDJVWSPBN77RHOVODCAEQHU5A53/ 
Zhe Qiao (1):
  riscv/mm: Add handling for VM_FAULT_SIGSEGV in mm_fault_error()


-- 
2.25.1
 
https://gitee.com/src-openeuler/kernel/issues/IAKPTW 
 
Link:https://gitee.com/openeuler/kernel/pulls/11169

 

Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents 44f39d7c aa8ef1fa
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -39,26 +39,27 @@ static inline void no_context(struct pt_regs *regs, unsigned long addr)

static inline void mm_fault_error(struct pt_regs *regs, unsigned long addr, vm_fault_t fault)
{
	if (!user_mode(regs)) {
		no_context(regs, addr);
		return;
	}

	if (fault & VM_FAULT_OOM) {
		/*
		 * We ran out of memory, call the OOM killer, and return the userspace
		 * (which will retry the fault, or kill us if we got oom-killed).
		 */
		if (!user_mode(regs)) {
			no_context(regs, addr);
			return;
		}
		pagefault_out_of_memory();
		return;
	} else if (fault & VM_FAULT_SIGBUS) {
		/* Kernel mode? Handle exceptions or die */
		if (!user_mode(regs)) {
			no_context(regs, addr);
			return;
		}
		do_trap(regs, SIGBUS, BUS_ADRERR, addr);
		return;
	} else if (fault & VM_FAULT_SIGSEGV) {
		do_trap(regs, SIGSEGV, SEGV_MAPERR, addr);
		return;
	}

	BUG();
}