Skip to content

Commit

Permalink
ima: fix filename hint to reflect script interpreter name
Browse files Browse the repository at this point in the history
When IMA was first upstreamed, the bprm filename and interp were
always the same.  Currently, the bprm->filename and bprm->interp
are the same, except for when only bprm->interp contains the
interpreter name.  So instead of using the bprm->filename as
the IMA filename hint in the measurement list, we could replace
it with bprm->interp, but this feels too fragil.

The following patch is not much better, but at least there is some
indication that sometimes we're passing the filename and other times
the interpreter name.

Reported-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
  • Loading branch information
Mimi Zohar authored and James Morris committed May 16, 2012
1 parent 12fa8a2 commit fbbb456
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ int ima_bprm_check(struct linux_binprm *bprm)
{
int rc;

rc = process_measurement(bprm->file, bprm->filename,
rc = process_measurement(bprm->file,
(strcmp(bprm->filename, bprm->interp) == 0) ?
bprm->filename : bprm->interp,
MAY_EXEC, BPRM_CHECK);
return 0;
}
Expand Down

0 comments on commit fbbb456

Please sign in to comment.