Commit 56842841 authored by popcornmix's avatar popcornmix
Browse files

vcsm: Treat EBUSY as success rather than SIGBUS



Currently if two cores access the same page concurrently one will return VM_FAULT_NOPAGE
and the other VM_FAULT_SIGBUS crashing the user code.

Also report when mapping fails.

Signed-off-by: default avatarpopcornmix <popcornmix@gmail.com>
parent e1b1d822
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1181,11 +1181,20 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
	switch (ret) {
	case 0:
	case -ERESTARTSYS:
	/*
	* EBUSY is ok: this just means that another thread
	* already did the job.
	*/
	case -EBUSY:
		return VM_FAULT_NOPAGE;
	case -ENOMEM:
	case -EAGAIN:
		pr_err("[%s]: failed to map page pfn:%lx virt:%lx ret:%d\n", __func__,
			pfn, (unsigned long)vmf->virtual_address, ret);
		return VM_FAULT_OOM;
	default:
		pr_err("[%s]: failed to map page pfn:%lx virt:%lx ret:%d\n", __func__,
			pfn, (unsigned long)vmf->virtual_address, ret);
		return VM_FAULT_SIGBUS;
	}
}