• Paul Moore's avatar
    selinux,smack: fix subjective/objective credential use mixups · a3727a8b
    Paul Moore authored
    Jann Horn reported a problem with commit eb1231f7 ("selinux:
    clarify task subjective and objective credentials") where some LSM
    hooks were attempting to access the subjective credentials of a task
    other than the current task.  Generally speaking, it is not safe to
    access another task's subjective credentials and doing so can cause
    a number of problems.
    
    Further, while looking into the problem, I realized that Smack was
    suffering from a similar problem brought about by a similar commit
    1fb057dc ("smack: differentiate between subjective and objective
    task credentials").
    
    This patch addresses this problem by restoring the use of the task's
    objective credentials in those cases where the task is other than the
    current executing task.  Not only does this resolve the problem
    reported by Jann, it is arguably the correct thing to do in these
    cases.
    
    Cc: stable@vger.kernel.org
    Fixes: eb1231f7 ("selinux: clarify task subjective and objective credentials")
    Fixes: 1fb057dc ("smack: differentiate between subjective and objective task credentials")
    Reported-by: default avatarJann Horn <jannh@google.com>
    Acked-by: default avatarEric W. Biederman <ebiederm@xmission.com>
    Acked-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
    Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
    a3727a8b
smack_lsm.c 119 KB