Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18d872f7 authored by Rafal Krypa's avatar Rafal Krypa Committed by Casey Schaufler
Browse files

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: default avatarRafal Krypa <r.krypa@samsung.com>
Acked-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
parent 40d27378
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -2227,6 +2227,9 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
	struct smack_known *tkp = smk_of_task_struct(p);
	struct smack_known *tkp = smk_of_task_struct(p);
	int rc;
	int rc;


	if (!sig)
		return 0; /* null signal; existence test */

	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
	smk_ad_setfield_u_tsk(&ad, p);
	smk_ad_setfield_u_tsk(&ad, p);
	/*
	/*