kdbus: drop KDBUS_ITEM_SIGMASK
authorDavid Herrmann <dh.herrmann@gmail.com>
Wed, 7 Jan 2015 12:30:28 +0000 (13:30 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Wed, 7 Jan 2015 12:30:28 +0000 (13:30 +0100)
The sigset_t type is arch-dependent. We really don't want such types in
our kdbus API. Our CANCEL_FD provides a safe alternative, so use it.

If anyone wants SIGMASK support later on, we can always add it again. But
unless someone wants it, we will try hard to keep it out of kdbus.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Changelog
connection.c
item.c
kdbus.h
kdbus.txt

index 3232c64730aae5eba6055e3ef915e25c9f802bf5..3c160361db9c73282d371b65132da19a02525fb1 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -19,13 +19,11 @@ since v2:
     get more fine-grained credential information.
 
   * Removed KDBUS_CMD_CANCEL. The interface was not usable from
-    threaded userspace implementation due to inherit races. Instead,
-    add an item type KDBUS_ITEM_SIGMASK to store a sigmask that is
-    set before the sync SEND ioctl puts the task to sleep, and restore
-    it afterwards, similar to ppoll(). Also add an item type CANCEL_FD
-    which can be used to pass a file descriptor to the CMD_SEND ioctl.
-    When the SEND is done synchronously, writing to this fd from
-    another thread will cancel the blocking operation.
+    threaded userspace implementation due to inherent races. Instead,
+    add an item type CANCEL_FD which can be used to pass a file
+    descriptor to the CMD_SEND ioctl. When the SEND is done
+    synchronously, it will get cancelled as soon as the passed
+    FD signals POLLIN.
 
   * Dropped startttime from KDBUS_ITEM_PIDS
 
index 2fcf813ae25b88422535d0c2760f3e1a7fb6784b..936e1daa57c432414390f6e6e269a982c296dfd4 100644 (file)
@@ -657,11 +657,8 @@ static int kdbus_conn_wait_reply(struct kdbus_conn *conn_src,
                                 struct kdbus_conn_reply *reply_wait,
                                 ktime_t expire)
 {
-       struct kdbus_item *sigmask_item;
        struct kdbus_queue_entry *entry;
        struct poll_wqueues pwq = {};
-       sigset_t ksigsaved;
-       sigset_t ksigmask;
        int ret;
 
        if (WARN_ON(!reply_wait))
@@ -673,17 +670,6 @@ static int kdbus_conn_wait_reply(struct kdbus_conn *conn_src,
         * asynchronous replies of conn_src.
         */
 
-       sigmask_item = kdbus_items_get(cmd_send->items,
-                                      KDBUS_ITEMS_SIZE(cmd_send, items),
-                                      KDBUS_ITEM_SIGMASK);
-       if (IS_ERR(sigmask_item)) {
-               sigmask_item = NULL;
-       } else {
-               memcpy(&ksigmask, &sigmask_item->sigmask, sizeof(ksigmask));
-               sigdelsetmask(&ksigmask, sigmask(SIGKILL)|sigmask(SIGSTOP));
-               sigprocmask(SIG_SETMASK, &ksigmask, &ksigsaved);
-       }
-
        poll_initwait(&pwq);
        poll_wait(ioctl_file, &conn_src->wait, &pwq.pt);
 
@@ -765,18 +751,9 @@ static int kdbus_conn_wait_reply(struct kdbus_conn *conn_src,
                schedule_delayed_work(&conn_dst->work, 0);
                mutex_unlock(&conn_dst->lock);
 
-               if (sigmask_item) {
-                       memcpy(&current->saved_sigmask,
-                              &ksigsaved, sizeof(ksigsaved));
-                       set_restore_sigmask();
-               }
-
                return -ERESTARTSYS;
        }
 
-       if (sigmask_item)
-               sigprocmask(SIG_SETMASK, &ksigsaved, NULL);
-
        mutex_lock(&conn_dst->lock);
        list_del_init(&reply_wait->entry);
        mutex_unlock(&conn_dst->lock);
@@ -831,9 +808,6 @@ int kdbus_cmd_msg_send(struct kdbus_conn *conn_src,
 
        KDBUS_ITEMS_FOREACH(item, cmd->items, KDBUS_ITEMS_SIZE(cmd, items)) {
                switch (item->type) {
-               case KDBUS_ITEM_SIGMASK:
-                       break;
-
                case KDBUS_ITEM_CANCEL_FD:
                        /* install cancel_fd only if synchronous */
                        if (!sync)
diff --git a/item.c b/item.c
index fdc8c6729c9d2e5f75002d57e297c996c160a9dd..8c32e03a36ac30d8cb0b916c4afa8ec710b7250a 100644 (file)
--- a/item.c
+++ b/item.c
@@ -13,7 +13,6 @@
 
 #include <linux/ctype.h>
 #include <linux/fs.h>
-#include <linux/signal.h>
 #include <linux/string.h>
 
 #include "item.h"
@@ -137,11 +136,6 @@ static int kdbus_item_validate(const struct kdbus_item *item)
                        return -EINVAL;
                break;
 
-       case KDBUS_ITEM_SIGMASK:
-               if (payload_size != sizeof(sigset_t))
-                       return -EINVAL;
-               break;
-
        case KDBUS_ITEM_NAME:
        case KDBUS_ITEM_DST_NAME:
        case KDBUS_ITEM_PID_COMM:
diff --git a/kdbus.h b/kdbus.h
index 35792a13b0abab36410b58c20a540e90ee22c575..495c1b63adc68ef35cd7e228a681b33ae4b1767a 100644 (file)
--- a/kdbus.h
+++ b/kdbus.h
@@ -305,7 +305,6 @@ enum kdbus_item_type {
        KDBUS_ITEM_ATTACH_FLAGS_RECV,
        KDBUS_ITEM_ID,
        KDBUS_ITEM_NAME,
-       KDBUS_ITEM_SIGMASK,
 
        /* keep these item types in sync with KDBUS_ATTACH_* flags */
        _KDBUS_ITEM_ATTACH_BASE = 0x1000,
@@ -385,7 +384,6 @@ struct kdbus_item {
                struct kdbus_notify_name_change name_change;
                struct kdbus_notify_id_change id_change;
                struct kdbus_policy_access policy_access;
-               __u64 sigmask;
        };
 };
 
index c7a233eefeac648e758e91e72d2d64038377830d..8e057f5fbddee73a5b03ee5de55d89d03757a73b 100644 (file)
--- a/kdbus.txt
+++ b/kdbus.txt
@@ -827,12 +827,6 @@ struct kdbus_cmd_send {
   struct kdbus_item items[0];
     The following items are currently recognized:
 
-    KDBUS_ITEM_SIGMASK
-      When this optional item is passed in, and the call is executed as SYNC
-      call, the sigmask described will be applied on the calling task before
-      putting it to sleep, and restored afterwards. For asynchronous message
-      sending, this item is accepted but ignored.
-
     KDBUS_ITEM_CANCEL_FD
       When this optional item is passed in, and the call is executed as SYNC
       call, the passed in file descriptor can be used as alternative