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
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))
* 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);
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);
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)
#include <linux/ctype.h>
#include <linux/fs.h>
-#include <linux/signal.h>
#include <linux/string.h>
#include "item.h"
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:
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,
struct kdbus_notify_name_change name_change;
struct kdbus_notify_id_change id_change;
struct kdbus_policy_access policy_access;
- __u64 sigmask;
};
};
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