linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Michal Simek <michal.simek@xilinx.com>
Cc: Rajan Vaja <rajanv@xilinx.com>,
	Rajan Vaja <rajan.vaja@xilinx.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Tejas Patel <tejas.patel@xilinx.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	git <git@xilinx.com>
Subject: Re: [PATCH] firmware: xilinx: fix out-of-bounds access
Date: Tue, 27 Oct 2020 14:32:09 +0100	[thread overview]
Message-ID: <CAK8P3a2nnnh81fUbrua5eG1km=2h0BzfiDGm-axYtkdoLGw60A@mail.gmail.com> (raw)
In-Reply-To: <459e03f1-2a9e-5bc4-4bf6-9a0ddf5c4a70@xilinx.com>

On Tue, Oct 27, 2020 at 10:53 AM Michal Simek <michal.simek@xilinx.com> wrote:
> On 26. 10. 20 16:54, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The zynqmp_pm_set_suspend_mode() and zynqmp_pm_get_trustzone_version()
> > functions pass values as api_id into zynqmp_pm_invoke_fn
> > that are beyond PM_API_MAX, resulting in an out-of-bounds access:
> >
> > drivers/firmware/xilinx/zynqmp.c: In function 'zynqmp_pm_set_suspend_mode':
> > drivers/firmware/xilinx/zynqmp.c:150:24: warning: array subscript 2562 is above array bounds of 'u32[64]' {aka 'unsigned int[64]'} [-Warray-bounds]
> >   150 |  if (zynqmp_pm_features[api_id] != PM_FEATURE_UNCHECKED)
> >       |      ~~~~~~~~~~~~~~~~~~^~~~~~~~
> > drivers/firmware/xilinx/zynqmp.c:28:12: note: while referencing 'zynqmp_pm_features'
> >    28 | static u32 zynqmp_pm_features[PM_API_MAX];
> >       |            ^~~~~~~~~~~~~~~~~~
>
> Which CONFIG option/tool is reporting this issue?

This is with gcc-10. Commit 44720996e2d7 ("gcc-10: disable
'array-bounds' warning for
now") turned off this warning globally, but most of the reported warnings got
fixed in the meantime. I'm trying to take care of the rest so we can enabled it
again.

You should be able to reproduce the problem by removing the cc-disable-warning
line from the top-level Makefile.

        Arnd

      parent reply	other threads:[~2020-10-27 13:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 15:54 [PATCH] firmware: xilinx: fix out-of-bounds access Arnd Bergmann
2020-10-27  9:53 ` Michal Simek
2020-10-27 12:23   ` Rajan Vaja
2020-10-27 12:27     ` Michal Simek
2020-10-27 12:38       ` Rajan Vaja
2020-10-27 13:32   ` Arnd Bergmann [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='CAK8P3a2nnnh81fUbrua5eG1km=2h0BzfiDGm-axYtkdoLGw60A@mail.gmail.com' \
    --to=arnd@kernel.org \
    --cc=git@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=rajan.vaja@xilinx.com \
    --cc=rajanv@xilinx.com \
    --cc=tejas.patel@xilinx.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 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).