From: Frank Li <Frank.li@oss.nxp.com>
To: "Pankaj Gupta (OSS)" <pankaj.gupta@oss.nxp.com>
Cc: "sashiko-reviews@lists.linux.dev"
<sashiko-reviews@lists.linux.dev>,
"robh@kernel.org" <robh@kernel.org>,
"imx@lists.linux.dev" <imx@lists.linux.dev>,
"Frank.Li@kernel.org" <Frank.Li@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v36 5/7] firmware: imx: adds miscdev
Date: Tue, 18 Aug 2026 13:21:32 -0500 [thread overview]
Message-ID: <aoSirE2DdlF39Jpx@SMW015318> (raw)
In-Reply-To: <GV2PR04MB122715C58E176CB3BAF1E77AF95A62@GV2PR04MB12271.eurprd04.prod.outlook.com>
On Tue, Aug 18, 2026 at 09:04:59AM +0000, Pankaj Gupta (OSS) wrote:
> > > > > --- a/drivers/firmware/imx/ele_common.c
> > > > > +++ b/drivers/firmware/imx/ele_common.c
> > > > > @@ -101,15 +101,15 @@ int se_val_cmd_addrs(struct se_if_device_ctx
> > > > > *dev_ctx, struct se_api_msg *msg,
> > > > >
> > > > > addr = msg->data[f->lsb_idx];
> > > > > if (f->has_msb)
> > > > > addr |= (u64)msg->data[f->msb_idx] << 32;
> > > > >
> > > > > /* Zero marks an absent optional buffer. */
> > > > > if (!addr)
> > > > > continue;
> > > > >
> > > > > if (addr < base || addr >= end)
> > > > > return -EACCES;
> > > > >
> > > > > /*
> > > > > * When the message also carries this buffer's length,
> > > > > the
> > > > whole
> > > > > * buffer [addr, addr + len) must fit inside the
> > > > > window, not
> > > > just
> > > >
> > > > [Severity: High]
> > > > Does this code prevent firmware from reading outside the shared
> > > > memory window when the command lacks an explicit buffer size?
> > > >
> > > > For commands like ELE_OEM_AUTH_CONTAINER_REQ that use
> > > > SE_CMD_ADDR_NO_SIZE with no buf_size, only the start address is
> > > > checked against the bounds. If a caller provides a start address at
> > > > the very end of the window (e.g., end - 1), could the firmware read
> > > > the payload out-of-bounds into adjacent physical memory?
> > >
> > > - Not a bug - by design.
> > > - The existing comment explicitly documents the rationale:
> > > -- this is a read-only input buffer
> > > --- (firmware copies the container header into its own internal memory
> > for authentication; no DMA write-back through this address).
> > > -- A rogue caller can at most cause firmware to read within the shared-
> > memory window it already owns.
> > > - Output buffers must be fully bounded;
> > > - Input-only buffers are safe with addr-only checks.
> >
> > Why? at lease addr should include payload size?
> >
> > Frank
>
> Payload size is encoded inside the OEM Authentication Container itself.
> For ELE_OEM_AUTH_CONTAINER_REQ, the API only passes the start address of the container to firmware.
>
> The kernel cannot validate the full container size because determining the actual payload size requires parsing the container header, and that header is interpreted by firmware using information and keys that are not available outside the secure firmware.
please wrap you reply below 80/100 chars each line.
>
> Therefore, for this command, only the container start address is validated against the shared-memory region.
> The firmware then reads and processes the container contents as part of the authentication flow.
>
> Also note that this is a read-only input buffer.
> Firmware does not perform any write-back through this address.
> A malicious caller can only provide invalid input data for authentication,
> which would cause the authentication operation to fail.
> It does not provide a mechanism for arbitrary memory corruption or privilege escalation from the kernel side.
>
> The trust model for this command assumes that the firmware is responsible for validating and parsing the container format after receiving the start address. Since the container length is not available to the kernel, enforcing an addr + size check in the driver is not possible for this request type. Any bounds validation based on the authenticated container structure must therefore be performed by the firmware itself.
You can provide comments to explain situation.
Frank
>
> Regards
> Pankaj
>
> NXP Confidential
next prev parent reply other threads:[~2026-08-18 18:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 14:05 [PATCH v36 0/7] firmware: imx: driver for NXP secure-enclave Pankaj Gupta via B4 Relay
2026-08-17 14:05 ` [PATCH v36 1/7] Documentation/firmware: add imx/se to other_interfaces Pankaj Gupta via B4 Relay
2026-08-17 8:39 ` sashiko-bot
2026-08-17 14:06 ` [PATCH v36 2/7] dt-bindings: arm: fsl: add imx-se-fw binding doc Pankaj Gupta via B4 Relay
2026-08-17 14:06 ` [PATCH v36 3/7] firmware: imx: add driver for NXP EdgeLock Enclave Pankaj Gupta via B4 Relay
2026-08-17 8:48 ` sashiko-bot
2026-08-17 18:40 ` Frank Li
2026-08-18 8:45 ` Pankaj Gupta (OSS)
2026-08-18 20:17 ` Frank Li
2026-08-17 14:06 ` [PATCH v36 4/7] firmware: imx: device context dedicated to priv Pankaj Gupta via B4 Relay
2026-08-17 14:06 ` [PATCH v36 5/7] firmware: imx: adds miscdev Pankaj Gupta via B4 Relay
2026-08-17 8:49 ` sashiko-bot
2026-08-17 18:03 ` Pankaj Gupta (OSS)
2026-08-17 18:37 ` Frank Li
2026-08-18 9:04 ` Pankaj Gupta (OSS)
2026-08-18 18:21 ` Frank Li [this message]
2026-08-17 14:06 ` [PATCH v36 6/7] arm64: dts: imx8ulp: add secure enclave node Pankaj Gupta via B4 Relay
2026-08-17 8:43 ` sashiko-bot
2026-08-17 14:06 ` [PATCH v36 7/7] arm64: dts: imx8ulp: add reserved memory for EdgeLock Enclave Pankaj Gupta via B4 Relay
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=aoSirE2DdlF39Jpx@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=pankaj.gupta@oss.nxp.com \
--cc=robh@kernel.org \
--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