ima: fix mprotect checking
Subsystems (4)
Mimi Zohar
maintainerPATCH 1/1 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 8eb613c0b8f1 ("ima: verify mprotect change is consistent with mmap policy")
Reported-by kernel test robot <[email protected]>
Signed-off-by Mimi Zohar <[email protected]>
--- security/integrity/ima/ima_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/integrity/ima/ima_main.c +2 -1
@@ -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);
Signature · 1 line
2.7.5
Quoted 16 lines · Mimi Zohar
Make sure IMA is enabled before checking mprotect change. Addresses report of a 3.7% regression of boot-time.dhcp.
Fixes 8eb613c0b8f1 ("ima: verify mprotect change is consistent with mmap policy")Reported-by kernel test robot <[email protected]>Signed-off-by Mimi Zohar <[email protected]>--- security/integrity/ima/ima_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)security/integrity/ima/ima_main.c +0
-0
security/integrity/ima/ima_main.c int ima_file_mprotect(struct vm_area_struct *vma, unsigned long prot) · line 426
Quoted 9 lines
security/integrity/ima/ima_main.c +2
-1@@ -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);
Reviewed-by Lakshmi Ramasubramanian <[email protected]>