From: sashiko-bot@kernel.org
To: "Richard Cheng" <icheng@nvidia.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v6 2/7] cxl/region: Scan all partitions for unmapped poison
Date: Wed, 26 Aug 2026 01:57:43 +0000 [thread overview]
Message-ID: <20260826015743.6E2B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260826014508.9989-3-icheng@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing bounds check on hardware-supplied `po->count` in `cxl_mem_get_poison` leads to out-of-bounds read of kernel memory.
--
commit f52d52e430dd176144d958a0ce4c3eb954ee8a23
Author: Richard Cheng <icheng@nvidia.com>
cxl/region: Scan all partitions for unmapped poison
cxl_get_poison_unmapped() sweeps the unmapped tail of each partition
from ctx->part onward. A fully-mapped partition has no unmapped tail,
it's a normal per-partition state, but the loop treated it with break,
aborting the whole sweep and silently skipping unmapped poison in all
later partition. Use continue so a fully-mapped partition is skipped and
later partitions are still scanned.
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 27e63e6dab7c8..b03f30c04d350 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2928,7 +2928,7 @@ static int cxl_get_poison_unmapped(struct cxl_memdev *cxlmd,
> offset = res->start;
> length = res->end - offset + 1;
> if (!length)
> - break;
> + continue;
> rc = cxl_mem_get_poison(cxlmd, offset, length, NULL);
[Severity: High]
This is a pre-existing issue, but I noticed a potential out-of-bounds read in
cxl_mem_get_poison() when it processes the hardware-supplied poison records.
Looking at cxl_mem_get_poison() in drivers/cxl/core/mbox.c, the function
uses an untrusted hardware value po->count in the loop:
for (int i = 0; i < le16_to_cpu(po->count); i++)
trace_cxl_poison(cxlmd, cxlr, &po->record[i],
po->flags, po->overflow_ts,
CXL_POISON_TRACE_LIST);
Could a buggy or malicious CXL device return an arbitrarily large po->count
value (for example 0xFFFF) that doesn't fit within the returned payload size
or the dynamically allocated mds->poison.list_out buffer?
If this happens, does this loop read past the end of the allocated memory,
potentially causing a kernel panic or information leak via ftrace?
> if (rc == -EFAULT && cxlds->part[i].mode == CXL_PARTMODE_RAM)
> continue;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260826014508.9989-1-icheng@nvidia.com?part=2
next prev parent reply other threads:[~2026-08-26 1:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 1:45 [PATCH v6 0/7] cxl: Sashiko bug fixes Richard Cheng
2026-08-26 1:45 ` [PATCH v6 1/7] cxl/features: Reject feature offset that overflows 16-bit field Richard Cheng
2026-08-27 22:55 ` Dave Jiang
2026-08-26 1:45 ` [PATCH v6 2/7] cxl/region: Scan all partitions for unmapped poison Richard Cheng
2026-08-26 1:57 ` sashiko-bot [this message]
2026-08-26 1:45 ` [PATCH v6 3/7] cxl/region: Don't leak tolerated RAM -EFAULT from unmapped poison scan Richard Cheng
2026-08-26 1:45 ` [PATCH v6 4/7] cxl/region: Start unmapped poison scan at the committed decoder boundary Richard Cheng
2026-08-28 17:56 ` Alison Schofield
2026-08-26 1:45 ` [PATCH v6 5/7] cxl/memdev: Don't overwrite the error from an earlier partition poison query Richard Cheng
2026-08-26 1:56 ` sashiko-bot
2026-08-26 1:45 ` [PATCH v6 6/7] cxl/region: Reject poison scan for decoder without a partition Richard Cheng
2026-08-26 1:57 ` sashiko-bot
2026-08-26 1:45 ` [PATCH v6 7/7] cxl/fwctl: Propagate feature RPC delivery errors Richard Cheng
2026-08-27 22:11 ` Dave Jiang
2026-08-28 8:38 ` Richard Cheng
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=20260826015743.6E2B01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=icheng@nvidia.com \
--cc=linux-cxl@vger.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.