Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796148009; b=slD9oQJyloWDoY+wEADL+ZzBitD9Ibro9yOtc5vFxRQScyaF8xi1YDOx3q+NP3veZEpM cOjr88CAJZeXvkaha+gUAermRKs5qbWTCfESTB0O/+aAI7sfjO223cGKLGTGWcXQ+maP2 e4pjrdddpZSuxr6ePMGXJsYQ3DXupjGV3WQG/TyIe+kZbQuU7Tz3koV33Fn3Tdv7Po0/u b6sRIeHyC7i5s8ggSsaN0NzkCvap/CB+iEYixvuwdXqPwlrc7bzrLog0V6jw8f4iT/HkF w9JKqNMMJh6zowX7LkABwA7Mirk+ZqR5XcSPQKxa0C1YkQXqKM4Sw82Q0wD5s6DZh7Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796148009; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ZbN/r+jP/cpGUYLyst/J2+SWmDg+h0aE6j6O9oHkyME=; b=zKKcBk2MaBivnTJzqBINRNzn3h5yiNrfiL/4/+vaJvZGfx0swQ2e25zIhzwkeiP2aRXn zP2BfECsjD0jDl88HTOTqKrzxZhyeRIoOKTOyV7OpmwPB5ig2vFTCHdHK7NUIFiy7pSEm jwtC2fY4qQlJSyZafgxF9s4u2jRnSfKLxV55rMV/dZdz2zDSsUPU4iGzxnMJwZcy8KlYq bFavjDRjURhHqC467AOMRlA2NI3v1XOD3UYBZd168mH0ud6rl3n52ha4tZs8h2cEELImK O1pEAWEcCPxVRUz8GVNGT9/SJ9W7jX60be5DF/p16incvUDPTVpGZBW8ZLPpHIoxQ5Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h60ewQ5k; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3043606A325 for ; Tue, 1 Dec 2026 18:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=h60ewQ5k Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38E9B1F00898; Tue, 1 Dec 2026 18:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796148009; bh=ZbN/r+jP/cpGUYLyst/J2+SWmDg+h0aE6j6O9oHkyME=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=h60ewQ5kFlsxm3h3ePQLi+D+85QJD5pgcJDrgZ83p7Yd9zoHr1O2mPabeifRK0xAj u/5nn6O0ZzDWyl3rCOLeRujtpFSQih10QAEmbRZQhKLH/9M9QveAPmZ1Pz7AVQS/74 ool7EPTqmCrAxEGUipFSC8B3sAu8cbFLxq62fEDJwwg16qP5ZQ5IgiDxGWn1oWGR5o +N8bAm11TbrZbLWIipogNsW60kCGSBjETnhRUPGr6gEt/Yc11dXiji2BbwK/nHvOAK iidesE1vsT+LEXIfIGzpts6EmDMVNGTlj6H6Fo5FeHHstokxVkVBfpyNA+J8tKR9nN O8Q7kMVB8U+4A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] fsdax: iterate over short dax_direct_access() ranges Reply-To: sashiko-reviews@lists.linux.dev To: "Amit Prasad" Cc: nvdimm@lists.linux.dev In-Reply-To: <20261201174324.5991-3-amit@modal.com> References: <20261201174324.5991-1-amit@modal.com> <20261201174324.5991-3-amit@modal.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 18:00:08 +0000 X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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 =3D &it_dest->iomap; > loff_t pos1 =3D it_src->pos, pos2 =3D it_dest->pos; > void *saddr, *daddr; > - size_t size1, size2; > + long n; > int id, ret; > =20 > len =3D min(len, min(smap->length, dmap->length)); > @@ -2210,18 +2260,17 @@ static int dax_range_compare_iter(struct iomap_it= er *it_src, > } > =20 > id =3D dax_read_lock(); > - size1 =3D ALIGN(len + offset_in_page(pos1), PAGE_SIZE); > - ret =3D dax_iomap_direct_access(smap, pos1, size1, &saddr, NULL); > - if (ret < 0) > + n =3D dax_iomap_kaddr(smap, pos1, len, &saddr); > + if (n < 0) > goto out_unlock; > =20 > - size2 =3D ALIGN(len + offset_in_page(pos2), PAGE_SIZE); > - ret =3D dax_iomap_direct_access(dmap, pos2, size2, &daddr, NULL); > - if (ret < 0) > + /* Compare what both devices map; the iterators map the rest. */ > + n =3D dax_iomap_kaddr(dmap, pos2, n, &daddr); > + if (n < 0) > goto out_unlock; > =20 > - *same =3D !memcmp(saddr + offset_in_page(pos1), > - daddr + offset_in_page(pos2), len); > + len =3D n; > + *same =3D !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 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201174324.5991= -1-amit@modal.com?part=3D2