lkml.org 
[lkml]   [2019]   [May]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] ima: verify mprotect change is consistent with mmap policy
Date
IMA can be configured to measure and appraise a file's integrity being
mmap'ed execute. Files can be mmap'ed read/write and later changed to
execute to circumvent IMA's mmap measurement and appraisal policy rules.

To prevent this from happening, this patch similarly calls
ima_file_mmap() for mprotect changes.

Suggested-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
security/security.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/security/security.c b/security/security.c
index 23cbb1a295a3..98ce27933e72 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1411,7 +1411,12 @@ int security_mmap_addr(unsigned long addr)
int security_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,
unsigned long prot)
{
- return call_int_hook(file_mprotect, 0, vma, reqprot, prot);
+ int ret;
+
+ ret = call_int_hook(file_mprotect, 0, vma, reqprot, prot);
+ if (ret)
+ return ret;
+ return ima_file_mmap(vma->vm_file, prot);
}

int security_file_lock(struct file *file, unsigned int cmd)
--
2.7.5
\
 
 \ /
  Last update: 2019-05-06 18:58    [W:0.041 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site