All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: linux-rdma@vger.kernel.org, jgg@nvidia.com,
	Bob Pearson <rpearson@hpe.com>
Subject: Re: [PATCH 1/1] Address an issue with hardened user copy
Date: Wed, 12 Aug 2020 08:52:55 +0300	[thread overview]
Message-ID: <20200812055255.GI634816@unreal> (raw)
In-Reply-To: <20200811191457.6309-1-rpearson@hpe.com>

On Tue, Aug 11, 2020 at 02:14:57PM -0500, Bob Pearson wrote:
> by copying to user space from the stack instead of slab cache.
> This affects the rdma_rxe driver causing a warning once per boot.
> The alternative is to ifigure out how to whitelist the xxx_qp struct

ifigure -> figure

> but this seems simple and clean.


We have multiple cases like this in the code, what is the error exactly?
And what is "hardened user copy"?

>
> ---

Signed-off-by is missing.

>  drivers/infiniband/core/uverbs_std_types_qp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/core/uverbs_std_types_qp.c b/drivers/infiniband/core/uverbs_std_types_qp.c
> index 3bf8dcdfe7eb..2f8b14003b95 100644
> --- a/drivers/infiniband/core/uverbs_std_types_qp.c
> +++ b/drivers/infiniband/core/uverbs_std_types_qp.c
> @@ -98,6 +98,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)(
>  	struct ib_device *device;
>  	u64 user_handle;
>  	int ret;
> +	int qp_num;
>
>  	ret = uverbs_copy_from_or_zero(&cap, attrs,
>  			       UVERBS_ATTR_CREATE_QP_CAP);
> @@ -293,9 +294,10 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)(
>  	if (ret)
>  		return ret;
>
> +	/* copy from stack to avoid whitelisting issues */
> +	qp_num = qp->qp_num;
>  	ret = uverbs_copy_to(attrs, UVERBS_ATTR_CREATE_QP_RESP_QP_NUM,
> -			     &qp->qp_num,
> -			     sizeof(qp->qp_num));
> +			     &qp_num, sizeof(qp_num));
>
>  	return ret;
>  err_put:
> --
> 2.25.1
>

  reply	other threads:[~2020-08-12  5:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11 19:14 [PATCH 1/1] Address an issue with hardened user copy Bob Pearson
2020-08-12  5:52 ` Leon Romanovsky [this message]
2020-08-13 14:24   ` Bob Pearson
2020-08-14 15:13   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200812055255.GI634816@unreal \
    --to=leon@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearson@hpe.com \
    --cc=rpearsonhpe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.