• Dmitry Kasatkin's avatar
    ima: fix erroneous removal of security.ima xattr · 09b1148e
    Dmitry Kasatkin authored
    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: default avatarDmitry Kasatkin <d.kasatkin@samsung.com>
    Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
    09b1148e
ima_policy.c 18.5 KB