Revert "kdbus: disable all internal policy checks"
authorKonrad Lipinski <konrad.l@samsung.com>
Thu, 8 Sep 2016 14:47:28 +0000 (16:47 +0200)
committerKonrad Lipinski <konrad.l@samsung.com>
Fri, 9 Sep 2016 11:26:20 +0000 (13:26 +0200)
This reverts commit be985df5ae55fc71deab9e1d5fcac184e1c6d781.

ipc/kdbus/connection.c
ipc/kdbus/names.c

index 2d54105d6f20b0c98e65d376af732df212492a89..b3b081c272976f21663daafb694950d9f58158ad 100644 (file)
 #define KDBUS_CONN_ACTIVE_BIAS (INT_MIN + 2)
 #define KDBUS_CONN_ACTIVE_NEW  (INT_MIN + 1)
 
-/* Disable internal kdbus policy - possibilities of connections to own, see and
- * talk to names are restricted by libdbuspolicy library and LSM hooks
- */
-#define DISABLE_KDBUS_POLICY
-
 static struct kdbus_conn *kdbus_conn_new(struct kdbus_ep *ep, bool privileged,
                                         struct kdbus_cmd_hello *hello,
                                         const char *name,
@@ -1223,10 +1218,13 @@ static struct kdbus_reply *kdbus_conn_call(struct kdbus_conn *src,
        if (ret)
                goto exit;
 
+       /* Disable internal kdbus policy - possibilities of connections to own,
+        * see and talk to well-known names are restricted by LSM hooks
        if (!kdbus_conn_policy_talk(src, current_cred(), dst)) {
                ret = -EPERM;
                goto exit;
        }
+       */
 
        wait = kdbus_reply_new(dst, src, &kmsg->msg, name, true);
        if (IS_ERR(wait)) {
@@ -1305,9 +1303,12 @@ static int kdbus_conn_unicast(struct kdbus_conn *src, struct kdbus_kmsg *kmsg)
                if (!kdbus_match_db_match_kmsg(dst->match_db, src, kmsg) ||
                    !kdbus_conn_policy_talk(dst, NULL, src))
                        goto exit;
+        /* Disable internal kdbus policy - possibilities of connections to own,
+         * see and talk to well-known names are restricted by LSM hooks
        } else if (!kdbus_conn_policy_talk(src, current_cred(), dst)) {
                ret = -EPERM;
                goto exit;
+       */
        } else if (kmsg->msg.flags & KDBUS_MSG_EXPECT_REPLY) {
                wait = kdbus_reply_new(dst, src, &kmsg->msg, name, false);
                if (IS_ERR(wait)) {
@@ -1474,10 +1475,6 @@ bool kdbus_conn_policy_own_name(struct kdbus_conn *conn,
        unsigned int hash = kdbus_strhash(name);
        int res;
 
-#ifdef DISABLE_KDBUS_POLICY
-       return true;
-#endif
-
        if (!conn_creds)
                conn_creds = conn->cred;
 
@@ -1510,11 +1507,6 @@ bool kdbus_conn_policy_talk(struct kdbus_conn *conn,
                            const struct cred *conn_creds,
                            struct kdbus_conn *to)
 {
-
-#ifdef DISABLE_KDBUS_POLICY
-       return true;
-#endif
-
        if (!conn_creds)
                conn_creds = conn->cred;
 
@@ -1551,10 +1543,6 @@ bool kdbus_conn_policy_see_name_unlocked(struct kdbus_conn *conn,
 {
        int res;
 
-#ifdef DISABLE_KDBUS_POLICY
-       return true;
-#endif
-
        /*
         * By default, all names are visible on a bus. SEE policies can only be
         * installed on custom endpoints, where by default no name is visible.
@@ -1585,11 +1573,6 @@ static bool kdbus_conn_policy_see(struct kdbus_conn *conn,
                                  const struct cred *conn_creds,
                                  struct kdbus_conn *whom)
 {
-
-#ifdef DISABLE_KDBUS_POLICY
-       return true;
-#endif
-
        /*
         * By default, all names are visible on a bus, so a connection can
         * always see other connections. SEE policies can only be installed on
index df99e4df815b2e678ebc648bdf963b1940fdc56d..90e0c016f66e90d083b6f507fec6bc7aabaa75b4 100644 (file)
@@ -290,10 +290,13 @@ int kdbus_name_acquire(struct kdbus_name_registry *reg,
 
        down_write(&reg->rwlock);
 
+        /* Disable internal kdbus policy - possibilities of connections to own,
+         * see and talk to well-known names are restricted by LSM hooks
        if (!kdbus_conn_policy_own_name(conn, current_cred(), name)) {
                ret = -EPERM;
                goto exit_unlock;
        }
+       */
 
        hash = kdbus_strhash(name);
        e = kdbus_name_find(reg, hash, name);