mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Bruno Produit <bruno.produit@trailofbits.com>
Cc: <ntfs3@lists.linux.dev>, Kyle Zeng <kylebot@openai.com>,
	<linux-kernel@vger.kernel.org>,
	Dominik Czarnota <dominik.czarnota@trailofbits.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH] fs/ntfs3: Fix out-of-bounds write in resident insert range
Date: Mon, 23 Nov 2026 13:18:32 +0100	[thread overview]
Message-ID: <f831dbca-286b-4b33-9f37-69bc9388a026@paragon-software.com> (raw)
In-Reply-To: <20260922114018.1829807-1-bruno.produit@trailofbits.com>

On 9/22/26 13:40, Bruno Produit wrote:

> From: Kyle Zeng <kylebot@openai.com>
>
> attr_insert_range() grows a resident value before shifting data at and
> after the insertion offset.  The current copy instead moves @bytes bytes
> from the start of the value, so both its source offset and length are
> wrong.
>
> For example, inserting 2048 bytes at offset 512 in a 513-byte resident
> value copies 2048 bytes to data + 2048 even though the tail is only one
> byte long.  The resulting destination can extend beyond the MFT record
> allocation.
>
> Move the original tail from the insertion offset to its new location,
> then clear the inserted range.
>
> Fixes: aa30eccb24e5 ("fs/ntfs3: Fallocate (FALLOC_FL_INSERT_RANGE) implementation")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
> Signed-off-by: Bruno Produit <bruno.produit@trailofbits.com>
> ---
>   fs/ntfs3/attrib.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
> index b1c315206..4bd758133 100644
> --- a/fs/ntfs3/attrib.c
> +++ b/fs/ntfs3/attrib.c
> @@ -2610,8 +2610,9 @@ int attr_insert_range(struct ntfs_inode *ni, u64 vbo, u64 bytes)
>                          char *data = Add2Ptr(attr_b,
>                                               le16_to_cpu(attr_b->res.data_off));
>
> -                       memmove(data + bytes, data, bytes);
> -                       memset(data, 0, bytes);
> +                       memmove(data + vbo + bytes, data + vbo,
> +                               data_size - vbo);
> +                       memset(data + vbo, 0, bytes);
>                          goto done;
>                  }
>
> --
> 2.53.0

Hello,

Thanks for the patch. Alon Shakevsky previously submitted the same
fix in "ntfs3: fix INSERT_RANGE for resident data".

Regards,
Konstantin


      reply	other threads:[~2026-11-23 12:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 11:40 Bruno Produit
2026-11-23 12:18 ` 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=f831dbca-286b-4b33-9f37-69bc9388a026@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=bruno.produit@trailofbits.com \
    --cc=dominik.czarnota@trailofbits.com \
    --cc=kylebot@openai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /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®