diff options
author | Mimi Zohar <zohar@linux.ibm.com> | 2020-05-03 01:00:02 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2020-05-22 14:41:04 -0400 |
commit | 8eb613c0b8f19627ba1846dcf78bb2c85edbe8dd (patch) | |
tree | 7cd7a2a48ae7c51b0d1db9b2aa71ede32f76812d /include/linux/ima.h | |
parent | 0c4395fb2aa77341269ea619c5419ea48171883f (diff) | |
download | lwn-8eb613c0b8f19627ba1846dcf78bb2c85edbe8dd.tar.gz lwn-8eb613c0b8f19627ba1846dcf78bb2c85edbe8dd.zip |
ima: verify mprotect change is consistent with mmap policy
Files can be mmap'ed read/write and later changed to execute to circumvent
IMA's mmap appraise policy rules. Due to locking issues (mmap semaphore
would be taken prior to i_mutex), files can not be measured or appraised at
this point. Eliminate this integrity gap, by denying the mprotect
PROT_EXECUTE change, if an mmap appraise policy rule exists.
On mprotect change success, return 0. On failure, return -EACESS.
Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'include/linux/ima.h')
-rw-r--r-- | include/linux/ima.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/ima.h b/include/linux/ima.h index aefe758f4466..9164e1534ec9 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h @@ -18,6 +18,7 @@ extern int ima_file_check(struct file *file, int mask); extern void ima_post_create_tmpfile(struct inode *inode); extern void ima_file_free(struct file *file); extern int ima_file_mmap(struct file *file, unsigned long prot); +extern int ima_file_mprotect(struct vm_area_struct *vma, unsigned long prot); extern int ima_load_data(enum kernel_load_data_id id); extern int ima_read_file(struct file *file, enum kernel_read_file_id id); extern int ima_post_read_file(struct file *file, void *buf, loff_t size, @@ -70,6 +71,12 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot) return 0; } +static inline int ima_file_mprotect(struct vm_area_struct *vma, + unsigned long prot) +{ + return 0; +} + static inline int ima_load_data(enum kernel_load_data_id id) { return 0; |