mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wahid Khan <wahidzk0091@gmail.com>
To: linkinjeon@kernel.org
Cc: hyc.lee@gmail.com, ntfs@lists.linux.dev,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] ntfs: convert a named $DATA stream safely when making room in a record
Date: Mon,  9 Nov 2026 03:41:04 +0530	[thread overview]
Message-ID: <20261108221104.1081384-1-wahidzk0091@gmail.com> (raw)
In-Reply-To: <CAKYAXd9=crUmmGbO1vcPsdz-GmWoHxD_W_bRv2PQ_Db3Q+EkCQ@mail.gmail.com>

Hi,

I went through Sashiko's review of v4. The WOF finding is right, and
checking the rest of its report turned up three more problems in the
same loop. I reproduced all four with a forced make-room pass and debug
delays; each fails on v4 and passes on v5, which I am sending as a
reply to this mail:

- WofCompressedData: the stream of a WOF file was converted, but
  ntfs_read_wof_chunk() reads a non-resident stream from the device, so
  the file read stale clusters until writeback (249 of 250 bytes wrong,
  correct after sync). v5 leaves the streams of a WOF file alone.

- An attribute converted in a file with no links left is evicted on the
  last iput() with its dirty folio, so an open file reads its extended
  attribute back as missing. This is older than my patch, the check
  covered only $DATA. v5 converts nothing in such a file.

- A resize of a stream or an EA converted the unnamed data of the file
  under a writer of that file (iomap_iter warnings, recursive
  mrec_lock), because only the resize of the unnamed data itself holds
  its i_rwsem. v5 converts the unnamed data only when it is the
  attribute being resized.

- The conversion of the attribute being resized waited for folio 0 with
  mrec_lock held and hangs against an mmap fault or a splice reader
  (hung task). I wrote in the mail to the v2 thread that this direct
  conversion is safe because the reader waits on i_rwsem first. That
  holds for read(), not for mmap and splice, so it was wrong. v5 uses
  FGP_NOWAIT there too. While such a reader is stuck on the lock the
  resize now fails with -ENOSPC instead of hanging, which I think is the
  better of the two, but tell me if you would rather handle it
  differently.

The six scenarios from the v4 mail still pass, and so does a WOF file
read before and after the conversion. I also ran a mutated-image fuzzer
(about 800 images, KASAN and lockdep) and the resident/non-resident
reader stress test on v5: no crash involves this code. Two things the
fuzzer hit exist without this patch as well, a WARN in iomap_iter() on
the read path of a crafted image and a lockdep report between extent_lock
and the mft runlist lock. I will look at those separately.

Thanks,
Wahid

  reply	other threads:[~2026-11-08 22:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 12:45 [PATCH v2 0/3] ntfs: three fixes for crafted images, found by fuzzing Wahid Khan
2026-11-06 12:45 ` [PATCH v2 1/3] ntfs: do not read an index block outside $INDEX_ALLOCATION Wahid Khan
2026-11-06 12:45 ` [PATCH v2 2/3] ntfs: open the index allocation before reading or writing an index block Wahid Khan
2026-11-06 12:45 ` [PATCH v2 3/3] ntfs: do not convert a named $DATA stream when making room in a record Wahid Khan
2026-11-06 13:31   ` Wahid Khan
2026-11-06 14:12     ` Namjae Jeon
2026-11-07 19:28       ` [PATCH v3] ntfs: open a named $DATA stream by name " Wahid Khan
2026-11-08  2:14         ` Namjae Jeon
2026-11-07 19:28       ` [PATCH v2 3/3] ntfs: do not convert a named $DATA stream " Wahid Khan
2026-11-08  8:03       ` [PATCH v4] ntfs: convert a named $DATA stream safely " Wahid Khan
2026-11-08 12:50         ` Namjae Jeon
2026-11-08 22:11           ` Wahid Khan [this message]
2026-11-08 22:12           ` [PATCH v5] " Wahid Khan
2026-11-09  7:07             ` [PATCH v6] " Wahid Khan
2026-11-08  8:08       ` [PATCH v2 3/3] ntfs: do not convert a named $DATA stream " Wahid Khan
2026-11-06 13:31 ` [PATCH v2 0/3] ntfs: three fixes for crafted images, found by fuzzing Namjae Jeon

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=20261108221104.1081384-1-wahidzk0091@gmail.com \
    --to=wahidzk0091@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs@lists.linux.dev \
    /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®