From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796394905; b=aqgpb3gvK7DILKxtNcJci8GxfMyD9S/LJQUe7nWQ2VOHTPSh16o3p9yoSdU0xmy1N2K3 cSr0FxPkgj0HOTNZ563FMErlmK+aZVla9f57qNqpPJNoCN020z/I2Uh4ujj+uQQu0MUFC y0S7oqHij67K3DfFqRkfAQrzTvzvEm5BEQcL6a40ZQGA7JXYEW6DqXxfxy1St9vq8p2xb Oo1iEZM9e4EFr0Eh/wrCX/3AalcgsxYlVP5XcCWToV0da4/22nXT3vj2Xm4r2sb74HruW lKMDbpq1Za+9DpCNa8N4d0LXFVL+Tq+xbZhicsztltDQHCb4LPpCKdf1ehw/FeCdqpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394905; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=fQ4xq5ibtZP60mRWbcv8teZny6qIQXFTMlb+S7csANg=; b=KclF5jZoFPhjCHwVIh423QA2kfeR6phyKNoNYCUGP5o+ezwNTmBImJNLv8447BN6w5xa LlYBCjNBFuLsni1RZJkYCWPiYaI/FUXMkyy37tbP4E5+NotIijqcGwJjn7tSJFKeK1kgk w67DXpAThi6agAZRDGwmec/a2IJMIru5UaHbn2yppX2b21yDZhYoSwyHGnoPvTX2JmSdx C7TjCi5ReyCVqjjWtwzSkzlVWvzaR0Dv87/ekYIs91/C5LPKb1Wm8IQe+L4w9NG83oH6q mJkM3NgP0VoavYNQpRkrAkq+jfcqSrwHur5bMzaagHHU8B7xeYCFuJgbtxWrB5CsDNw== 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="GA1nwrM/"; 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 DADE1606A322 for ; Fri, 4 Dec 2026 14:35:05 +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=GA1nwrM/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67A0F1F000C2; Fri, 4 Dec 2026 14:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796394905; bh=fQ4xq5ibtZP60mRWbcv8teZny6qIQXFTMlb+S7csANg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=GA1nwrM/tfiWbpgajQoU/7QbVOF0U5HnQ8OX9l6qLnBQWcJXsvU9sPUrFgknjl8JW usoSkhXSSaVc2hZrOMmOUGhsgZ1gBW4Xw+m8MoZBUmXx6rE2J/qSSxQkk05ZZgTvDr qfnzyH23JfDO6oIeDmRHL9Y0WVQBbuX2A1timx40yzBlP8qBqPzjMrFNPQefCqSE/y pDc92OX6zmDsveq4PaW/0av3haxkjq0ZQypDdZuloPwTL3flaw/A1OFY3tWAYIEqdS sOz+QayZasq+fM7Q3kzOzp8wRn7dqn3w/Jn0UAl0rJMHZe+sztQMVrJpqP6exMVUCd 29TsuPGao6k9A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] ext4: check fsnotify permissions before MOVE_EXT Reply-To: sashiko-reviews@lists.linux.dev To: "Shawn Shao" Cc: linux-ext4@vger.kernel.org, tytso@mit.edu In-Reply-To: <20261204140055.832696-1-shawnq1@163.com> References: <20261204140055.832696-1-shawnq1@163.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 14:35:05 +0000 X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] ext4: modular build fails on unexported fsnotify_pre_content() - [Medium] ext4: EXT4_IOC_MOVE_EXT calls fsnotify_file_perm() without range info - [Low] ext4: Fixes trailer cites f156524e5d72 instead of 5121711eb8db -- commit 2e710f64b8de9e73123cefa3e48b3150f38ed001 Author: Shawn Shao > ext4: check fsnotify permissions before MOVE_EXT > > The EXT4_IOC_MOVE_EXT ioctl manipulates file extents directly without > running the permission hooks used by regular reads and writes. Check > read permission on the source and write permission on the donor before > moving extents. > > Built and tested on x86-64 QEMU against the base revision. > > Fixes: f156524e5d72 ("fsnotify: introduce pre-content permission events") > Signed-off-by: Shawn Shao [Severity: Low] Should the Fixes tag point to 5121711eb8db ("fs: enable pre-content events on supported file systems") instead of f156524e5d72 ("fsnotify: introduce pre-content permission events")? Commit f156524e5d72 only added the generic infrastructure, while 5121711eb8db is what enabled SB_I_ALLOW_HSM on ext4 in __ext4_fill_super(). > diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c > index 83630cd40712c..be272853d1fa7 100644 > --- a/fs/ext4/ioctl.c > +++ b/fs/ext4/ioctl.c [ ... ] > @@ -1687,6 +1688,14 @@ static long __ext4_ioctl(struct file *filp, unsign= ed int cmd, unsigned long arg) > if (file_inode(filp)->i_sb !=3D file_inode(fd_file(donor))->i_sb) > return -EXDEV; > =20 > + /* Extent movement reads the source and overwrites the donor. */ > + err =3D fsnotify_file_perm(filp, MAY_READ); > + if (err) > + return err; > + err =3D fsnotify_file_perm(fd_file(donor), MAY_WRITE); > + if (err) > + return err; [Severity: High] Does calling fsnotify_file_perm() here break modular ext4 builds (CONFIG_EXT4_FS=3Dm) when CONFIG_FANOTIFY_ACCESS_PERMISSIONS=3Dy? fsnotify_file_perm() -> fsnotify_file_area_perm() is static inline and emits a direct call to fsnotify_pre_content(), which is not exported in fs/notify/fsnotify.c, causing modpost to fail on ext4.ko. Using the exported remap_verify_area() helper or exporting fsnotify_pre_content() would fix modular builds. [Severity: Medium] Should this pass the requested byte range via remap_verify_area() or fsnotify_file_area_perm() instead of fsnotify_file_perm()? fsnotify_file_perm() passes a NULL position to fsnotify_pre_content(), omitting FAN_EVENT_INFO_TYPE_RANGE from FAN_PRE_ACCESS events. On ext4 with HSM watchers, that forces full-file hydration on bounded moves even though me.orig_start, me.donor_start, and me.len are already known here. Calling the hook before validating the range also lets invalid or zero-length requests trigger blocking permission events before mext_check_adjust_range() rejects them with -EINVAL. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204140055.8326= 96-1-shawnq1@163.com?part=3D1