From: sashiko-bot@kernel.org
To: "Amit Prasad" <amit@modal.com>
Cc: nvdimm@lists.linux.dev
Subject: Re: [PATCH 2/2] fsdax: iterate over short dax_direct_access() ranges
Date: Tue, 01 Dec 2026 18:00:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-243923@kernel.org> (raw)
In-Reply-To: <20261201174324.5991-3-amit@modal.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] dax: out-of-bounds read in dax_range_compare_iter() [1]
--
commit 40d736e05a044ff4e08b902dc2515a07d60818ac
Author: Amit Prasad <amit@modal.com>
fsdax: iterate over short dax_direct_access() ranges
This commit adds dax_iomap_kaddr() and dax_iomap_copy_from() so that
copy-on-write, unshare, and range comparison iterate over short
dax_direct_access() mappings instead of failing when a range crosses a
device mapping boundary.
> diff --git a/fs/dax.c b/fs/dax.c
> index 0bb029e6a1ebb..6da37f952e6a6 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
[ ... ]
> @@ -2194,7 +2244,7 @@ static int dax_range_compare_iter(struct iomap_iter *it_src,
> const struct iomap *dmap = &it_dest->iomap;
> loff_t pos1 = it_src->pos, pos2 = it_dest->pos;
> void *saddr, *daddr;
> - size_t size1, size2;
> + long n;
> int id, ret;
>
> len = min(len, min(smap->length, dmap->length));
> @@ -2210,18 +2260,17 @@ static int dax_range_compare_iter(struct iomap_iter *it_src,
> }
>
> id = dax_read_lock();
> - size1 = ALIGN(len + offset_in_page(pos1), PAGE_SIZE);
> - ret = dax_iomap_direct_access(smap, pos1, size1, &saddr, NULL);
> - if (ret < 0)
> + n = dax_iomap_kaddr(smap, pos1, len, &saddr);
> + if (n < 0)
> goto out_unlock;
>
> - size2 = ALIGN(len + offset_in_page(pos2), PAGE_SIZE);
> - ret = dax_iomap_direct_access(dmap, pos2, size2, &daddr, NULL);
> - if (ret < 0)
> + /* Compare what both devices map; the iterators map the rest. */
> + n = dax_iomap_kaddr(dmap, pos2, n, &daddr);
> + if (n < 0)
> goto out_unlock;
>
> - *same = !memcmp(saddr + offset_in_page(pos1),
> - daddr + offset_in_page(pos2), len);
> + len = n;
> + *same = !memcmp(saddr, daddr, len);
[Severity: Critical]
This problem wasn't introduced by this patch, but can [1] clamping
len to min(smap->length, dmap->length) instead of the remaining bytes in
each extent cause memcmp() to read past the end of the extent?
When pos1 or pos2 starts partway into an extent (either on the initial
dedupe offset or after a partial advance), the remaining extent lengths
are iomap_length(it_src) and iomap_length(it_dest) (i.e.,
smap->offset + smap->length - pos1). Using the full smap->length and
dmap->length lets dax_iomap_kaddr() and memcmp() read beyond the extent
boundary, and also triggers the count > iomap_length(iter) warning in
iomap_iter_advance().
[1] https://sashiko.dev/#/bug/linux-39a2e02f-3d99-4256-9571-cb0e67941bdc
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201174324.5991-1-amit@modal.com?part=2
next prev parent reply other threads:[~2026-12-01 18:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 17:43 [PATCH 0/2] fsdax: handle short dax_direct_access() ranges Amit Prasad
2026-12-01 17:43 ` [PATCH 1/2] fsdax: check the mapped length for all dax_iomap_direct_access() callers Amit Prasad
2026-12-01 17:43 ` [PATCH 2/2] fsdax: iterate over short dax_direct_access() ranges Amit Prasad
2026-12-01 18:00 ` sashiko-bot [this message]
2026-12-01 18:37 ` Amit Prasad
2026-12-01 18:33 ` [PATCH 0/2] fsdax: handle " Amit Prasad
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=sashiko-outbox-243923@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amit@modal.com \
--cc=nvdimm@lists.linux.dev \
--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.