return 0;
}
-static bool kdbus_check_flags(u64 kernel_flags)
-{
- /*
- * The higher 32bit are considered 'incompatible flags'.
- * Refuse them all for now.
- */
- return upper_32_bits(kernel_flags) == 0;
-}
-
static int kdbus_copy_from_user(void *dest,
void __user *user_ptr,
size_t size)
if (ret < 0)
break;
- if (!kdbus_check_flags(make->flags)) {
+ /* Reject all feature requests for now */
+ if (make->features != 0) {
ret = -EOPNOTSUPP;
break;
}
if (ret < 0)
break;
- if (!kdbus_check_flags(make->flags)) {
+ /* Reject all feature requests for now */
+ if (make->features != 0) {
ret = -EOPNOTSUPP;
break;
}
if (ret < 0)
break;
- if (!kdbus_check_flags(make->flags)) {
+ /* Reject all feature requests for now */
+ if (make->features != 0) {
ret = -EOPNOTSUPP;
break;
}
if (ret < 0)
break;
- if (!kdbus_check_flags(hello->conn_flags)) {
+ /* Reject all feature requests for now */
+ if (hello->features != 0) {
ret = -EOPNOTSUPP;
break;
}
/**
* struct kdbus_cmd_hello - struct to say hello to kdbus
* @size: The total size of the structure
+ * @features: Feature negotiation bitmask
* @conn_flags: Connection flags (KDBUS_HELLO_*).
* @attach_flags: Mask of metadata to attach to each message sent
* (KDBUS_ATTACH_*)
*/
struct kdbus_cmd_hello {
__u64 size;
+ __u64 features;
__u64 conn_flags;
__u64 attach_flags;
__u64 bus_flags;
/**
* struct kdbus_cmd_make - struct to make a bus, an endpoint or a domain
* @size: The total size of the struct
+ * @features: Feature negotiation bitmask
* @flags: Properties for the bus/ep/domain to create
* @items: Items describing details
*
*/
struct kdbus_cmd_make {
__u64 size;
+ __u64 features;
__u64 flags;
struct kdbus_item items[0];
} __attribute__((aligned(8)));
__u64 size;
The overall size of the struct, including its items.
+ __u64 features;
+ Feature negotiation bitmask. In this field, userspace specifies a set
+ of features it requires from the kernel driver. When the ioctl returns,
+ the kernel has set this field to a value describing the features it
+ requires from the userspace. This field is intended for future forward-
+ compatibility and has to be set to 0. Userspace should check the value
+ after the ioctl returned and treat non-null values as error.
+
__u64 flags;
The flags for creation.
__u64 size;
The overall size of the struct, including all attached items.
+ __u64 features;
+ Feature negotiation bitmask. In this field, userspace specifies a set
+ of features it requires from the kernel driver. When the ioctl returns,
+ the kernel has set this field to a value describing the features it
+ requires from the userspace. This field is intended for future forward-
+ compatibility and has to be set to 0. Userspace should check the value
+ after the ioctl returned and treat non-null values as error.
+
__u64 conn_flags;
Flags to apply to this connection:
KDBUS_ITEM_NAME
KDBUS_ITEM_POLICY_ACCESS
Policy holder connections may supply a new set of policy information
- with these items. For other connection types, -ENOTSUPP is returned.
+ with these items. For other connection types, -EOPNOTSUPP is returned.
};
hello.size = sizeof(struct kdbus_cmd_hello);
- /* check faulty flags */
+ /* check faulty features */
+ hello.features = 1;
+ ret = ioctl(fd, KDBUS_CMD_HELLO, &hello);
+ ASSERT_RETURN(ret == -1 && errno == EOPNOTSUPP);
+ hello.features = 0;
+
+ /* check faulty features */
hello.conn_flags = 1ULL << 32;
ret = ioctl(fd, KDBUS_CMD_HELLO, &hello);
ASSERT_RETURN(ret == -1 && errno == EOPNOTSUPP);