public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Philippe Schenker <dev@pschenker.ch>
To: u-boot@lists.denx.de
Cc: stefan@embear.ch,
	Philippe Schenker <philippe.schenker@impulsing.ch>,
	"Andrew F. Davis" <afd@ti.com>, Tom Rini <trini@konsulko.com>
Subject: [PATCH v2 4/6] mach-k3: security: Propagate verified image addr
Date: Fri,  7 Nov 2025 14:01:03 +0100	[thread overview]
Message-ID: <20251107130216.3084134-5-dev@pschenker.ch> (raw)
In-Reply-To: <20251107130216.3084134-1-dev@pschenker.ch>

From: Philippe Schenker <philippe.schenker@impulsing.ch>

The ti_secure_image_check() function may relocate the image during
authentication, updating image_addr to point to the verified location.
The caller was not updated with this new address, causing it to
reference the original unverified location.

Update p_image with the verified image address after authentication
to ensure subsequent operations use the correct location.

Signed-off-by: Philippe Schenker <philippe.schenker@impulsing.ch>

---

Changes in v2:
- Fixed pointer cast warning by using uintptr_t intermediate cast. The
  direct cast from u64 to pointer caused a -Wint-to-pointer-cast warning
  on 32-bit ARM R5 targets. Using (uintptr_t) as intermediate cast is
  safer and architecture-aware, ensuring proper handling on both 32-bit
  and 64-bit targets.

 arch/arm/mach-k3/security.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-k3/security.c b/arch/arm/mach-k3/security.c
index 3468a370a455..c7017bba99ab 100644
--- a/arch/arm/mach-k3/security.c
+++ b/arch/arm/mach-k3/security.c
@@ -119,6 +119,8 @@ void ti_secure_image_post_process(void **p_image, size_t *p_size)
 	 */
 	*p_size = image_size;
 
+	*p_image = (void *)(uintptr_t)image_addr;
+
 	/*
 	 * Output notification of successful authentication to re-assure the
 	 * user that the secure code is being processed as expected. However
-- 
2.51.2


  parent reply	other threads:[~2025-11-07 13:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 13:00 [PATCH v2 0/6] remoteproc: k3-r5: Build fixes and security improvements Philippe Schenker
2025-11-07 13:01 ` [PATCH v2 1/6] arm: dts: k3-am642-evm: Remove duplicate node Philippe Schenker
2025-11-10  9:21   ` Anshul Dalal
2025-11-07 13:01 ` [PATCH v2 2/6] remoteproc: k3-r5: cast size to size_t Philippe Schenker
2025-11-07 15:24   ` Andrew Davis
2025-11-07 16:00     ` Philippe Schenker
2025-11-07 16:24       ` Andrew Davis
2025-11-07 13:01 ` [PATCH v2 3/6] soc: ti: pruss: Fix size ptr type in probe Philippe Schenker
2025-11-07 13:01 ` Philippe Schenker [this message]
2025-11-07 13:01 ` [PATCH v2 5/6] remoteproc: k3-r5: Use verified image address Philippe Schenker
2025-11-07 13:01 ` [PATCH v2 6/6] remoteproc: k3-r5: Implement is_running operation Philippe Schenker

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=20251107130216.3084134-5-dev@pschenker.ch \
    --to=dev@pschenker.ch \
    --cc=afd@ti.com \
    --cc=philippe.schenker@impulsing.ch \
    --cc=stefan@embear.ch \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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