ima: fix erroneous removal of security.ima xattr
authorDmitry Kasatkin <d.kasatkin@samsung.com>
Wed, 13 Nov 2013 21:42:39 +0000 (23:42 +0200)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Fri, 7 Mar 2014 17:15:44 +0000 (12:15 -0500)
commit09b1148ef59c93d292a3355c00e9b5779b2ecad0
treeb174a785efcfb9f752da096cd31593da96b2603d
parent20ee451f5a7cd43edda56ba36cbec4d881d3329f
ima: fix erroneous removal of security.ima xattr

ima_inode_post_setattr() calls ima_must_appraise() to check if the
file needs to be appraised. If it does not then it removes security.ima
xattr. With original policy matching code it might happen that even
file needs to be appraised with FILE_CHECK hook, it might not be
for POST_SETATTR hook. 'security.ima' might be erronously removed.

This patch treats POST_SETATTR as special wildcard function and will
cause ima_must_appraise() to be true if any of the hooks rules matches.
security.ima will not be removed if any of the hooks would require
appraisal.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
security/integrity/ima/ima_policy.c