From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Dmitry Antipov <dmantipov@yandex.ru>, Al Viro <viro@zeniv.linux.org.uk>
Cc: <ntfs3@lists.linux.dev>, <lvc-project@linuxtesting.org>,
<syzbot+905d785c4923bea2c1db@syzkaller.appspotmail.com>
Subject: Re: [PATCH] ntfs3: fix info-leak in ntfs_rename()
Date: Wed, 15 Jul 2026 19:03:16 +0200 [thread overview]
Message-ID: <c72be8fb-1ac5-497a-8d69-3619fbb8eff3@paragon-software.com> (raw)
In-Reply-To: <8c04f27f7572b4a5d675286de4878bf5b1612bfa.camel@yandex.ru>
On 6/10/26 13:12, Dmitry Antipov wrote:
> On Wed, 2026-06-10 at 00:08 +0100, Al Viro wrote:
>
>> From the syzkaller spew it would appear that data (filename converted
>> to unicode, AFAICS) somehow gets returned by read(2). If that is
>> accurate, I would suggest that the things are already FUBAR and zeroing
>> is not going to fix whatever underlying bug you've got there (metadata
>> bh left around after the corresponding on-disk block got freed and
>> reused for regular file, perhaps?)
> Hard to say about copy_to_user_iter(), but at least the first splat
> looks correct. At the end of fill_name_de(), data layout is:
>
> struct NTFS_DE *e = buf;
> ...
>
> |<- data_size + sizeof(struct NTFS_DE) ->|<- XXX ->|
> buf |-----------------------------------------------------------
> |<- ALIGN(data_size, 8) + sizeof(struct NTFS_DE) ->| ;; e->size
>
> If 'buf' was allocated with kmalloc(), XXX remains uninitialized and
> passed as such to memcpy() called from hdr_insert_de().
>
> So using kzalloc() for all buffers passed to fill_name_de() looks
> the simplest and most safe solution. OTOH if someone would have
> said that an overhead of PAGE_SIZE'd memset() is too large, more
> fine-granted solution is to memset() XXX only, i.e.:
>
> diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
> index b2af8f695e60..21e4a2a34389 100644
> --- a/fs/ntfs3/namei.c
> +++ b/fs/ntfs3/namei.c
> @@ -22,7 +22,7 @@ int fill_name_de(struct ntfs_sb_info *sbi, void *buf, const struct qstr *name,
> {
> int err;
> struct NTFS_DE *e = buf;
> - u16 data_size;
> + u16 data_size, real_size, aligned_size;
> struct ATTR_FILE_NAME *fname = (struct ATTR_FILE_NAME *)(e + 1);
>
> #ifndef CONFIG_NTFS3_64BIT_CLUSTER
> @@ -53,7 +53,12 @@ int fill_name_de(struct ntfs_sb_info *sbi, void *buf, const struct qstr *name,
> fname->type = FILE_NAME_POSIX;
> data_size = fname_full_size(fname);
>
> - e->size = cpu_to_le16(ALIGN(data_size, 8) + sizeof(struct NTFS_DE));
> + real_size = data_size + sizeof(struct NTFS_DE);
> + aligned_size = ALIGN(data_size, 8) + sizeof(struct NTFS_DE);
> + if (aligned_size > real_size)
> + memset((char *)buf + real_size, 0, aligned_size - real_size);
> +
> + e->size = cpu_to_le16(aligned_size);
> e->key_size = cpu_to_le16(data_size);
> e->flags = 0;
> e->res = 0;
>
> Dmitry
Hello,
Very sorry for the delay.
The patch is applied, thank you.
Regards,
Konstantin
prev parent reply other threads:[~2026-07-15 17:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 12:36 [PATCH] ntfs3: fix info-leak in ntfs_rename() Dmitry Antipov
2026-06-09 20:19 ` Al Viro
2026-06-09 23:08 ` Al Viro
2026-06-10 11:12 ` Dmitry Antipov
2026-07-15 17:03 ` 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=c72be8fb-1ac5-497a-8d69-3619fbb8eff3@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=dmantipov@yandex.ru \
--cc=lvc-project@linuxtesting.org \
--cc=ntfs3@lists.linux.dev \
--cc=syzbot+905d785c4923bea2c1db@syzkaller.appspotmail.com \
--cc=viro@zeniv.linux.org.uk \
/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.