Skip to content

Commit

Permalink
msm: kgsl: Remove VM_MAYWRITE flag to restrict mprotect
Browse files Browse the repository at this point in the history
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 <[email protected]>
CVE-2020-11282
Signed-off-by: Kevin F. Haggerty <[email protected]>
  • Loading branch information
Indira Biruduraju authored and Tomoms committed Mar 5, 2021
1 parent c4b1697 commit 97a0389
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/msm/kgsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3897,6 +3897,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);
Expand Down

0 comments on commit 97a0389

Please sign in to comment.