From: Matthias Goergens <matthias.goergens@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Christian Brauner <brauner@kernel.org>,
chenyichong@uniontech.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] isofs: validate directory records in isofs_read_level3_size()
Date: Wed, 23 Sep 2026 23:32:17 +0800 [thread overview]
Message-ID: <20260923153217.777351-1-matthias.goergens@gmail.com> (raw)
In-Reply-To: <cpadce3biub2f3lv5mnuegqpd5wwip3n67oe4xy3jujserdzfk@ynipz43pmoul>
Hi Jan,
Thanks for looking at it.
I don't see how it can trigger there, but I'm probably missing
something, so here is my reasoning. With 1/2 alone, offset is always
below bufsize at the top of the loop: a record that ends exactly at the
end of the block takes the existing "offset >= bufsize" branch further
down, which leaves offset & (bufsize - 1) == 0 and bumps block, so the
next iteration starts at offset 0 of the next block. And
isofs_dir_record_valid() accepts a record that ends exactly at bufsize:
its test "len > bufsize - offset" is false when len equals the room
left.
I also tried it, running fs/isofs in a userspace harness on level 3
images where a record of a multi-extent file ends exactly at the end of
a block, including xorrisofs -iso-level 3 output with a sparse 8 GiB
file. Neither 1/2 alone nor 1/2+2/2 rejects the directory, and the file
sizes come out right; a record whose length runs past the block is
rejected.
If you have a reproducer, or just a hint at the case you have in mind,
I'd be really happy to look at it.
Even if the code might be technically correct, it's confusing. 1/2 only
works because of a branch further down that 2/2 then deletes, so I'll
send a v2 that squashes the two: move on to the next block first, then
check the record, as you suggest, with the straddle code gone. The end
result is the same code as after 2/2.
Matthias
next prev parent reply other threads:[~2026-09-23 15:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 14:01 [PATCH 0/2] isofs: simplify the level 3 directory record walk Matthias Goergens
2026-09-22 14:01 ` [PATCH 1/2] isofs: validate directory records in isofs_read_level3_size() Matthias Goergens
2026-09-23 13:37 ` Jan Kara
2026-09-23 15:32 ` Matthias Goergens [this message]
2026-09-23 17:01 ` Jan Kara
2026-09-22 14:01 ` [PATCH 2/2] isofs: drop support for level 3 records straddling blocks Matthias Goergens
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=20260923153217.777351-1-matthias.goergens@gmail.com \
--to=matthias.goergens@gmail.com \
--cc=brauner@kernel.org \
--cc=chenyichong@uniontech.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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®