U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Michal Simek <michal.simek@amd.com>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>,
	Prasad Kummari <prasad.kummari@amd.com>,
	u-boot@lists.denx.de, git@amd.com, venkatesh.abbarapu@amd.com,
	git@xilinx.com, jagan@amarulasolutions.com, n-francis@ti.com,
	d-gole@ti.com, Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH] cmd: sf: prevent overwriting the reserved memory
Date: Thu, 8 Aug 2024 09:46:58 -0600	[thread overview]
Message-ID: <20240808154658.GN1626301@bill-the-cat> (raw)
In-Reply-To: <6e5c61cc-5d90-4d2d-bcb2-d854bdb0db1f@amd.com>

[-- Attachment #1: Type: text/plain, Size: 3033 bytes --]

On Thu, Aug 08, 2024 at 01:18:44PM +0200, Michal Simek wrote:
> 
> 
> On 8/8/24 08:22, Sughosh Ganu wrote:
> > On Thu, 8 Aug 2024 at 11:05, Michal Simek <michal.simek@amd.com> wrote:
> > > 
> > > 
> > > 
> > > On 8/7/24 23:12, Tom Rini wrote:
> > > > On Tue, Aug 06, 2024 at 05:37:00PM +0530, Prasad Kummari wrote:
> > > > 
> > > > > Added LMB API to prevent SF command from overwriting reserved
> > > > > memory areas. The current SPI code does not use LMB APIs for
> > > > > loading data into memory addresses. To resolve this, LMB APIs
> > > > > were added to check the load address of an SF command and ensure it
> > > > > does not overwrite reserved memory addresses. Similar checks are
> > > > > used in TFTP, serial load, and boot code to prevent overwriting
> > > > > reserved memory.
> > > > > 
> > > > > Signed-off-by: Prasad Kummari <prasad.kummari@amd.com>
> > > > 
> > > > This is a much more generic issue that should be looked in to with the
> > > > LMB rewrite that Sughosh is working on.
> > > 
> > > yes. And is it going to be the part of his series?
> > > I expect that if he accepts this will be done on the top of it and there is
> > > likely no reason to wait.
> > 
> > This change would be needed, but in a different form. The patch, since
> > based on the current master branch, is assuming a local lmb memory
> > map. My series is doing away with that, and so we will no longer have
> > the lmb_init_and_reserve() API, for example. I would suggest that the
> > patch be put out either on top of my patches, or ideally, once the lmb
> > patches get merged.
> 
> I care that we can't overwrite reserved memory by any of load commands.
> Better to be fixed earlier rather than later but up to Tom to decide.
> From my perspective this is incorrect behavior which is fixing issue and
> likely this can go to 2024.10 version.
> Your LMB series is likely going to target 2025.01.

So, from my point of view, this is a longstanding issue that I get why
people are concerned, but I think it's missing a bigger point. For
network loads, OK, no one needs physical access to do something
malicious, so yes, it's important we check there every time. For
filesystem loads? There's far far too many production devices using SD
cards, so yes, a malicious actor needs physical access, but not much.
For flash (SPI or NAND), at that point why doesn't the malicious actor
just use "mw" instead? The device is in their position if they're able
to hook up probes/etc.

So my current thought process is that yes, fixing SPI and NAND and all
of the other forms of reading (outside of "cp") need to be fixed, as a
follow-up series to what Sughosh is doing. And then reminding people
that CMD_MEMORY is dangerous and perhaps think about splitting mw/etc
out from "cmp/base/loop" so that CMD_MEMORY can be disabled for boards
that want a more secure feel.

I'm open to being convinced I'm wrong and this is a serious problem to
address now, not later, however.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2024-08-08 15:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 12:07 [PATCH] cmd: sf: prevent overwriting the reserved memory Prasad Kummari
2024-08-06 21:50 ` Simon Glass
2024-08-07  5:05   ` Kummari, Prasad
2024-08-07 14:36     ` Simon Glass
2024-08-07 14:46       ` Kummari, Prasad
2024-08-07 20:53         ` Simon Glass
2024-08-08  5:31       ` Michal Simek
2024-08-08 14:28         ` Simon Glass
2024-08-09  5:39           ` Michal Simek
2024-08-09 14:44             ` Simon Glass
2024-08-09 14:47               ` Michal Simek
2024-08-09 15:58                 ` Simon Glass
2024-08-26  8:48                   ` Michal Simek
2024-09-01 20:10                     ` Simon Glass
2024-08-07 21:12 ` Tom Rini
2024-08-08  5:35   ` Michal Simek
2024-08-08  6:22     ` Sughosh Ganu
2024-08-08 11:18       ` Michal Simek
2024-08-08 15:46         ` Tom Rini [this message]
2024-08-09  5:41           ` Michal Simek

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=20240808154658.GN1626301@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=d-gole@ti.com \
    --cc=git@amd.com \
    --cc=git@xilinx.com \
    --cc=jagan@amarulasolutions.com \
    --cc=michal.simek@amd.com \
    --cc=n-francis@ti.com \
    --cc=prasad.kummari@amd.com \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=venkatesh.abbarapu@amd.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