goto exit_unlock;
}
- if (!capable(CAP_IPC_OWNER) &&
- conn->msg_count > KDBUS_CONN_MAX_MSGS) {
+ if (conn->msg_count > KDBUS_CONN_MAX_MSGS &&
+ !kdbus_bus_uid_is_privileged(conn->ep->bus)) {
ret = -ENOBUFS;
goto exit_unlock;
}
case KDBUS_ITEM_CREDS:
/* privileged processes can impersonate somebody else */
- if (!capable(CAP_IPC_OWNER))
+ if (!kdbus_bus_uid_is_privileged(bus))
return -EPERM;
if (item->size !=
case KDBUS_ITEM_SECLABEL:
/* privileged processes can impersonate somebody else */
- if (!capable(CAP_IPC_OWNER))
+ if (!kdbus_bus_uid_is_privileged(bus))
return -EPERM;
seclabel = item->str;
#define KDBUS_MATCH_MAX_SIZE SZ_32K /* maximum size of match data */
#define KDBUS_POLICY_MAX_SIZE SZ_32K /* maximum size of policy data */
-#define KDBUS_CONN_MAX_MSGS 64 /* maximum number of queued messages on the bus */
+#define KDBUS_CONN_MAX_MSGS 64 /* maximum number of queued messages per connection */
#define KDBUS_CONN_MAX_NAMES 64 /* maximum number of well-known names */
#define KDBUS_CONN_MAX_ALLOCATED_BYTES SZ_64K /* maximum number of allocated bytes on the bus */
return -EINVAL;
vecs_size += item->vec.size;
- if (!capable(CAP_IPC_OWNER) &&
- vecs_size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE)
+ if (vecs_size > KDBUS_MSG_MAX_PAYLOAD_VEC_SIZE &&
+ !kdbus_bus_uid_is_privileged(conn->ep->bus))
return -EMSGSIZE;
/* \0-bytes records store only the alignment bytes */