Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA: Add IB_UVERBS_CORE_SUPPORT_ROBUST_UDATA

This flag can be set by drivers once they have finished auditing and
implementing the full udata support on every udata operation.

My intention going forward is that driver authors proposing new udata uAPI
for their drivers must first do the work and set this flag.

If this flag is not set the userspace should not try to use udata based
uAPI newer than this commit, though on a case by case basis it may be OK
based on what checks historical kernels performed on the specific call.

Since bnxt_re is audited now, it is the first driver to set the flag.

Link: https://patch.msgid.link/r/13-v3-bd56dd443069+49-bnxt_re_uapi_jgg@nvidia.com
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

+17
+1
drivers/infiniband/core/device.c
··· 2706 2706 2707 2707 dev_ops->uverbs_no_driver_id_binding |= 2708 2708 ops->uverbs_no_driver_id_binding; 2709 + dev_ops->uverbs_robust_udata |= ops->uverbs_robust_udata; 2709 2710 2710 2711 SET_DEVICE_OP(dev_ops, add_gid); 2711 2712 SET_DEVICE_OP(dev_ops, add_sub_dev);
+8
drivers/infiniband/core/uverbs_std_types_device.c
··· 247 247 { 248 248 u32 num_comp = attrs->ufile->device->num_comp_vectors; 249 249 u64 core_support = IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS; 250 + struct ib_device *ib_dev; 250 251 int ret; 252 + 253 + ib_dev = srcu_dereference(attrs->ufile->device->ib_dev, 254 + &attrs->ufile->device->disassociate_srcu); 255 + if (!ib_dev) 256 + return -EIO; 251 257 252 258 ret = uverbs_copy_to(attrs, UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS, 253 259 &num_comp, sizeof(num_comp)); 254 260 if (IS_UVERBS_COPY_ERR(ret)) 255 261 return ret; 256 262 263 + if (ib_dev->ops.uverbs_robust_udata) 264 + core_support |= IB_UVERBS_CORE_SUPPORT_ROBUST_UDATA; 257 265 ret = uverbs_copy_to(attrs, UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT, 258 266 &core_support, sizeof(core_support)); 259 267 if (IS_UVERBS_COPY_ERR(ret))
+1
drivers/infiniband/hw/bnxt_re/main.c
··· 1326 1326 .owner = THIS_MODULE, 1327 1327 .driver_id = RDMA_DRIVER_BNXT_RE, 1328 1328 .uverbs_abi_ver = BNXT_RE_ABI_VERSION, 1329 + .uverbs_robust_udata = true, 1329 1330 1330 1331 .add_gid = bnxt_re_add_gid, 1331 1332 .alloc_hw_port_stats = bnxt_re_ib_alloc_hw_port_stats,
+6
include/rdma/ib_verbs.h
··· 2481 2481 enum rdma_driver_id driver_id; 2482 2482 u32 uverbs_abi_ver; 2483 2483 unsigned int uverbs_no_driver_id_binding:1; 2484 + /* 2485 + * Indicates the driver checks every op accepting a udata for the 2486 + * correct size on input and always handles the output using the udata 2487 + * helpers. 2488 + */ 2489 + unsigned int uverbs_robust_udata:1; 2484 2490 2485 2491 /* 2486 2492 * NOTE: New drivers should not make use of device_group; instead new
+1
include/uapi/rdma/ib_user_ioctl_verbs.h
··· 46 46 47 47 enum ib_uverbs_core_support { 48 48 IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0, 49 + IB_UVERBS_CORE_SUPPORT_ROBUST_UDATA = 1 << 1, 49 50 }; 50 51 51 52 enum ib_uverbs_access_flags {