From: Namjae Jeon <linkinjeon@kernel.org>
To: CharSyam <charsyam@gmail.com>
Cc: hyc.lee@gmail.com, ntfs@lists.linux.dev,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
sebastian.n.feld@gmail.com, cedric.blancher@gmail.com,
Lionelcons1972@gmail.com
Subject: Re: [PATCH v2 1/4] ntfs: add named stream ioctls support
Date: Wed, 7 Oct 2026 11:24:59 +0900 [thread overview]
Message-ID: <CAKYAXd-Rfdd+zU3sBvx-pJotiYj=BbAdVGFuJypYYZe0N8Askw@mail.gmail.com> (raw)
In-Reply-To: <CAMrLSE6=2pRW7oQ40NME-vCpP+kdmB-D=kNWTDMY4xVdwGzeyA@mail.gmail.com>
On Wed, Oct 7, 2026 at 11:07 AM CharSyam <charsyam@gmail.com> wrote:
>
> Hi Namjae,
>
> I found an error-reporting issue in NTFS_IOC_STREAM_READ. The underlying
> bug predates this patch: ntfs_inode_attr_pread() breaks when
> read_mapping_folio() fails without saving PTR_ERR(folio). It therefore
> returns the number of bytes read before the error. The new ioctl treats
> that nonnegative result as success and reports it in bytes_returned.
>
> An I/O error on the first 4 KiB can appear as a successful zero-byte
> read; an error on the second 4 KiB can appear as a successful 4 KiB
> read. A caller copying or backing up the stream may interpret either
> result as EOF and stop, even though the stream is larger. The on-disk
> stream size is unchanged.
>
> I tested this in QEMU with a 16 MiB named stream filled with 'A' and
> an 8 KiB read at offset 0. Using blkdebug to inject EIO on the first
> 4 KiB, the ioctl returned success with bytes_returned=0. Injecting EIO
> on the second 4 KiB returned success with bytes_returned=4096. After
> the change below, both cases return -EIO and copy no stream data to
> userspace. A retry without the injected fault reads all 8192 bytes.
> A read crossing the actual EOF still succeeds with a short count of
> 4096 bytes.
>
> Please propagate the folio error, including when earlier pages in the
> same request were read:
>
> folio = read_mapping_folio(mapping, index, NULL);
> if (IS_ERR(folio)) {
> err = PTR_ERR(folio);
> break;
> }
>
> The existing `return err ? (s64)err : total;` then returns the error.
> The ioctl already copies its temporary kernel buffer to userspace only
> on success, so it will not expose partial data on this failure. The
> UAPI should also state that a successful short read indicates EOF and
> that a read error copies no stream data.
Okay, I will fix it in v3.
Thanks for the review!
next prev parent reply other threads:[~2026-10-07 2:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 22:40 [PATCH v2 0/4] ntfs: add named data stream support Namjae Jeon
2026-10-06 22:40 ` [PATCH v2 1/4] ntfs: add named stream ioctls support Namjae Jeon
2026-10-07 2:07 ` CharSyam
2026-10-07 2:24 ` Namjae Jeon [this message]
2026-10-06 22:40 ` [PATCH v2 2/4] ntfs: add pathname access for named streams Namjae Jeon
2026-10-07 3:38 ` CharSyam
2026-10-07 5:05 ` Namjae Jeon
2026-10-06 22:40 ` [PATCH v2 3/4] MAINTAINERS: ntfs: add UAPI header Namjae Jeon
2026-10-06 22:40 ` [PATCH v2 4/4] ntfs: document named streams 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='CAKYAXd-Rfdd+zU3sBvx-pJotiYj=BbAdVGFuJypYYZe0N8Askw@mail.gmail.com' \
--to=linkinjeon@kernel.org \
--cc=Lionelcons1972@gmail.com \
--cc=cedric.blancher@gmail.com \
--cc=charsyam@gmail.com \
--cc=hyc.lee@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs@lists.linux.dev \
--cc=sebastian.n.feld@gmail.com \
/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®