forked from rubenslte/android_kernel_samsung_msm8226
msm: kgsl: Remove VM_MAYWRITE flag to restrict mprotect
When VM_MAYWRITE flag is used during mmap(), mprotect() can be used later to change the protection of memstore to allow write. Make sure this does not happen by removing VM_MAYWRITE from the vm_flags of vma. Change-Id: I6f69f05858ea40611d512cfa796caabeaa88cdb5 Signed-off-by: Indira Biruduraju <ibirudur@codeaurora.org> CVE-2020-11282 Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
This commit is contained in:
committed by
Francescodario Cuzzocrea
parent
a2854e4f01
commit
6fa86e0e6d
@@ -3903,6 +3903,8 @@ kgsl_mmap_memstore(struct kgsl_device *device, struct vm_area_struct *vma)
|
||||
if (vma->vm_flags & VM_WRITE)
|
||||
return -EPERM;
|
||||
|
||||
vma->vm_flags &= ~VM_MAYWRITE;
|
||||
|
||||
if (memdesc->size != vma_size) {
|
||||
KGSL_MEM_ERR(device, "memstore bad size: %d should be %d\n",
|
||||
vma_size, memdesc->size);
|
||||
|
||||
Reference in New Issue
Block a user