From: Michal Simek <michal.simek@amd.com>
To: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Tom Rini <trini@konsulko.com>,
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 13:18:44 +0200 [thread overview]
Message-ID: <6e5c61cc-5d90-4d2d-bcb2-d854bdb0db1f@amd.com> (raw)
In-Reply-To: <CADg8p95DQvRAXdon_Hx+mYst-u9HTfprQ=6jwgSQThWX=GDSZg@mail.gmail.com>
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.
>> We find the issue out on system which has more dynamic behavior that spi pytest
>> read the whole memory and rewrite TF-A.
>>
>> And currently we are in situation where some commands are checking reserved
>> location and some of them not.
>
> Like you mention in another email, there are instances where we have
> commands which are loading images to memory, but are not considering
> the lmb reservations. These should be fixed, similar to what this
> patch is attempting. Maybe we need a common function where the load
> address gets checked with the lmb module, similar to
> fs_read_lmb_check(), and then have this called from the various
> commands?
yes, it make sense not to have 4 different functions in different drivers but
call only one. Definitely nice to have it on the top of your LMB series to be
able to use it in nand cmd for example.
Thanks,
Michal
next prev parent reply other threads:[~2024-08-08 11:19 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 [this message]
2024-08-08 15:46 ` Tom Rini
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=6e5c61cc-5d90-4d2d-bcb2-d854bdb0db1f@amd.com \
--to=michal.simek@amd.com \
--cc=d-gole@ti.com \
--cc=git@amd.com \
--cc=git@xilinx.com \
--cc=jagan@amarulasolutions.com \
--cc=n-francis@ti.com \
--cc=prasad.kummari@amd.com \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=trini@konsulko.com \
--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