Skip to content

Commit 20f482a

Browse files
Lans ZhangMimi Zohar
authored andcommitted
ima: allow to check MAY_APPEND
Otherwise some mask and inmask tokens with MAY_APPEND flag may not work as expected. Signed-off-by: Lans Zhang <jia.zhang@windriver.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
1 parent bc15ed6 commit 20f482a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

security/integrity/ima/ima_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ void ima_add_violation(struct file *file, const unsigned char *filename,
157157
/**
158158
* ima_get_action - appraise & measure decision based on policy.
159159
* @inode: pointer to inode to measure
160-
* @mask: contains the permission mask (MAY_READ, MAY_WRITE, MAY_EXECUTE)
160+
* @mask: contains the permission mask (MAY_READ, MAY_WRITE, MAY_EXEC,
161+
* MAY_APPEND)
161162
* @func: caller identifier
162163
* @pcr: pointer filled in if matched measure policy sets pcr=
163164
*

security/integrity/ima/ima_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ int ima_bprm_check(struct linux_binprm *bprm)
309309
/**
310310
* ima_path_check - based on policy, collect/store measurement.
311311
* @file: pointer to the file to be measured
312-
* @mask: contains MAY_READ, MAY_WRITE or MAY_EXECUTE
312+
* @mask: contains MAY_READ, MAY_WRITE, MAY_EXEC or MAY_APPEND
313313
*
314314
* Measure files based on the ima_must_measure() policy decision.
315315
*
@@ -319,8 +319,8 @@ int ima_bprm_check(struct linux_binprm *bprm)
319319
int ima_file_check(struct file *file, int mask, int opened)
320320
{
321321
return process_measurement(file, NULL, 0,
322-
mask & (MAY_READ | MAY_WRITE | MAY_EXEC),
323-
FILE_CHECK, opened);
322+
mask & (MAY_READ | MAY_WRITE | MAY_EXEC |
323+
MAY_APPEND), FILE_CHECK, opened);
324324
}
325325
EXPORT_SYMBOL_GPL(ima_file_check);
326326

0 commit comments

Comments
 (0)