lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 20 Sep 2021 16:21:31 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     Doug Ledford <dledford@...hat.com>,
        Meir Lichtinger <meirl@...dia.com>,
        linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
        netdev@...r.kernel.org, Saeed Mahameed <saeedm@...dia.com>,
        Yishai Hadas <yishaih@...dia.com>
Subject: Re: [PATCH rdma-next 2/2] IB/mlx5: Enable UAR to have DevX UID

On Wed, Sep 15, 2021 at 10:47:53AM -0300, Jason Gunthorpe wrote:
> On Wed, Sep 15, 2021 at 02:11:23AM +0300, Leon Romanovsky wrote:
> > From: Meir Lichtinger <meirl@...dia.com>
> > 
> > UID field was added to alloc_uar and dealloc_uar PRM command, to specify
> > DevX UID for UAR. This change enables firmware validating user access to
> > its own UAR resources.
> > 
> > For the kernel allocated UARs the UID will stay 0 as of today.
> > 
> > Signed-off-by: Meir Lichtinger <meirl@...dia.com>
> > Reviewed-by: Yishai Hadas <yishaih@...dia.com>
> > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> >  drivers/infiniband/hw/mlx5/cmd.c  | 24 ++++++++++++++
> >  drivers/infiniband/hw/mlx5/cmd.h  |  2 ++
> >  drivers/infiniband/hw/mlx5/main.c | 55 +++++++++++++++++--------------
> >  3 files changed, 57 insertions(+), 24 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/mlx5/cmd.c b/drivers/infiniband/hw/mlx5/cmd.c
> > index a8db8a051170..0fe3c4ceec43 100644
> > +++ b/drivers/infiniband/hw/mlx5/cmd.c
> > @@ -206,3 +206,27 @@ int mlx5_cmd_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb,
> >  	kfree(in);
> >  	return err;
> >  }
> > +
> > +int mlx5_ib_cmd_uar_alloc(struct mlx5_core_dev *dev, u32 *uarn, u16 uid)
> > +{
> > +	u32 out[MLX5_ST_SZ_DW(alloc_uar_out)] = {};
> > +	u32 in[MLX5_ST_SZ_DW(alloc_uar_in)] = {};
> > +	int err;
> > +
> > +	MLX5_SET(alloc_uar_in, in, opcode, MLX5_CMD_OP_ALLOC_UAR);
> > +	MLX5_SET(alloc_uar_in, in, uid, uid);
> > +	err = mlx5_cmd_exec_inout(dev, alloc_uar, in, out);
> > +	if (!err)
> > +		*uarn = MLX5_GET(alloc_uar_out, out, uar);
> 
> Success oriented flow:
> 
>  if (err)
>      return err;
>  *uarn = MLX5_GET(alloc_uar_out, out, uar);
>  return 0;
> 
> And why did we add entirely new functions instead of just adding a uid
> argument to the core ones? Or, why doesn't this delete the old core
> functions that look unused outside of IB anyhow?

We didn't want to add not-needed for mlx5_core uid field, the rest
comments are valid and I'm sorry that I missed them.

Thanks

> 
> Jason

Powered by blists - more mailing lists