aboutsummaryrefslogtreecommitdiffstats
path: root/security/smack
diff options
context:
space:
mode:
authorRafal Krypa <r.krypa@samsung.com>2016-04-04 05:14:53 -0400
committerCasey Schaufler <casey@schaufler-ca.com>2016-06-08 16:52:31 -0400
commit18d872f77cecec2677a394170f26aaeb08562cee (patch)
treeb9d58ab693ce181382a7c62a4d8a42676248a3fe /security/smack
parent40d273782ff16fe1a7445cc05c66a447dfea3433 (diff)
Smack: ignore null signal in smack_task_kill
Kill with signal number 0 is commonly used for checking PID existence. Smack treated such cases like any other kills, although no signal is actually delivered when sig == 0. Checking permissions when sig == 0 didn't prevent an unprivileged caller from learning whether PID exists or not. When it existed, kernel returned EPERM, when it didn't - ESRCH. The only effect of policy check in such case is noise in audit logs. This change lets Smack silently ignore kill() invocations with sig == 0. Signed-off-by: Rafal Krypa <r.krypa@samsung.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security/smack')
-rw-r--r--security/smack/smack_lsm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 6777295f4b2b..e96080eaacbb 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -2227,6 +2227,9 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
2227 struct smack_known *tkp = smk_of_task_struct(p); 2227 struct smack_known *tkp = smk_of_task_struct(p);
2228 int rc; 2228 int rc;
2229 2229
2230 if (!sig)
2231 return 0; /* null signal; existence test */
2232
2230 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK); 2233 smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
2231 smk_ad_setfield_u_tsk(&ad, p); 2234 smk_ad_setfield_u_tsk(&ad, p);
2232 /* 2235 /*