BACKPORT: Smack: Ptrace access check mode
authorCasey Schaufler <casey@schaufler-ca.com>
Tue, 22 Oct 2013 18:47:45 +0000 (11:47 -0700)
committerRafal Krypa <r.krypa@samsung.com>
Tue, 29 Dec 2015 12:26:46 +0000 (13:26 +0100)
When the ptrace security hooks were split the addition of
a mode parameter was not taken advantage of in the Smack
ptrace access check. This changes the access check from
always looking for read and write access to using the
passed mode. This will make use of /proc much happier.

Targeted for git://git.gitorious.org/smack-next/kernel.git

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
(cherry-picked from upstream b5dfd8075bc26636d11c3d8888940198afbf5112)

security/smack/smack_lsm.c

index a478b4b5b7d7a3f04a29d9900bd63914902cd4e6..934f142ce51f7e1e18aae15cd08c0ce3c60dbc6f 100644 (file)
@@ -185,7 +185,7 @@ static int smack_ptrace_access_check(struct task_struct *ctp, unsigned int mode)
        smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
        smk_ad_setfield_u_tsk(&ad, ctp);
 
-       rc = smk_curacc(skp->smk_known, MAY_READWRITE, &ad);
+       rc = smk_curacc(skp->smk_known, mode, &ad);
        return rc;
 }