Apply bluetooth/smack patches also to rpi kernel
[AGL/meta-agl.git] / meta-agl-bsp / meta-raspberrypi / recipes-kernel / linux / linux-raspberrypi / 0003-Smack-ignore-null-signal-in-smack_task_kill.patch
1 From ec4eb03af07b0fbc330aecca6ac4ebd6accd8825 Mon Sep 17 00:00:00 2001
2 From: Rafal Krypa <r.krypa@samsung.com>
3 Date: Mon, 4 Apr 2016 11:14:53 +0200
4 Subject: [PATCH 3/4] Smack: ignore null signal in smack_task_kill
5
6 Kill with signal number 0 is commonly used for checking PID existence.
7 Smack treated such cases like any other kills, although no signal is
8 actually delivered when sig == 0.
9
10 Checking permissions when sig == 0 didn't prevent an unprivileged caller
11 from learning whether PID exists or not. When it existed, kernel returned
12 EPERM, when it didn't - ESRCH. The only effect of policy check in such
13 case is noise in audit logs.
14
15 This change lets Smack silently ignore kill() invocations with sig == 0.
16
17 Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
18 Acked-by: Casey Schaufler <casey@schaufler-ca.com>
19 ---
20  security/smack/smack_lsm.c | 3 +++
21  1 file changed, 3 insertions(+)
22
23 diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
24 index b2bcb14..cf8a93f 100644
25 --- a/security/smack/smack_lsm.c
26 +++ b/security/smack/smack_lsm.c
27 @@ -2239,6 +2239,9 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
28         struct smack_known *tkp = smk_of_task_struct(p);
29         int rc;
30  
31 +       if (!sig)
32 +               return 0; /* null signal; existence test */
33 +
34         smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
35         smk_ad_setfield_u_tsk(&ad, p);
36         /*
37 -- 
38 2.7.4
39