Skip to content

Commit

Permalink
ima: fix mprotect checking
Browse files Browse the repository at this point in the history
Make sure IMA is enabled before checking mprotect change.  Addresses
report of a 3.7% regression of boot-time.dhcp.

Fixes: 8eb613c ("ima: verify mprotect change is consistent with mmap policy")
Reported-by: kernel test robot <[email protected]>
Reviewed-by: Lakshmi Ramasubramanian <[email protected]>
Tested-by: Xing Zhengjun <[email protected]>
Signed-off-by: Mimi Zohar <[email protected]>
  • Loading branch information
mimizohar committed Jun 12, 2020
1 parent 42413b4 commit 4235b1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ int ima_file_mprotect(struct vm_area_struct *vma, unsigned long prot)
int pcr;

/* Is mprotect making an mmap'ed file executable? */
if (!vma->vm_file || !(prot & PROT_EXEC) || (vma->vm_flags & VM_EXEC))
if (!(ima_policy_flag & IMA_APPRAISE) || !vma->vm_file ||
!(prot & PROT_EXEC) || (vma->vm_flags & VM_EXEC))
return 0;

security_task_getsecid(current, &secid);
Expand Down

0 comments on commit 4235b1a

Please sign in to comment.