From: sashiko-bot@kernel.org
To: MarkLee131 <kaixuanli0131@gmail.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] ext4: don't read past the UAPI struct in EXT4_IOC_GROUP_ADD
Date: Thu, 17 Sep 2026 15:30:00 +0000 [thread overview]
Message-ID: <20260917153002.AAFFF1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260917151949.415967-1-kaixuan.li@ntu.edu.sg>
> From: Kaixuan Li <kaixuanli0131@gmail.com>
>
> EXT4_IOC_GROUP_ADD casts the user pointer to struct ext4_new_group_input,
> its UAPI type, but sizes the copy by struct ext4_new_group_data, the
> internal type:
>
> struct ext4_new_group_data input;
>
> if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg,
> sizeof(input)))
>
> The UAPI struct is 40 bytes, the internal one 48. A caller that follows
> the UAPI and allocates 40 bytes gets 8 bytes read past its object, and the
> ioctl returns EFAULT when those bytes are unmapped. The internal struct
> has carried the extra fields since ext4 was split from ext3, so the copy
> has always over-read the UAPI object.
>
> The two extra fields are not used from this path: free_clusters_count is
> overwritten by verify_group_input(), and mdata_blocks is used only by
> ext4_resize_fs(), which builds its own group_data array. The compat path
> already copies the six UAPI fields individually; the native path does not.
>
> Copy the UAPI struct, then set the internal fields from it.
>
> Reproducible on v6.12.9 and v7.2.4 by placing a 40-byte struct at the end
> of a mapped page whose successor is unmapped: the ioctl returns EFAULT.
>
> Signed-off-by: Kaixuan Li <kaixuanli0131@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260917151949.415967-1-kaixuan.li@ntu.edu.sg?part=1
next prev parent reply other threads:[~2026-09-17 15:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 15:19 [PATCH] ext4: don't read past the UAPI struct in EXT4_IOC_GROUP_ADD MarkLee131
2026-09-17 15:30 ` sashiko-bot [this message]
2026-09-17 19:46 ` Andreas Dilger
-- strict thread matches above, loose matches on Subject: below --
2026-09-17 15:14 MarkLee131
2026-09-17 15:25 ` sashiko-bot
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=20260917153002.AAFFF1F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kaixuanli0131@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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.