From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: "Cen Zhang (Microsoft Security FORGE Labs)"
<cenzhang@linux.microsoft.com>
Cc: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>, <AutonomousCodeSecurity@microsoft.com>,
<xmei5@asu.edu>, <tgopinath@linux.microsoft.com>,
<kys@microsoft.com>
Subject: Re: [PATCH] fs/ntfs3: fix slab-out-of-bounds write in ntfs_create_inode
Date: Mon, 23 Nov 2026 12:41:56 +0100 [thread overview]
Message-ID: <4c3c3e35-81b7-4879-bc7f-e1a5437b816a@paragon-software.com> (raw)
In-Reply-To: <20260901175834.8557-1-cenzhang@linux.microsoft.com>
On 9/1/26 19:58, Cen Zhang (Microsoft Security FORGE Labs) wrote:
> ntfs_create_inode() sizes the non-resident reparse run list as
> record_size - offset - SIZEOF_NONRESIDENT, then sets the attribute size
> to SIZEOF_NONRESIDENT + ALIGN(run_pack(), 8). It does not reserve space
> for the trailing ATTR_END, so a maximally packed run list places that
> 4-byte sentinel just past the allocated MFT record.
>
> BUG: KASAN: slab-out-of-bounds in ntfs_create_inode+0x4390/0x5220
> ntfs_create_inode+0x4390/0x5220 fs/ntfs3/inode.c:1796
> ntfs_symlink+0x108/0x170 fs/ntfs3/namei.c:224
> vfs_symlink+0x137/0x420
> filename_symlinkat+0x326/0x460
> __x64_sys_symlink+0x79/0xb0
>
> After packing the run list, check that the 8-byte ATTR_END slot still
> fits in the MFT record. Return -EINVAL if the aligned run list would
> place it past the buffer.
>
> Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
> Reported-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
> Cc: AutonomousCodeSecurity@microsoft.com
> Cc: stable@vger.kernel.org
> Signed-off-by: Cen Zhang (Microsoft Security FORGE Labs) <cenzhang@linux.microsoft.com>
> ---
> fs/ntfs3/inode.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
> index 56b4f6469a28..d6e4b4b3154d 100644
> --- a/fs/ntfs3/inode.c
> +++ b/fs/ntfs3/inode.c
> @@ -1769,6 +1769,11 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
> }
>
> asize = SIZEOF_NONRESIDENT + ALIGN(err, 8);
> + if (asize + PtrOffset(rec, attr) + 8 >
> + sbi->record_size) {
> + err = -EINVAL;
> + goto out5;
> + }
> /* Write non resident data. */
> err = ntfs_sb_write_run(sbi, &ni->file.run, 0, rp,
> nsize, 0);
>
> base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
> --
> 2.55.0
Hello,
Your patch is applied, thanks.
Regards,
Konstantin
prev parent reply other threads:[~2026-11-23 11:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 17:58 Cen Zhang (Microsoft Security FORGE Labs)
2026-11-23 11:41 ` Konstantin Komarov [this message]
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=4c3c3e35-81b7-4879-bc7f-e1a5437b816a@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=AutonomousCodeSecurity@microsoft.com \
--cc=cenzhang@linux.microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=tgopinath@linux.microsoft.com \
--cc=xmei5@asu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®