Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marcel Hofmann" <marcel@hofmania.de>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH] remoteproc: imx_rproc: allow mappings ending at region boundary
Date: Wed, 26 Aug 2026 15:51:23 +0000	[thread overview]
Message-ID: <20260826155123.AEB731F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260826153838.19018-1-marcel@hofmania.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing overflow checks on `da + len` and `sys + len` allow a maliciously crafted ELF segment to bypass bounds validation, resulting in massive out-of-bounds kernel memory corruption.
--

commit d94c3c742cf1fcf451629ba1a51b1c180a0e9a41
Author: Marcel Hofmann <marcel.hofmann@ingenics-digital.com>

remoteproc: imx_rproc: allow mappings ending at region boundary

This commit updates the address bounds checking in imx_rproc_da_to_sys() and
imx_rproc_da_to_va() to include the exact region boundary. It allows ELF
segments that perfectly fill a mapped memory region to load successfully.

> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 745ce52cd8226..f3c7c2ff6713c 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -552,7 +552,7 @@ static int imx_rproc_da_to_sys(struct imx_rproc *priv, u64 da,
>  				continue;
>  		}
>  
> -		if (da >= att->da && da + len < att->da + att->size) {
> +		if (da >= att->da && da + len <= att->da + att->size) {

[Severity: High]
This is a pre-existing issue, but in imx_rproc_da_to_sys() does this bounds
check evaluate da + len without guarding against 64-bit integer overflow?

If a maliciously crafted ELF file provides a segment with a massive p_memsz,
could da + len wrap around to a small value? This might satisfy both
da >= att->da and da + len <= att->da + att->size, bypassing the bounds
validation and potentially causing a massive out-of-bounds memset() in kernel
memory during ELF loading.

[ ... ]

> @@ -585,7 +585,7 @@ static void *imx_rproc_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *i
>  		return NULL;
>  
>  	for (i = 0; i < IMX_RPROC_MEM_MAX; i++) {
> -		if (sys >= priv->mem[i].sys_addr && sys + len <
> +		if (sys >= priv->mem[i].sys_addr && sys + len <=
>  		    priv->mem[i].sys_addr +  priv->mem[i].size) {

[Severity: High]
This is also a pre-existing issue, but in imx_rproc_da_to_va() does this
secondary check similarly fail to catch the overflow?

Could the sys + len addition allow the bypassed bounds to be translated into
a valid kernel virtual address for the massive segment?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260826153838.19018-1-marcel@hofmania.de?part=1

      reply	other threads:[~2026-08-26 15:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 15:38 [PATCH] remoteproc: imx_rproc: allow mappings ending at region boundary Marcel Hofmann
2026-08-26 15:51 ` sashiko-bot [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=20260826155123.AEB731F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=marcel@hofmania.de \
    --cc=sashiko-reviews@lists.linux.dev \
    /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