linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Kees Cook <keescook@chromium.org>
Cc: Doug Ledford <dledford@redhat.com>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-api@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] RDMA/core: Use flexible array for mad data
Date: Tue, 22 Jun 2021 14:09:33 -0300	[thread overview]
Message-ID: <20210622170933.GA2449789@nvidia.com> (raw)
In-Reply-To: <20210616202615.1247242-1-keescook@chromium.org>

On Wed, Jun 16, 2021 at 01:26:15PM -0700, Kees Cook wrote:
> In preparation for FORTIFY_SOURCE performing compile-time and run-time
> field bounds checking for memcpy(), memmove(), and memset(), avoid
> intentionally read across neighboring array fields.
> 
> Without a flexible array, this looks like an attempt to perform a
> memcpy() read beyond the end of the packet->mad.data array:
> 
> drivers/infiniband/core/user_mad.c:
> 	memcpy(packet->msg->mad, packet->mad.data, IB_MGMT_MAD_HDR);
> 
> Switch from [0] to [] to use the appropriately handled type for trailing
> bytes.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  include/uapi/rdma/ib_user_mad.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

      reply	other threads:[~2021-06-22 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 20:26 [PATCH] RDMA/core: Use flexible array for mad data Kees Cook
2021-06-22 17:09 ` Jason Gunthorpe [this message]

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=20210622170933.GA2449789@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).