Skip to content

Commit 4235b1a

Browse files
committed
ima: fix mprotect checking
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]>
1 parent 42413b4 commit 4235b1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

security/integrity/ima/ima_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,8 @@ int ima_file_mprotect(struct vm_area_struct *vma, unsigned long prot)
419419
int pcr;
420420

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

425426
security_task_getsecid(current, &secid);

0 commit comments

Comments
 (0)