All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: pankaj.gupta@oss.nxp.com
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
	Frank.Li@kernel.org, robh@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v51 1/7] Documentation/firmware: add imx/se to other_interfaces
Date: Mon, 14 Sep 2026 14:27:53 +0000	[thread overview]
Message-ID: <20260914142754.70A2B1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260915-imx-se-if-v51-1-4a7dac612cb5@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Artificially intercepting a successfully completed firmware command to return `-EINTR` leads to firmware resource leaks and violates standard syscall semantics.
--

commit 08f44ced154dcd881139680cedb3ca1074757a26
Author: Pankaj Gupta <pankaj.gupta@nxp.com>

    Documentation/firmware: add imx/se to other_interfaces
    
    Documents i.MX SoC's Service layer and C_DEV driver for selected SoC(s)
    that contains the NXP hardware IP(s) for Secure Enclaves(se) like:
    - NXP EdgeLock Enclave on i.MX93 & i.MX8ULP

> diff --git a/Documentation/driver-api/firmware/other_interfaces.rst b/Documentation/driver-api/firmware/other_interfaces.rst
> index 06ac89adaafba..984ee3ecc8dc2 100644
> --- a/Documentation/driver-api/firmware/other_interfaces.rst
> +++ b/Documentation/driver-api/firmware/other_interfaces.rst

[ ... ]

> +      |            [fw_api_specific_ops()         |
> +      |             (is_cmd_interrupted=true):    |
> +      |             for SESSION_OPEN: record      |
> +      |             handle, close session via     |
> +      |             se_close_session(), clear;    |
> +      |             for STORAGE_OPEN: record      |
> +      |             handle, close storage via     |
> +      |             se_close_storage(), return 0] |
> +      |            err = -EINTR                   |
> +      |            (not -ERESTARTSYS:             |
> +      |             prevents VFS auto-restart)    |
> +      |<--ioctl -EINTR-----|                      |
> +      |                    |                      |
> +      | [signal handler runs; userspace decides   |
> +      |  whether to re-issue; FW handle tracked   |
> +      |  or cleaned up; no firmware resource leak]|

[Severity: High]
Does this behavior leak firmware resources for commands other than SESSION_OPEN
and STORAGE_OPEN?

If a non-fatal signal is delivered during the ioctl wait for operations like
ELE_MAC_OPEN_REQ, ele_msg_send_rcv() overrides the successful result with
-ERESTARTSYS.

Then se_ioctl_cmd_snd_rcv_rsp_handler() catches this, calls
fw_api_specific_ops(is_cmd_interrupted=true), and returns -EINTR.

However, fw_api_specific_ops() only implements rollback for session and
storage handles:

ele_fw_api.c:fw_api_specific_ops() {
    ...
    switch (header->command) {
    case ELE_SESSION_OPEN_REQ:
        ...
    case ELE_STORAGE_OPEN_REQ:
        ...
    }
}

This silently ignores and leaks all other handle-creating operations.

Because -EINTR is returned, the response containing the handle is not copied
to userspace. This permanently leaks the resource in the secure enclave, and
could allow unprivileged users to cause a denial of service by sending
signals to their own process during ioctls.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915-imx-se-if-v51-0-4a7dac612cb5@nxp.com?part=1

  reply	other threads:[~2026-09-14 14:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 19:39 [PATCH v51 0/7] firmware: imx: driver for NXP secure-enclave pankaj.gupta
2026-09-14 19:39 ` [PATCH v51 1/7] Documentation/firmware: add imx/se to other_interfaces pankaj.gupta
2026-09-14 14:27   ` sashiko-bot [this message]
2026-09-14 19:39 ` [PATCH v51 2/7] dt-bindings: arm: fsl: add imx-se-fw binding doc pankaj.gupta
2026-09-14 19:40 ` [PATCH v51 3/7] firmware: imx: add driver for NXP EdgeLock Enclave pankaj.gupta
2026-09-14 19:40 ` [PATCH v51 4/7] firmware: imx: device context dedicated to priv pankaj.gupta
2026-09-14 19:40 ` [PATCH v51 5/7] firmware: imx: adds miscdev pankaj.gupta
2026-09-14 15:09   ` sashiko-bot
2026-09-14 17:34     ` Pankaj Gupta (OSS)
2026-09-16 13:16   ` Arnd Bergmann
2026-09-16 14:39     ` Frank Li
2026-10-05 14:28       ` Frieder Schrempf
2026-09-24 16:14     ` [EXT] " Pankaj Gupta
2026-09-14 19:40 ` [PATCH v51 6/7] arm64: dts: imx8ulp: add secure enclave node pankaj.gupta
2026-09-14 15:17   ` sashiko-bot
2026-09-14 19:40 ` [PATCH v51 7/7] arm64: dts: imx8ulp: add reserved memory for EdgeLock Enclave pankaj.gupta

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=20260914142754.70A2B1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.