From 55e11f9cbdb468ad31cf7226c82a372375c735b4 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Wed, 7 Jan 2015 13:30:28 +0100 Subject: [PATCH] kdbus: drop KDBUS_ITEM_SIGMASK 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 --- Changelog | 12 +++++------- connection.c | 26 -------------------------- item.c | 6 ------ kdbus.h | 2 -- kdbus.txt | 6 ------ 5 files changed, 5 insertions(+), 47 deletions(-) diff --git a/Changelog b/Changelog index 3232c64..3c16036 100644 --- 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 diff --git a/connection.c b/connection.c index 2fcf813..936e1da 100644 --- a/connection.c +++ b/connection.c @@ -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(¤t->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 fdc8c67..8c32e03 100644 --- a/item.c +++ b/item.c @@ -13,7 +13,6 @@ #include #include -#include #include #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 35792a1..495c1b6 100644 --- 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; }; }; diff --git a/kdbus.txt b/kdbus.txt index c7a233e..8e057f5 100644 --- 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 -- 2.34.1