From: sashiko-bot@kernel.org
To: "Shawn Shao" <shawnq1@163.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] ext4: check fsnotify permissions before MOVE_EXT
Date: Fri, 04 Dec 2026 14:35:05 +0000 [thread overview]
Message-ID: <sashiko-outbox-249984@kernel.org> (raw)
In-Reply-To: <20261204140055.832696-1-shawnq1@163.com>
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 <shawnq1@163.com>
> 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 <shawnq1@163.com>
[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, unsigned int cmd, unsigned long arg)
> if (file_inode(filp)->i_sb != file_inode(fd_file(donor))->i_sb)
> return -EXDEV;
>
> + /* Extent movement reads the source and overwrites the donor. */
> + err = fsnotify_file_perm(filp, MAY_READ);
> + if (err)
> + return err;
> + err = 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=m) when CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y?
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.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204140055.832696-1-shawnq1@163.com?part=1
next prev parent reply other threads:[~2026-12-04 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 14:00 [PATCH] ext4: check fsnotify permissions before MOVE_EXT Shawn Shao
2026-12-04 14:35 ` sashiko-bot [this message]
2026-12-05 9:55 ` kernel test robot
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-249984@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shawnq1@163.com \
--cc=tytso@mit.edu \
/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.