fwctl/mlx5: Support for communicating with mlx5 fwmlx5 FW has a built in security context called UID. Each UID has a set ofpermissions controlled by the kernel when it is created and every command
fwctl/mlx5: Support for communicating with mlx5 fwmlx5 FW has a built in security context called UID. Each UID has a set ofpermissions controlled by the kernel when it is created and every commandis tagged by the kernel with a particular UID. In general commands cannotreach objects outside of their UID and commands cannot exceed their UID'spermissions. These restrictions are enforced by FW.This mechanism has long been used in RDMA for the devx interface whereRDMA will sent commands directly to the FW and the UID limitationsrestrict those commands to a ib_device/verbs security domain. For instancecommands that would effect other VFs, or global device resources. Themodel is suitable for unprivileged userspace to operate the RDMAfunctionality.The UID has been extended with a "tools resources" permission which allowsadditional commands and sub-commands that are intended to match with thescope limitations set in FWCTL. This is an alternative design to the"command intent log" where the FW does the enforcement rather than havingthe FW report the enforcement the kernel should do.Consistent with the fwctl definitions the "tools resources" securitycontext is limited to the FWCTL_RPC_CONFIGURATION,FWCTL_RPC_DEBUG_READ_ONLY, FWCTL_RPC_DEBUG_WRITE, andFWCTL_RPC_DEBUG_WRITE_FULL security scopes.Like RDMA devx, each opened fwctl file descriptor will get a unique UIDassociated with each file descriptor.The fwctl driver is kept simple and we reject commands that can createobjects as the UID mechanism relies on the kernel to track and destroyobjects prior to detroying the UID. Filtering into fwctl sub scopes isdone inside the driver with a switch statement. This substantially limitswhat is possible to primarily query functions ad a few limited setoperations.mlx5 already has a robust infrastructure for delivering RPC messages tofw. Trivially connect fwctl's RPC mechanism to mlx5_cmd_do(). Enforce theUser Context ID in every RPC header accepted from the FD so the FW knowsthe security context of the issuing ID.Link: https://patch.msgid.link/r/[email protected]Reviewed-by: Jonathan Cameron <[email protected]>Signed-off-by: Saeed Mahameed <[email protected]>Reviewed-by: Leon Romanovsky <[email protected]>Signed-off-by: Jason Gunthorpe <[email protected]>
show more ...