[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1557161824-6623-2-git-send-email-zohar@linux.ibm.com>
Date: Mon, 6 May 2019 12:57:02 -0400
From: Mimi Zohar <zohar@...ux.ibm.com>
To: linux-integrity@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Igor Zhbanov <i.zhbanov@...russia.ru>,
Jordan Glover <Golden_Miller83@...tonmail.ch>,
Al Viro <viro@...iv.linux.org.uk>,
Mimi Zohar <zohar@...ux.ibm.com>
Subject: [PATCH 1/3] ima: verify mprotect change is consistent with mmap policy
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@...ho.nsa.gov>
Signed-off-by: Mimi Zohar <zohar@...ux.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
Powered by blists - more mailing lists