Message ID | 20181112205958.16894-1-leon@kernel.org (mailing list archive) |
---|---|
Headers | show |
Series | Do not allow commands to run that the driver does not support | expand |
On Mon, Nov 12, 2018 at 10:59:48PM +0200, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@mellanox.com> > > >From Jason, > > This extends the uverbs_uapi to have the notion of a disabled object and > in turn disabled methods. Objects that are not supported by the driver > become disabled and all the uAPI entry points are removed. > > The same approach is extended to the write() interface by harmonizing > the write() method description with ioctl within the uverbs_api. > > Blocking commands very early on makes it harder to exploit any error > path bugs that may exist, and provides the necessary infrastructure for > an API introspection feature down the road. > > Along the way this introduces the next step towards making the specs > macros saner but introducing a list-base description of the specs at the > top level of the tree instead of the existing tree based description. > This reworking is necessary to allow splitting data describing objects > across multiple files. > > The introduction of meta-data for write() interface commands is the > first step toward unifying the write/write_ex/ioctl command path into a > consistent and interchangeable flow. Later series will add additional > meta-data using this same framework. > > Thanks > > Jason Gunthorpe (10): > RDMA/mlx5: Do not generate the uabi specs unconditionally > RDMA/uverbs: Use a linear list to describe the compiled-in uapi > RDMA/uverbs: Factor out the add/get pattern into a helper > RDMA/uverbs: Add helpers to mark uapi functions as unsupported > RDMA/mlx5: Use the uapi disablement APIs instead of code > RDMA/uverbs: Require all objects to have a driver destroy function > RDMA/verbs: Store the write/write_ex uapi entry points in the > uverbs_api > RDMA/uverbs: Convert the write interface to use uverbs_api > RDMA/uverbs: Make all the method functions in uverbs_cmd static > RDMA/uverbs: Check for NULL driver methods for every write call I applied this to for-next, but it didn't apply cleanly as this series was not based directly anything likefor-next. The resolutions were simple, so I did them, but please check my work. Applying: RDMA/mlx5: Do not generate the uabi specs unconditionally Applying: RDMA/uverbs: Use a linear list to describe the compiled-in uapi Using index info to reconstruct a base tree... M drivers/infiniband/hw/mlx5/main.c M drivers/infiniband/hw/mlx5/mlx5_ib.h M include/rdma/ib_verbs.h Falling back to patching base and 3-way merge... Auto-merging include/rdma/ib_verbs.h Auto-merging drivers/infiniband/hw/mlx5/mlx5_ib.h Auto-merging drivers/infiniband/hw/mlx5/main.c Applying: RDMA/uverbs: Factor out the add/get pattern into a helper Applying: RDMA/uverbs: Add helpers to mark uapi functions as unsupported Applying: RDMA/mlx5: Use the uapi disablement APIs instead of code Using index info to reconstruct a base tree... M drivers/infiniband/hw/mlx5/main.c M drivers/infiniband/hw/mlx5/mlx5_ib.h Falling back to patching base and 3-way merge... Auto-merging drivers/infiniband/hw/mlx5/mlx5_ib.h CONFLICT (content): Merge conflict in drivers/infiniband/hw/mlx5/mlx5_ib.h Auto-merging drivers/infiniband/hw/mlx5/main.c CONFLICT (content): Merge conflict in drivers/infiniband/hw/mlx5/main.c error: Failed to merge in the changes. Patch failed at 0005 RDMA/mlx5: Use the uapi disablement APIs instead of code Applying: RDMA/mlx5: Use the uapi disablement APIs instead of code Applying: RDMA/uverbs: Require all objects to have a driver destroy function Applying: RDMA/verbs: Store the write/write_ex uapi entry points in the uverbs_api Applying: RDMA/uverbs: Convert the write interface to use uverbs_api Applying: RDMA/uverbs: Make all the method functions in uverbs_cmd static Applying: RDMA/uverbs: Check for NULL driver methods for every write call Jason
On Thu, Nov 22, 2018 at 11:47:45AM -0700, Jason Gunthorpe wrote: > On Mon, Nov 12, 2018 at 10:59:48PM +0200, Leon Romanovsky wrote: > > From: Leon Romanovsky <leonro@mellanox.com> > > > > >From Jason, > > > > This extends the uverbs_uapi to have the notion of a disabled object and > > in turn disabled methods. Objects that are not supported by the driver > > become disabled and all the uAPI entry points are removed. > > > > The same approach is extended to the write() interface by harmonizing > > the write() method description with ioctl within the uverbs_api. > > > > Blocking commands very early on makes it harder to exploit any error > > path bugs that may exist, and provides the necessary infrastructure for > > an API introspection feature down the road. > > > > Along the way this introduces the next step towards making the specs > > macros saner but introducing a list-base description of the specs at the > > top level of the tree instead of the existing tree based description. > > This reworking is necessary to allow splitting data describing objects > > across multiple files. > > > > The introduction of meta-data for write() interface commands is the > > first step toward unifying the write/write_ex/ioctl command path into a > > consistent and interchangeable flow. Later series will add additional > > meta-data using this same framework. > > > > Thanks > > > > Jason Gunthorpe (10): > > RDMA/mlx5: Do not generate the uabi specs unconditionally > > RDMA/uverbs: Use a linear list to describe the compiled-in uapi > > RDMA/uverbs: Factor out the add/get pattern into a helper > > RDMA/uverbs: Add helpers to mark uapi functions as unsupported > > RDMA/mlx5: Use the uapi disablement APIs instead of code > > RDMA/uverbs: Require all objects to have a driver destroy function > > RDMA/verbs: Store the write/write_ex uapi entry points in the > > uverbs_api > > RDMA/uverbs: Convert the write interface to use uverbs_api > > RDMA/uverbs: Make all the method functions in uverbs_cmd static > > RDMA/uverbs: Check for NULL driver methods for every write call > > I applied this to for-next, but it didn't apply cleanly as this series > was not based directly anything likefor-next. > I'm based on mlx5-next which doesn't include two more series, one is on the air from Saeed and another from me. > The resolutions were simple, so I did them, but please check my work. > I have the same main.c. Thanks > Applying: RDMA/mlx5: Do not generate the uabi specs unconditionally > Applying: RDMA/uverbs: Use a linear list to describe the compiled-in uapi > Using index info to reconstruct a base tree... > M drivers/infiniband/hw/mlx5/main.c > M drivers/infiniband/hw/mlx5/mlx5_ib.h > M include/rdma/ib_verbs.h > Falling back to patching base and 3-way merge... > Auto-merging include/rdma/ib_verbs.h > Auto-merging drivers/infiniband/hw/mlx5/mlx5_ib.h > Auto-merging drivers/infiniband/hw/mlx5/main.c > Applying: RDMA/uverbs: Factor out the add/get pattern into a helper > Applying: RDMA/uverbs: Add helpers to mark uapi functions as unsupported > Applying: RDMA/mlx5: Use the uapi disablement APIs instead of code > Using index info to reconstruct a base tree... > M drivers/infiniband/hw/mlx5/main.c > M drivers/infiniband/hw/mlx5/mlx5_ib.h > Falling back to patching base and 3-way merge... > Auto-merging drivers/infiniband/hw/mlx5/mlx5_ib.h > CONFLICT (content): Merge conflict in drivers/infiniband/hw/mlx5/mlx5_ib.h > Auto-merging drivers/infiniband/hw/mlx5/main.c > CONFLICT (content): Merge conflict in drivers/infiniband/hw/mlx5/main.c > error: Failed to merge in the changes. > Patch failed at 0005 RDMA/mlx5: Use the uapi disablement APIs instead of code > Applying: RDMA/mlx5: Use the uapi disablement APIs instead of code > Applying: RDMA/uverbs: Require all objects to have a driver destroy function > Applying: RDMA/verbs: Store the write/write_ex uapi entry points in the uverbs_api > Applying: RDMA/uverbs: Convert the write interface to use uverbs_api > Applying: RDMA/uverbs: Make all the method functions in uverbs_cmd static > Applying: RDMA/uverbs: Check for NULL driver methods for every write call > > Jason
From: Leon Romanovsky <leonro@mellanox.com> From Jason, This extends the uverbs_uapi to have the notion of a disabled object and in turn disabled methods. Objects that are not supported by the driver become disabled and all the uAPI entry points are removed. The same approach is extended to the write() interface by harmonizing the write() method description with ioctl within the uverbs_api. Blocking commands very early on makes it harder to exploit any error path bugs that may exist, and provides the necessary infrastructure for an API introspection feature down the road. Along the way this introduces the next step towards making the specs macros saner but introducing a list-base description of the specs at the top level of the tree instead of the existing tree based description. This reworking is necessary to allow splitting data describing objects across multiple files. The introduction of meta-data for write() interface commands is the first step toward unifying the write/write_ex/ioctl command path into a consistent and interchangeable flow. Later series will add additional meta-data using this same framework. Thanks Jason Gunthorpe (10): RDMA/mlx5: Do not generate the uabi specs unconditionally RDMA/uverbs: Use a linear list to describe the compiled-in uapi RDMA/uverbs: Factor out the add/get pattern into a helper RDMA/uverbs: Add helpers to mark uapi functions as unsupported RDMA/mlx5: Use the uapi disablement APIs instead of code RDMA/uverbs: Require all objects to have a driver destroy function RDMA/verbs: Store the write/write_ex uapi entry points in the uverbs_api RDMA/uverbs: Convert the write interface to use uverbs_api RDMA/uverbs: Make all the method functions in uverbs_cmd static RDMA/uverbs: Check for NULL driver methods for every write call drivers/infiniband/core/rdma_core.h | 50 +- drivers/infiniband/core/uverbs.h | 62 --- drivers/infiniband/core/uverbs_cmd.c | 485 +++++++++++------ drivers/infiniband/core/uverbs_main.c | 127 +---- drivers/infiniband/core/uverbs_std_types.c | 47 +- .../core/uverbs_std_types_counters.c | 6 + drivers/infiniband/core/uverbs_std_types_cq.c | 6 + drivers/infiniband/core/uverbs_std_types_dm.c | 6 + .../core/uverbs_std_types_flow_action.c | 7 + drivers/infiniband/core/uverbs_std_types_mr.c | 6 + drivers/infiniband/core/uverbs_uapi.c | 515 +++++++++++++++--- drivers/infiniband/hw/mlx5/devx.c | 25 +- drivers/infiniband/hw/mlx5/flow.c | 20 +- drivers/infiniband/hw/mlx5/main.c | 56 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 12 +- include/rdma/ib_verbs.h | 2 +- include/rdma/uverbs_ioctl.h | 194 ++++++- include/rdma/uverbs_named_ioctl.h | 11 +- include/rdma/uverbs_std_types.h | 9 - 19 files changed, 1093 insertions(+), 553 deletions(-) -- 2.19.1