Smack: remove task_wait() hook.
authorCasey Schaufler <casey@schaufler-ca.com>
Fri, 10 Aug 2012 00:46:38 +0000 (17:46 -0700)
committerKitae Kim <kt920.kim@samsung.com>
Tue, 21 May 2013 06:39:53 +0000 (15:39 +0900)
commit c00bedb368ae02a066aed8a888afc286c1df2e60 upstream

On 12/20/2011 11:20 PM, Jarkko Sakkinen wrote:
> Allow SIGCHLD to be passed to child process without
> explicit policy. This will help to keep the access
> control policy simple and easily maintainable with
> complex applications that require use of multiple
> security contexts. It will also help to keep them
> as isolated as possible.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@intel.com>

I have a slightly different version that applies to the
current smack-next tree.

Allow SIGCHLD to be passed to child process without
explicit policy. This will help to keep the access
control policy simple and easily maintainable with
complex applications that require use of multiple
security contexts. It will also help to keep them
as isolated as possible.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
 security/smack/smack_lsm.c |   37 ++++++++-----------------------------
 1 files changed, 8 insertions(+), 29 deletions(-)

Change-Id: If37564a178a336b0097d314f4915c65a19c29c91
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
Reviewed-on: http://165.213.202.130:8080/53899
Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: Kyungmin Park <kyungmin.park@samsung.com>
security/smack/smack_lsm.c

index 52d6d14c778737f373a6d506c4f6300d04310498..cd60a1bc87191b94b4e4c35572c79ffd18b0aa45 100644 (file)
@@ -1697,40 +1697,19 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
  * smack_task_wait - Smack access check for waiting
  * @p: task to wait for
  *
- * Returns 0 if current can wait for p, error code otherwise
+ * Returns 0
  */
 static int smack_task_wait(struct task_struct *p)
 {
-       struct smk_audit_info ad;
-       char *sp = smk_of_current();
-       char *tsp = smk_of_forked(task_security(p));
-       int rc;
-
-       /* we don't log here, we can be overriden */
-       rc = smk_access(tsp, sp, MAY_WRITE, NULL);
-       if (rc == 0)
-               goto out_log;
-
        /*
-        * Allow the operation to succeed if either task
-        * has privilege to perform operations that might
-        * account for the smack labels having gotten to
-        * be different in the first place.
-        *
-        * This breaks the strict subject/object access
-        * control ideal, taking the object's privilege
-        * state into account in the decision as well as
-        * the smack value.
+        * Allow the operation to succeed.
+        * Zombies are bad.
+        * In userless environments (e.g. phones) programs
+        * get marked with SMACK64EXEC and even if the parent
+        * and child shouldn't be talking the parent still
+        * may expect to know when the child exits.
         */
-       if (smack_privileged(CAP_MAC_OVERRIDE) ||
-           has_capability(p, CAP_MAC_OVERRIDE))
-               rc = 0;
-       /* we log only if we didn't get overriden */
- out_log:
-       smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
-       smk_ad_setfield_u_tsk(&ad, p);
-       smack_log(tsp, sp, MAY_WRITE, rc, &ad);
-       return rc;
+       return 0;
 }
 
 /**