uacce: implement mremap in uacce_vm_ops to return -EPERM
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 015d239ac0142ad0e26567fd890ef8d171f13709 · < ba29b59d124e725e0377f09b2044909c91d657a1| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
uacce: implement mremap in uacce_vm_ops to return -EPERM
The current uacce_vm_ops does not support the mremap operation of vm_operations_struct. Implement .mremap to return -EPERM to remind users.
The reason we need to explicitly disable mremap is that when the driver does not implement .mremap, it uses the default mremap method. This could lead to a risk scenario:
An application might first mmap address p1, then mremap to p2, followed by munmap(p1), and finally munmap(p2). Since the default mremap copies the original vma's vm_private_data (i.e., q) to the new vma, both munmap operations would trigger vma_close, causing q->qfr to be freed twice(qfr will be set to null here, so repeated release is ok).
From the CVE record · Linux
The Linux kernel’s uacce mapping operations did not implement mremap, so the default operation could copy private mapping data to a new mapping. A local application could then unmap both addresses, triggering the close operation twice; the description notes that repeated release is safe because qfr is set to null. Authentication requirements are not specified.
Teams running Linux kernels with the uacce component should check their vendor’s advisory for affected versions.