* [PATCH] Smack: ignore null signal in smack_task_kill
@ 2016-04-04 9:14 Rafal Krypa
2016-06-08 20:55 ` Casey Schaufler
0 siblings, 1 reply; 2+ messages in thread
From: Rafal Krypa @ 2016-04-04 9:14 UTC (permalink / raw)
To: Casey Schaufler
Cc: linux-security-module, linux-kernel, Kidong Kim,
Tomasz Świerczek, Rafal Krypa
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>
---
security/smack/smack_lsm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 11f7901..3d9bbed 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,
struct smack_known *tkp = smk_of_task_struct(p);
int rc;
+ if (!sig)
+ return 0; /* null signal; existence test */
+
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
smk_ad_setfield_u_tsk(&ad, p);
/*
--
2.8.0.rc3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Smack: ignore null signal in smack_task_kill
2016-04-04 9:14 [PATCH] Smack: ignore null signal in smack_task_kill Rafal Krypa
@ 2016-06-08 20:55 ` Casey Schaufler
0 siblings, 0 replies; 2+ messages in thread
From: Casey Schaufler @ 2016-06-08 20:55 UTC (permalink / raw)
To: Rafal Krypa
Cc: linux-security-module, linux-kernel, Kidong Kim, Tomasz Świerczek
On 4/4/2016 2:14 AM, Rafal Krypa wrote:
> 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>
Applied to git://github.com/cschaufler/smack-next.git#smack-for-4.8
> ---
> security/smack/smack_lsm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 11f7901..3d9bbed 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,
> struct smack_known *tkp = smk_of_task_struct(p);
> int rc;
>
> + if (!sig)
> + return 0; /* null signal; existence test */
> +
> smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
> smk_ad_setfield_u_tsk(&ad, p);
> /*
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-08 20:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04 9:14 [PATCH] Smack: ignore null signal in smack_task_kill Rafal Krypa
2016-06-08 20:55 ` Casey Schaufler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).