]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
ima: do not update security.ima if appraisal status is not INTEGRITY_PASS
authorRoberto Sassu <roberto.sassu@huawei.com>
Tue, 7 Nov 2017 10:37:07 +0000 (11:37 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 14 Mar 2018 10:41:51 +0000 (11:41 +0100)
commitbb6f907f23c29f3cf5e801985fdacb92f4a17fa7
treeb5ab469932a8fc2feb693c9d652063e39b250e07
parentf149de28da8413f4d27456f74e5ec7ca1717abd7
ima: do not update security.ima if appraisal status is not INTEGRITY_PASS

BugLink: http://bugs.launchpad.net/bugs/1744213
commit 020aae3ee58c1af0e7ffc4e2cc9fe4dc630338cb upstream.

Commit b65a9cfc2c38 ("Untangling ima mess, part 2: deal with counters")
moved the call of ima_file_check() from may_open() to do_filp_open() at a
point where the file descriptor is already opened.

This breaks the assumption made by IMA that file descriptors being closed
belong to files whose access was granted by ima_file_check(). The
consequence is that security.ima and security.evm are updated with good
values, regardless of the current appraisal status.

For example, if a file does not have security.ima, IMA will create it after
opening the file for writing, even if access is denied. Access to the file
will be allowed afterwards.

Avoid this issue by checking the appraisal status before updating
security.ima.

Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
security/integrity/ima/ima_appraise.c